-
Notifications
You must be signed in to change notification settings - Fork 135
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
Fix VOC to have task-specific formats #997
Conversation
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## develop #997 +/- ##
===========================================
- Coverage 78.53% 78.52% -0.01%
===========================================
Files 233 233
Lines 26749 26757 +8
Branches 5320 5323 +3
===========================================
+ Hits 21007 21012 +5
+ Misses 4497 4496 -1
- Partials 1245 1249 +4
Flags with carried forward coverage won't be shown. Click here to find out more.
☔ View full report in Codecov by Sentry. |
anns = self._parse_annotations(root_elem, item_id=(item_id, self._subset)) | ||
anns += self._parse_annotations(root_elem, item_id=(item_id, self._subset)) | ||
|
||
if self._task in [VocTask.voc, VocTask.segmentation, VocTask.instance_segmentation]: |
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.
We can store the result of if self._task in [VocTask.voc, VocTask.segmentation, VocTask.instance_segmentation]
outside of the loop.
if self._task & {VocTask.person_layout}: | ||
for part_bbox in layout_bboxes: | ||
if part_bbox.group != obj.group: | ||
continue | ||
|
||
part_elem = ET.SubElement(obj_elem, "part") | ||
ET.SubElement(part_elem, "name").text = self.get_label(part_bbox.label) | ||
_write_xml_bbox(part_bbox.get_bbox(), part_elem) |
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.
if self._task & {VocTask.person_layout}: | |
for part_bbox in layout_bboxes: | |
if part_bbox.group != obj.group: | |
continue | |
part_elem = ET.SubElement(obj_elem, "part") | |
ET.SubElement(part_elem, "name").text = self.get_label(part_bbox.label) | |
_write_xml_bbox(part_bbox.get_bbox(), part_elem) | |
no_person_layout_task = False if self._task & {VocTask.person_layout} else True | |
... | |
if no_person_layout_task: | |
continue | |
for part_bbox in filter( | |
lambda x: obj.group and obj.group == x.group, layout_bboxes | |
): | |
part_elem = ET.SubElement(obj_elem, "part") | |
ET.SubElement(part_elem, "name").text = self.get_label(part_bbox.label) | |
_write_xml_bbox(part_bbox.get_bbox(), part_elem) |
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.
LGTM.
Summary
How to test
Checklist
License
Feel free to contact the maintainers if that's a concern.