提交 79d0eb3e 编写于 作者: J jerrywgz 提交者: GitHub

optimize error message when result is none (#2862)

* optimize error message when result is none
上级 8bd4a577
...@@ -56,6 +56,10 @@ def bbox_eval(results, anno_file, outfile, with_background=True): ...@@ -56,6 +56,10 @@ def bbox_eval(results, anno_file, outfile, with_background=True):
for i, catid in enumerate(cat_ids)}) for i, catid in enumerate(cat_ids)})
xywh_results = bbox2out(results, clsid2catid) xywh_results = bbox2out(results, clsid2catid)
assert len(
xywh_results) > 0, "The number of valid bbox detected is zero.\n \
Please use reasonable model and check input data."
with open(outfile, 'w') as f: with open(outfile, 'w') as f:
json.dump(xywh_results, f) json.dump(xywh_results, f)
...@@ -77,6 +81,10 @@ def mask_eval(results, anno_file, outfile, resolution, thresh_binarize=0.5): ...@@ -77,6 +81,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())} clsid2catid = {i + 1: v for i, v in enumerate(coco_gt.getCatIds())}
segm_results = mask2out(results, clsid2catid, resolution, thresh_binarize) segm_results = mask2out(results, clsid2catid, resolution, thresh_binarize)
assert len(
segms_results) > 0, "The number of valid mask detected is zero.\n \
Please use reasonable model and check input data."
with open(outfile, 'w') as f: with open(outfile, 'w') as f:
json.dump(segm_results, f) json.dump(segm_results, f)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册