allow segmentation to be empty
@@ -178,12 +178,7 @@ Category ids in annotations are not in [1, #categories]! We'll apply a mapping f
)
segm = anno.get("segmentation", None)
- if segm is not None: # either list[list[float]] or dict(RLE)
- if len(segm) == 0:
- raise ValueError(
- f"One annotation of image {image_id} contains empty 'segmentation' value! "
- "This json does not have valid COCO format."
- )
+ if segm: # either list[list[float]] or dict(RLE)
if isinstance(segm, dict):
if isinstance(segm["counts"], list):
# convert to compressed RLE
