Skip to content

Commit af4ab23

Browse files
committed
add bbox_area_threshold to loader
1 parent 11a6bfe commit af4ab23

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

luxonis_ml/data/loaders/luxonis_loader.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ def __init__(
4848
exclude_empty_annotations: bool = False,
4949
color_space: Literal["RGB", "BGR", "GRAY"] = "RGB",
5050
seed: int | None = None,
51+
bbox_area_threshold: float = 0.0004,
5152
*,
5253
keep_categorical_as_strings: bool = False,
5354
update_mode: UpdateMode | Literal["all", "missing"] = UpdateMode.ALL,
@@ -95,6 +96,9 @@ def __init__(
9596
to C{"RGB"}.
9697
@type seed: Optional[int]
9798
@param seed: The random seed to use for the augmentations.
99+
@type bbox_area_threshold: float
100+
@param bbox_area_threshold: Minimum area threshold for bounding boxes to be considered valid. In the range [0, 1].
101+
Default is 0.0004, which corresponds to a small area threshold to remove invalid bboxes and respective keypoints.
98102
@type exclude_empty_annotations: bool
99103
@param exclude_empty_annotations: Whether to exclude
100104
empty annotations from the final label dictionary.
@@ -218,6 +222,7 @@ def __init__(
218222
width,
219223
keep_aspect_ratio,
220224
seed,
225+
bbox_area_threshold,
221226
)
222227

223228
@override
@@ -434,6 +439,7 @@ def _init_augmentations(
434439
width: int | None,
435440
keep_aspect_ratio: bool,
436441
seed: int | None = None,
442+
bbox_area_threshold: float = 0.0004,
437443
) -> AugmentationEngine | None:
438444
if isinstance(augmentation_config, PathType):
439445
with open(augmentation_config) as file:
@@ -475,6 +481,7 @@ def _init_augmentations(
475481
keep_aspect_ratio=keep_aspect_ratio,
476482
is_validation_pipeline="train" not in self.view,
477483
seed=seed,
484+
bbox_area_threshold=bbox_area_threshold,
478485
)
479486

480487
def _precompute_image_paths(self) -> None:

0 commit comments

Comments
 (0)