Skip to content

Commit

Permalink
Adding "difficult", "truncated", "occluded" attributes when convertin…
Browse files Browse the repository at this point in the history
…g to Pascal VOC if they are not present (#216)

* remove check for 'difficult' attribute

* remove check for 'truncated' and 'occluded' attributes

* update changelog
  • Loading branch information
yasakova-anastasia authored Apr 14, 2021
1 parent d549952 commit b3eaf4a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 14 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Allowed explicit label removal in `remap_labels` transform (<https://github.com/openvinotoolkit/datumaro/pull/203>)
- Image extension in CVAT format export (<https://github.com/openvinotoolkit/datumaro/pull/214>)
- Added a label "face" for bounding boxes in Wider Face (<https://github.com/openvinotoolkit/datumaro/pull/215>)
- Allowed adding "difficult", "truncated", "occluded" attributes when converting to Pascal VOC if these attributes are not present (<https://github.com/openvinotoolkit/datumaro/pull/216>)

### Security
-
Expand Down
20 changes: 6 additions & 14 deletions datumaro/plugins/voc_format/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -236,20 +236,12 @@ def save_subsets(self):
ET.SubElement(obj_elem, 'pose').text = \
str(attr['pose'])

if 'truncated' in attr:
truncated = _convert_attr('truncated', attr, int, 0)
ET.SubElement(obj_elem, 'truncated').text = \
'%d' % truncated

if 'difficult' in attr:
difficult = _convert_attr('difficult', attr, int, 0)
ET.SubElement(obj_elem, 'difficult').text = \
'%d' % difficult

if 'occluded' in attr:
occluded = _convert_attr('occluded', attr, int, 0)
ET.SubElement(obj_elem, 'occluded').text = \
'%d' % occluded
ET.SubElement(obj_elem, 'truncated').text = \
'%d' % _convert_attr('truncated', attr, int, 0)
ET.SubElement(obj_elem, 'occluded').text = \
'%d' % _convert_attr('occluded', attr, int, 0)
ET.SubElement(obj_elem, 'difficult').text = \
'%d' % _convert_attr('difficult', attr, int, 0)

bbox = obj.get_bbox()
if bbox is not None:
Expand Down

0 comments on commit b3eaf4a

Please sign in to comment.