Skip to content
Snippets Groups Projects
Commit 78783368 authored by Raymond Tunstill (Kirk)'s avatar Raymond Tunstill (Kirk) Committed by Kai Chen
Browse files

Fixed coco_eval bug where seg length check could be wrong (#1376) (#1384)

* Fixed coco_eval bug where seg length check could be wrong (#1376)

* Added check for segm counts field to check if the decode method is present

* Changed classes length check to more general check

* Fixed coco_utils.py to be more robust condition for mask lasbelling

* Added seg length check to ensure two objects exist

* Added type check over len check

* Check for only tuple
parent c64beaf1
No related branches found
No related tags found
No related merge requests found
......@@ -142,7 +142,7 @@ def segm2json(dataset, results):
# segm results
# some detectors use different score for det and segm
if len(seg) == 2:
if isinstance(seg, tuple):
segms = seg[0][label]
mask_score = seg[1][label]
else:
......@@ -153,7 +153,8 @@ def segm2json(dataset, results):
data['image_id'] = img_id
data['score'] = float(mask_score[i])
data['category_id'] = dataset.cat_ids[label]
segms[i]['counts'] = segms[i]['counts'].decode()
if isinstance(segms[i]['counts'], bytes):
segms[i]['counts'] = segms[i]['counts'].decode()
data['segmentation'] = segms[i]
segm_json_results.append(data)
return bbox_json_results, segm_json_results
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment