def _create_ann(whole_m, lbl, sc, img_id, ann_id, crw=None, ar=None):
H, W = whole_m.shape
if crw is None:
crw = False
whole_m = np.asfortranarray(whole_m.astype(np.uint8))
rle = mask_tools.encode(whole_m)
# Surprisingly, ground truth ar can be different from area(rle)
if ar is None:
ar = mask_tools.area(rle)
ann = {
'image_id': img_id, 'category_id': lbl,
'segmentation': rle,
'area': ar,
'id': ann_id,
'iscrowd': crw}
if sc is not None:
ann.update({'score': sc})
return ann
eval_instance_segmentation_coco.py 文件源码
python
阅读 22
收藏 0
点赞 0
评论 0
评论列表
文章目录