Skip to content

Commit f54c7f2

Browse files
koki.murasawakoki.murasawa
authored andcommitted
Added handling for cases where 'attributes' key is absent
1 parent 6c117e7 commit f54c7f2

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

fastlabel/converters.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -860,11 +860,10 @@ def execute_coco_to_fastlabel(coco: dict, annotation_type: str) -> dict:
860860

861861
annotations = []
862862
for target_coco_annotation in target_coco_annotations:
863+
attributes_items = target_coco_annotation.get("attributes", {})
863864
attributes = [
864865
{"key": attribute_key, "value": attribute_value}
865-
for attribute_key, attribute_value in target_coco_annotation[
866-
"attributes"
867-
].items()
866+
for attribute_key, attribute_value in attributes_items.items()
868867
]
869868
category_name = coco_categories[target_coco_annotation["category_id"]]
870869
if not category_name:

0 commit comments

Comments
 (0)