Skip to content

Commit

Permalink
Fixed records without annotations (#197)
Browse files Browse the repository at this point in the history
  • Loading branch information
kozlov721 authored Oct 31, 2024
1 parent 97d301a commit e7121ff
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion luxonis_ml/data/datasets/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,7 @@ def create_new_record(
}

for record in generator:
if isinstance(record, DatasetRecord):
if isinstance(record, DatasetRecord) or "annotation" not in record:
yield record
continue

Expand Down
7 changes: 5 additions & 2 deletions luxonis_ml/data/loaders/luxonis_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,8 @@ def __init__(

self.class_mappings = {}
for task in df["task"].unique():
if not task:
continue
class_mapping = {
class_: i
for i, class_ in enumerate(
Expand Down Expand Up @@ -290,8 +292,9 @@ def _load_image_with_annotations(
"instance_id": instance_id,
}
)
annotation = load_annotation(type_, data)
labels_by_task[task].append(annotation)
if type_ != "NoneType":
annotation = load_annotation(type_, data)
labels_by_task[task].append(annotation)

labels: Labels = {}
for task, anns in labels_by_task.items():
Expand Down

0 comments on commit e7121ff

Please sign in to comment.