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

Handle EXIF tag in JPG images #1059

Closed
CDahmsCellarEye opened this issue Jan 16, 2020 · 5 comments · Fixed by #4529
Closed

Handle EXIF tag in JPG images #1059

CDahmsCellarEye opened this issue Jan 16, 2020 · 5 comments · Fixed by #4529
Assignees
Labels
bug Something isn't working

Comments

@CDahmsCellarEye
Copy link

CDahmsCellarEye commented Jan 16, 2020

I've noticed that CVAT rotates relatively large images that are "Portrait" (taller than they are wide) 90 degrees left or right.

There are two existing issues that seem to be somewhat related to this:
#733
#738

But neither clearly explains the problem or provides the steps to reproduce the concern, so I figured I'd submit a new issue and document and explain everything clearly.

Steps to reproduce:

  1. Download and unzip the attached images.zip at the bottom of this post, which contains 3 images I took outside my workplace this afternoon. All 3 are 3024 wide x 4032 high.

  2. Install the latest version of CVAT, then open Chrome and start CVAT. Make a new task, name it anything you'd like. Add a few labels, for example I added car and fence. Drag the 3 unzipped images into the Click or drag files to the area area. Wait for the files to be listed, then choose Submit. Wait for CVAT to load in the images.

  3. Go back to the main CVAT Tasks page, for the task you just made choose Open, then click on Job #x towards the bottom left and scroll through the images, all 3 will be rotated 90 degrees.

Here is a screenshot of what my screen looks like after following these steps:

image

An additional thing I've tried is to use the rotation buttons towards the bottom of the CVAT UI, which will rotate the images in the UI, and then I choose Open Menu -> Save Work. This does temporarily make the images upright as they should be, however the problem is that if I leave the task and then open it again at a later time the images go back to being rotated 90 degrees. I've also tried Open Menu -> Settings -> Rotate All Images, this does not help either.

A few other things I should mention:

  1. CVAT only does this to relatively large images. For example, I tried resizing the attached images all to 768 wide x 1024 high and then importing, and the images displayed in the correct orientation.

  2. The 3 images in the attached set were all rotated 90 degrees left by CVAT, however sometimes CVAT will rotate large portrait images right. I have not been able to determine any rhyme or reason as to when CVAT rotates left vs right, however I can say that left is more common.

This issue is a major concern for our company. We can code around it with substantial effort, however CVAT really should not be altering our images. Please address this concern as soon as possible.

images.zip

--- Edit ---

It seems that in some cases this can be a known issue for browser-based applications. Perhaps something along the lines of the suggestions provided in the highest rated answer to this SO question should be added to CVAT:

https://stackoverflow.com/questions/28251338/jquery-image-preview-exif-rotation-issue/28843763#28843763

Where/how something like that could be added to CVAT, I'm not sure.

@alalek
Copy link

alalek commented Jan 16, 2020

Rotation may be performed due EXIF information embedded into image files.
It can be stripped (before uploading or by uploads's "option"): https://stackoverflow.com/questions/2654281/how-to-remove-exif-data-without-recompressing-the-jpeg

@CDahmsCellarEye
Copy link
Author

After considering the above post from alalek, I've found I can do:

exiv2 rm *.jpg

to remove the EXIF data from all images, the ones with the above concern will then appear rotated. Then I can use MS Paint or Gimp or any image program to rotate the images so they are upright again, then feed them into CVAT and the orientation will be correct. So at least this is a workaround for the moment.

That said, it would be very helpful if CVAT could properly recognize the EXIF info so this would not be necessary.

@nmanovic
Copy link
Contributor

@CDahmsCellarEye , thanks for the feedback. CVAT should have the case carefully. Let's think how to implement a good solution for the problem.

@alalek , thanks for your great advice to workaround the issue.

@nmanovic nmanovic added this to the 1.1.0 - Beta milestone Jan 17, 2020
@nmanovic nmanovic added the bug Something isn't working label Jan 17, 2020
@nmanovic nmanovic changed the title CVAT rotates relatively large portrait images 90 degrees left or right upon upload Handle EXIF tag in JPG images Jan 17, 2020
@nmanovic nmanovic added enhancement New feature or request and removed bug Something isn't working labels Jan 17, 2020
@nmanovic nmanovic self-assigned this Jan 17, 2020
@nvmnghia
Copy link

@nmanovic I think this one is definitely a bug.

@SwimlanesOnline
Copy link

I just imported annotations someone made in CVAT to a different annotation software for review, and about half of the pictures have the annotations appear rotated by 90°. I suppose this would also cause issues for training models! If the training is based on the mismatched rotation, the models would train junk.
Would be glad to see a resolution of this :) Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants