diff --git a/CHANGELOG.md b/CHANGELOG.md index c3410b3544a..9198c439b12 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - ### Fixed +- Fixed dataset filter item representation for imageless dataset items (https://github.com/opencv/cvat/pull/1593) - Fixed interpreter crash when trying to import `tensorflow` with no AVX instructions available (https://github.com/opencv/cvat/pull/1567) ### Security diff --git a/datumaro/datumaro/components/dataset_filter.py b/datumaro/datumaro/components/dataset_filter.py index e9f10febda9..351cc6c8d1a 100644 --- a/datumaro/datumaro/components/dataset_filter.py +++ b/datumaro/datumaro/components/dataset_filter.py @@ -32,7 +32,12 @@ def encode(cls, item, categories=None): def encode_image(cls, image): image_elem = ET.Element('image') - h, w = image.size + size = image.size + if size is not None: + h, w = size + else: + h = 'unknown' + w = h ET.SubElement(image_elem, 'width').text = str(w) ET.SubElement(image_elem, 'height').text = str(h) diff --git a/datumaro/datumaro/plugins/yolo_format/extractor.py b/datumaro/datumaro/plugins/yolo_format/extractor.py index 5e2c61b3df6..135f6f8f206 100644 --- a/datumaro/datumaro/plugins/yolo_format/extractor.py +++ b/datumaro/datumaro/plugins/yolo_format/extractor.py @@ -137,7 +137,8 @@ def _parse_annotations(anno_path, image): annotations = [] if lines: - image_height, image_width = image.size # use image info late + # use image info as late as possible + image_height, image_width = image.size for line in lines: label_id, xc, yc, w, h = line.split() label_id = int(label_id)