Skip to content

Commit

Permalink
Fix image size conversion (#1593)
Browse files Browse the repository at this point in the history
* Fix image size conversion

* update changelog

Co-authored-by: Nikita Manovich <40690625+nmanovic@users.noreply.github.com>
  • Loading branch information
zhiltsov-max and nmanovic authored Jun 5, 2020
1 parent 727fcd5 commit 1b413c6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 6 additions & 1 deletion datumaro/datumaro/components/dataset_filter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
3 changes: 2 additions & 1 deletion datumaro/datumaro/plugins/yolo_format/extractor.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 1b413c6

Please sign in to comment.