From 54e097c91645add50a51b532d70bc5bbcc0b1114 Mon Sep 17 00:00:00 2001 From: bobyard-com <154289614+bobyard-com@users.noreply.github.com> Date: Thu, 22 Feb 2024 14:42:03 -0800 Subject: [PATCH] Fix RLE when segmentation is None --- sahi/utils/coco.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sahi/utils/coco.py b/sahi/utils/coco.py index 1777555aa..e84f2f3d3 100644 --- a/sahi/utils/coco.py +++ b/sahi/utils/coco.py @@ -130,7 +130,7 @@ def from_coco_annotation_dict(cls, annotation_dict: Dict, category_name: Optiona annotation_dict: dict COCO formatted annotation dict (with fields "bbox", "segmentation", "category_id") """ - if annotation_dict.__contains__("segmentation") and not isinstance(annotation_dict["segmentation"], list): + if annotation_dict.__contains__("segmentation") and isinstance(annotation_dict["segmentation"], dict): has_rle_segmentation = True logger.warning( f"Segmentation annotation for id {annotation_dict['id']} is skipped since RLE segmentation format is not supported."