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

Problem with upload annotation - landscape/portrait #738

Closed
sbanori opened this issue Sep 26, 2019 · 5 comments
Closed

Problem with upload annotation - landscape/portrait #738

sbanori opened this issue Sep 26, 2019 · 5 comments
Labels
question Further information is requested

Comments

@sbanori
Copy link

sbanori commented Sep 26, 2019

Hello,
Maybe my problem is similar like in issue #733 but I will tell you about my case.
When we have photos, some of them can have bad orientation to make bboxes on them (1bokiem.jpg).

image

So we have two ways:

  1. Rotate 90 degrees in any program to correct orientation (like photo 1ok.jpg) and import to CVAT's task.
  2. Use a build in functionality to rotate photo.

And here is a bit problem with with second way.

  1. I see bad orientation photo, I can't work on them so I use rotation in CVAT menu.
  2. Now I can work, make BBoxes on rotated photo.
  3. When I finished I saved changes, dump annotation and closed task's window.
  4. When I open again this task, the photo is again rotated on bad orientation, but BBoxes are rotated too, so ok. Here we don't have problem yet.
  5. When I will now make new task, with the same photos, and I will use Upload annotation then everything works, I see rotated photo with rotated BBoxes so still everything is OK.
  6. But now finally we have problem: When I will use way nr 1 (rotate photo to correct orientation - useful to make BBoxes on them) make a task from these photos and try to upload my annotation from the same photo but with bad-orientation, then I have error:
    image
    which means that rotating function in CVAT's window work only optically on this session, and it not saving the new orientation in photo data.

Is this works correct?

@nmanovic
Copy link
Contributor

Hi @sbanori ,

Basically it does work correctly. For the tool you changed photos (at least dimensions) and try to upload old annotations for new photos. It will not work. Even you are lucky and you don't have the error you will have incorrect annotations on these new photos (they are new just because you did some transformation with them out of the tool).

You have to update annotations as well (rotate bounding boxes as you did for images). It should be trivial but we don't have scripts which will do such transformation for you.

What can be done here?

  • Save your preferences per task and load the task as you did in the past (we don't have the feature yet)
  • If all photos are in the same "bad" orientation you can use option "rotate images on all frames" in settings (F2).
  • We can provide a module which can do some transformation for you (we don't have the feature yet)

I will close the question for now. Don't hesitate to summit a feature request

@nmanovic nmanovic added the question Further information is requested label Sep 26, 2019
@dzanaga
Copy link

dzanaga commented Oct 14, 2019

@sbanori From what I figured out CVAT reads in the image in the original 'rotation', meaning that it doesn't apply any rotation stored in the EXIF metadata. Sometimes pictures include an EXIF Orientation Value, and when you open them, based on the software you are using and this value they can be rotated or not. See for example scikit-image/scikit-image #3150.

For example if you use skimage.io.imread to open your images, you can open them ignoring the EXIF Orientation Value by using the option skimage.io.imread(filename, plugin='pil'), this will open the image in the same way as CVAT does.

@nmanovic
Copy link
Contributor

@dzanaga , do you think we should have an option to use EXIF metadata for images in settings?

@dzanaga
Copy link

dzanaga commented Oct 15, 2019

@nmanovic I believe it would be enough to document the behavior in the User's Guide, so that users are aware or can easily find out about this detail if needed for their images.

The EXIF orientation is a metadata value that can be changed quite easily by viewing software or can also be lost during intermediate processing steps. I wouldn't rely on it, I think it would introduce more confusion.
e.g. imagine that you have that option activated and you label an image. Then an user opens that image on the file system to check it and rotates it (etc). The orientation metadata value changes, but the label in cvat db wouldn't be aware of it. When the user dumps the annotation he would end up with something rotated, and unless you add also another field in the annotations to keep track of the original orientation value at the time of the creation this can only be found out later by manual inspection. Most of the time it would go unnoticed creating wrong labels.
The current behavior enforce more consistency.

@lgeo3
Copy link

lgeo3 commented Feb 9, 2022

@sbanori From what I figured out CVAT reads in the image in the original 'rotation', meaning that it doesn't apply any rotation stored in the EXIF metadata. Sometimes pictures include an EXIF Orientation Value, and when you open them, based on the software you are using and this value they can be rotated or not. See for example scikit-image/scikit-image #3150.

For example if you use skimage.io.imread to open your images, you can open them ignoring the EXIF Orientation Value by using the option skimage.io.imread(filename, plugin='pil'), this will open the image in the same way as CVAT does.

For opencv for example you can use

cv2.imread(path,  cv2.IMREAD_IGNORE_ORIENTATION | cv2.IMREAD_COLOR) 

as highligted in https://stackoverflow.com/questions/44537075/image-orientation-pythonopencv

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

4 participants