Skip to content

Commit

Permalink
loading with empty annotations
Browse files Browse the repository at this point in the history
  • Loading branch information
JSabadin committed Nov 27, 2024
1 parent abf2f9a commit b39761a
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions luxonis_ml/data/loaders/luxonis_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,4 +323,21 @@ def _load_image_with_annotations(

labels[task] = (array, anns[0]._label_type)

if not labels:
for task in self.classes_by_task.keys():
if task == LabelType.SEGMENTATION:
empty_array = np.zeros(

Check warning on line 329 in luxonis_ml/data/loaders/luxonis_loader.py

View check run for this annotation

Codecov / codecov/patch

luxonis_ml/data/loaders/luxonis_loader.py#L328-L329

Added lines #L328 - L329 were not covered by tests
(len(self.class_mappings[task]), height, width),
dtype=np.uint8,
)
if task == LabelType.BOUNDINGBOX:
empty_array = np.zeros((0, 6), dtype=np.float32)
if task == LabelType.KEYPOINTS:
empty_array = np.zeros((0, 3), dtype=np.float32)
if task == LabelType.CLASSIFICATION:
empty_array = np.zeros(

Check warning on line 338 in luxonis_ml/data/loaders/luxonis_loader.py

View check run for this annotation

Codecov / codecov/patch

luxonis_ml/data/loaders/luxonis_loader.py#L333-L338

Added lines #L333 - L338 were not covered by tests
(0, len(self.class_mappings[task])), dtype=np.float32
)
labels[task] = (empty_array, task)

Check warning on line 341 in luxonis_ml/data/loaders/luxonis_loader.py

View check run for this annotation

Codecov / codecov/patch

luxonis_ml/data/loaders/luxonis_loader.py#L341

Added line #L341 was not covered by tests

return img, labels

0 comments on commit b39761a

Please sign in to comment.