apple / turicreate

Turi Create simplifies the development of custom machine learning models.
BSD 3-Clause "New" or "Revised" License
11.2k stars 1.14k forks source link

JPEG images are rotated (by -90 degrees) when using image_analysis.load_images #1147

Open SoroushKadineh opened 6 years ago

SoroushKadineh commented 6 years ago

My image set includes both JPEG (taken from iPhone camera) and PNG (screenshots from iPhone) extensions. By running this command: images = turicreate.image_analysis.load_images(url='/myImages',with_path=True, format='auto') I noticed that JPEG images are rotated 90 degrees to the left, but PNG images are all fine. This is a major issue since annotations associated with JPEG images become irrelevant.

TobyRoseman commented 6 years ago

I can not reproduce this issue. I ran the following code:

x = tc.image_analysis.load_images(url='/tmp/dog.JPEG',with_path=True, format='auto')
x[0]['image'].show()

The image gets displayed in the correctly.

Any additional steps to reproduce the problem? Can you share an image file where this problem is happening?

SoroushKadineh commented 6 years ago

@TobyRoseman - given your response, I thought my images were impacted by some scripts that I've run! But that's not the case. The same issue occurs with any images taken from an iPhone. img_7993 I just took this photo, from my iPhone, uploaded it to my desktop, then used image_analysis.load_images, resulted as described before!

Update: the photo that is uploaded here, is taken/shown normal (no rotation) from iPhone and desktop!

Update 2: if you click the image, you'll see the image in the normal (no rotation) position!

Update 3: this is actually a known issue when uploading images to servers! But even with manual rotation, the orientation won't be correct: if the image is in portrait or rotated +90 degrees, the uploaded image is rotated by -90 degrees (with respect to portrait position). Conversely, if the image is rotated -90 degrees or -180 degrees, the uploaded image is rotated by +90 degrees (with respect to portrait position)!

TobyRoseman commented 6 years ago

It seems Turi Create is not reading/applying the 'Orientation' tag from the Exif header.

This is a bug. Thanks for reporting it.

ryouchinsa commented 1 year ago

RectLabel is an offline image annotation tool for object detection and segmentation. Although this is not an open source program, with RectLabel you can remove the EXIF orientation flags from images and convert images to the front orientation. If necessary, you can rotate the image right/left by 90 degrees. You can export/import the Turi Create CSV format.