Skip to content
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

Merged
merged 25 commits into from
May 17, 2023

Conversation

wonjuleee
Copy link
Contributor

@wonjuleee wonjuleee commented May 11, 2023

Summary

How to test

Checklist

  • I have added unit tests to cover my changes.​
  • I have added integration tests to cover my changes.​
  • I have added the description of my changes into CHANGELOG.​
  • I have updated the documentation accordingly

License

  • I submit my code changes under the same MIT License that covers the project.
    Feel free to contact the maintainers if that's a concern.
  • I have updated the license header for each file (see an example below).
# Copyright (C) 2023 Intel Corporation
#
# SPDX-License-Identifier: MIT

@codecov-commenter
Copy link

codecov-commenter commented May 12, 2023

Codecov Report

Patch coverage: 96.56% and project coverage change: -0.01 ⚠️

Comparison is base (332879d) 78.53% compared to head (a35a50c) 78.52%.

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     
Flag Coverage Δ
macos-11_Python-3.8 77.53% <96.56%> (-0.01%) ⬇️
ubuntu-20.04_Python-3.8 78.51% <96.56%> (-0.01%) ⬇️
windows-2019_Python-3.8 78.41% <96.56%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
datumaro/plugins/data_formats/voc/exporter.py 83.14% <91.37%> (+0.54%) ⬆️
datumaro/plugins/data_formats/voc/base.py 92.46% <97.95%> (-0.53%) ⬇️
datumaro/plugins/data_formats/voc/format.py 95.56% <100.00%> (+0.27%) ⬆️
datumaro/plugins/data_formats/voc/importer.py 89.58% <100.00%> (-10.42%) ⬇️

... and 2 files with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

datumaro/plugins/data_formats/voc/importer.py Outdated Show resolved Hide resolved
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]:
Copy link
Contributor

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.

tests/unit/test_voc_format.py Outdated Show resolved Hide resolved
datumaro/plugins/data_formats/voc/format.py Outdated Show resolved Hide resolved
Comment on lines 344 to 356
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)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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)

datumaro/plugins/data_formats/voc/exporter.py Outdated Show resolved Hide resolved
datumaro/plugins/data_formats/voc/exporter.py Outdated Show resolved Hide resolved
datumaro/plugins/data_formats/voc/exporter.py Outdated Show resolved Hide resolved
vinnamkim
vinnamkim previously approved these changes May 16, 2023
Copy link
Contributor

@vinnamkim vinnamkim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

@wonjuleee wonjuleee merged commit 1dede88 into openvinotoolkit:develop May 17, 2023
@vinnamkim vinnamkim added this to the 1.3.0 milestone May 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants