From e6e9865f60a6188e69b4377767d89085292923e8 Mon Sep 17 00:00:00 2001 From: wangguanzhong Date: Tue, 15 Oct 2019 15:06:11 +0800 Subject: [PATCH] refine log when mask is empty (#3579) --- PaddleCV/PaddleDetection/ppdet/utils/coco_eval.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/PaddleCV/PaddleDetection/ppdet/utils/coco_eval.py b/PaddleCV/PaddleDetection/ppdet/utils/coco_eval.py index 7640145d..d1ce5dcb 100644 --- a/PaddleCV/PaddleDetection/ppdet/utils/coco_eval.py +++ b/PaddleCV/PaddleDetection/ppdet/utils/coco_eval.py @@ -108,9 +108,10 @@ def mask_eval(results, anno_file, outfile, resolution, thresh_binarize=0.5): clsid2catid = {i + 1: v for i, v in enumerate(coco_gt.getCatIds())} segm_results = mask2out(results, clsid2catid, resolution, thresh_binarize) - assert len( - segm_results) > 0, "The number of valid mask detected is zero.\n \ - Please use reasonable model and check input data." + if len(segm_results) == 0: + logger.warning("The number of valid mask detected is zero.\n \ + Please use reasonable model and check input data.") + return with open(outfile, 'w') as f: json.dump(segm_results, f) @@ -556,4 +557,4 @@ def coco17_category_info(with_background=True): if not with_background: clsid2catid = {k - 1: v for k, v in clsid2catid.items()} - return clsid2catid, catid2name \ No newline at end of file + return clsid2catid, catid2name -- GitLab