removing unnecessary flag

This commit is contained in:
rafaelpadilla committed 2025-05-07 22:10:15 +00:00
1 parent 790baa615f
commit 19c4e44e2c
2 files changed
+2 -16

No files matched your search

-5
View File
@@ -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)
+2 -11
View File
@@ -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(