提交 eb50d0b3 编辑于 作者: suilin0432's avatar suilin0432
浏览文件

update

上级 6ae34749
......@@ -304,7 +304,20 @@ Category ids in annotations are not in [1, #categories]! We'll apply a mapping f
assert anno["image_id"] == image_id
assert anno.get("ignore", 0) == 0, '"ignore" in COCO json file is not supported.'
obj = {key: anno[key] for key in ann_keys if key in anno}
# seg 和 keypoint 都不会有, 所以不添加了
# seg 和 keypoint 都不会有, 所以不添加了 (update 2021.10.14, 因为考虑到 WSIS 任务这里添加 seg)
segm = anno.get("segmentation", None)
if segm: # either list[list[float]] or dict(RLE)
if isinstance(segm, dict):
if isinstance(segm["counts"], list):
# convert to compressed RLE
segm = mask_util.frPyObjects(segm, *segm["size"])
else:
# filter out invalid polygons (< 3 points)
segm = [poly for poly in segm if len(poly) % 2 == 0 and len(poly) >= 6]
if len(segm) == 0:
num_instances_without_valid_segmentation += 1
continue # ignore this instance
obj["segmentation"] = segm
obj["bbox_mode"] = BoxMode.XYWH_ABS
if id_map:
......
支持 Markdown
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册