-
Notifications
You must be signed in to change notification settings - Fork 138
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enhance DatasetItem annotations for semantic segmentation model training use case #1503
Enhance DatasetItem annotations for semantic segmentation model training use case #1503
Conversation
Signed-off-by: Kim, Vinnam <[email protected]>
Signed-off-by: Kim, Vinnam <[email protected]>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## releases/1.7.0 #1503 +/- ##
=================================================
Coverage ? 80.78%
=================================================
Files ? 276
Lines ? 31511
Branches ? 6356
=================================================
Hits ? 25456
Misses ? 4643
Partials ? 1412
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Signed-off-by: Kim, Vinnam <[email protected]>
@@ -157,7 +157,7 @@ def _load_items(self, path): | |||
attributes[attr] = bbox_list[i] | |||
i += 1 | |||
|
|||
annotations.append( | |||
items[item_id].annotations.append( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why only Widerface is affected by this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At this line, annotations: List
is created
annotations = [] |
Then, this
annotations
is used to construct DatasetItem
heredatumaro/src/datumaro/plugins/data_formats/widerface.py
Lines 123 to 128 in 072c8a8
items[item_id] = DatasetItem( | |
id=item_id, | |
subset=self._subset, | |
media=Image.from_file(path=image_path), | |
annotations=annotations, | |
) |
However, in the following lines,
Bbox
is pushed into annotations
, not items[item_id].annotations
,datumaro/src/datumaro/plugins/data_formats/widerface.py
Lines 160 to 169 in 072c8a8
annotations.append( | |
Bbox( | |
float(bbox_list[0]), | |
float(bbox_list[1]), | |
float(bbox_list[2]), | |
float(bbox_list[3]), | |
attributes=attributes, | |
label=label, | |
) | |
) |
Previously, it should work because id(annotations) == id(items[item_id].annotations)
(same Python object). However, after this PR change,
annotations: List
items[item_id].annotations: Annotations
=>
id(annotations) != id(items[item_id].annotations)
, so that widerface.py#L160-L169
above will be not working.
Summary
dataset_item.annotations
by introducingAnnotation(list[Annotation])
class. This class extends the pure Python list to equip more utility functions. At the same time, the utility function we introduce this time isdataset_item.annotations.get_semantic_seg_mask()
. This function bypasses binary mask conversion to construct an integer mask used for semantic segmentation model training.How to test
tests/unit/test_annotation.py
).Checklist
License
Feel free to contact the maintainers if that's a concern.