Skip to content

Commit

Permalink
Return original path if no annotation changes needed
Browse files Browse the repository at this point in the history
  • Loading branch information
JSabadin committed Nov 5, 2024
1 parent 347dace commit f99b205
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions luxonis_ml/data/parsers/coco_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,16 @@ def generator() -> DatasetIterator:


def clean_annotations(annotation_path: Path) -> Path:
"""Cleans annotations by removing images that are known to cause
issues.
@type annotation_path: Path
@param annotation_path: Path to the annotation JSON file.
@rtype: Path
@return: Path to the cleaned annotation JSON file
("labels_fixed.json").
"""

files_to_avoid = [
"000000341448.jpg",
"000000279522.jpg",
Expand All @@ -347,6 +357,10 @@ def clean_annotations(annotation_path: Path) -> Path:
for img in annotation_data["images"]
if img["file_name"] not in files_to_avoid
]

if len(filtered_images) == len(annotation_data["images"]):
return annotation_path

filtered_image_ids = {img["id"] for img in filtered_images}
filtered_annotations = [

Check warning on line 365 in luxonis_ml/data/parsers/coco_parser.py

View check run for this annotation

Codecov / codecov/patch

luxonis_ml/data/parsers/coco_parser.py#L364-L365

Added lines #L364 - L365 were not covered by tests
ann
Expand Down

0 comments on commit f99b205

Please sign in to comment.