diff --git a/supervision/dataset/core.py b/supervision/dataset/core.py index dc5de4d5..2fb3aa4c 100644 --- a/supervision/dataset/core.py +++ b/supervision/dataset/core.py @@ -563,7 +563,6 @@ class DetectionDataset(BaseDataset): images_directory_path: str, annotations_path: str, force_masks: bool = False, - use_precomputed_area: bool = False, use_iscrowd: bool = False, ) -> DetectionDataset: """ @@ -576,9 +575,6 @@ class DetectionDataset(BaseDataset): force_masks (bool): If True, forces masks to be loaded for all annotations, regardless of whether they are present. - use_precomputed_area (bool): If True, - uses precomputed area for all annotations, setting it to None if not - present. use_iscrowd (bool): If True, uses COCO's property `iscrowd` in all annotations, regardless of whether they are present. If not presented, `iscrowd=0` @@ -612,7 +608,6 @@ class DetectionDataset(BaseDataset): images_directory_path=images_directory_path, annotations_path=annotations_path, force_masks=force_masks, - use_precomputed_area=use_precomputed_area, use_iscrowd=use_iscrowd, ) return DetectionDataset(classes=classes, images=images, annotations=annotations) diff --git a/supervision/dataset/formats/coco.py b/supervision/dataset/formats/coco.py index e6cf3c1b..3ef86b47 100644 --- a/supervision/dataset/formats/coco.py +++ b/supervision/dataset/formats/coco.py @@ -94,7 +94,6 @@ def coco_annotations_to_detections( resolution_wh: Tuple[int, int], with_masks: bool, use_iscrowd: bool = False, - use_precomputed_area: bool = False, ) -> Detections: if not image_annotations: return Detections.empty() @@ -110,19 +109,13 @@ def coco_annotations_to_detections( iscrowd = [ image_annotation["iscrowd"] for image_annotation in image_annotations ] - else: - iscrowd = [0] * len(image_annotations) - - if use_precomputed_area: area = [image_annotation["area"] for image_annotation in image_annotations] - else: - area = None - - if use_iscrowd or use_precomputed_area: data = dict( iscrowd=np.asarray(iscrowd, dtype=int), area=np.asarray(area, dtype=float) ) else: + iscrowd = [0] * len(image_annotations) + area = None data = dict() if with_masks: @@ -197,7 +190,6 @@ def load_coco_annotations( annotations_path: str, force_masks: bool = False, use_iscrowd: bool = False, - use_precomputed_area: bool = False, ) -> Tuple[List[str], List[str], Dict[str, Detections]]: coco_data = read_json_file(file_path=annotations_path) classes = coco_categories_to_classes(coco_categories=coco_data["categories"]) @@ -228,7 +220,6 @@ def load_coco_annotations( resolution_wh=(image_width, image_height), with_masks=force_masks, use_iscrowd=use_iscrowd, - use_precomputed_area=use_precomputed_area, ) annotation = map_detections_class_id(