Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- 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>)
- Empty lines in YOLO annotations are ignored (<https://github.com/openvinotoolkit/datumaro/pull/221>)
- Export in VOC format when no image info is available (<https://github.com/openvinotoolkit/datumaro/pull/239>)

### Security
-
Expand Down
2 changes: 1 addition & 1 deletion datumaro/plugins/voc_format/converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ def save_subsets(self):
ET.SubElement(source_elem, 'annotation').text = 'Unknown'
ET.SubElement(source_elem, 'image').text = 'Unknown'

if item.has_image:
if item.has_image and item.image.has_size:
h, w = item.image.size
size_elem = ET.SubElement(root_elem, 'size')
ET.SubElement(size_elem, 'width').text = str(w)
Expand Down
28 changes: 27 additions & 1 deletion tests/test_voc_format.py
Original file line number Diff line number Diff line change
Expand Up @@ -763,4 +763,30 @@ def test_inplace_save_writes_only_updated_data(self):
self.assertFalse(osp.isfile(
osp.join(path, 'SegmentationObject', '3.png')))
self.assertFalse(osp.isfile(
osp.join(path, 'SegmentationClass', '3.png')))
osp.join(path, 'SegmentationClass', '3.png')))

def test_can_save_dataset_with_no_data_images(self):
class TestExtractor(TestExtractorBase):
def __iter__(self):
return iter([
DatasetItem(id='frame1', subset='test',
image=Image(path='frame1.jpg'),
annotations=[
Bbox(1.0, 2.0, 3.0, 4.0,
attributes={
'difficult': False,
'truncated': False,
'occluded': False
},
id=1, label=0, group=1
)
]
)
])

def categories(self):
return VOC.make_voc_categories()

with TestDir() as test_dir:
self._test_save_and_load(TestExtractor(),
partial(VocConverter.convert, label_map='voc'), test_dir)