junsiong2008
junsiong2008

Reputation: 117

Why is Cloud AutoML Vision rotating my image?

I've imported images from my computer to my Cloud AutoML dataset in the form of zip file and I've noticed that the orientation of my images were altered. The orientation of my photos is important as I am doing a model to recognize hand gesture and orientation is an important feature. Is there anyway I could fix it? Screenshot

Upvotes: 1

Views: 645

Answers (3)

Yeghia
Yeghia

Reputation: 510

after preparing the dataset, I would advise you to run the sample code over all your images(it will remove the exif data from the images, and they will be oriented in the right way)

image = Image.open(f"{source_dir}/{f}")
data = list(image.getdata())
image2 = Image.new(image.mode, image.size)
image2.putdata(data)
image2.save(f"{destination_dit}/{f}")

once the code above is run, upload the images from your destination directory, and you will see AutoML images and your destination directory images are in the same orientation

Upvotes: 0

junsiong2008
junsiong2008

Reputation: 117

After contacting Google Cloud's support staff, I've found out that an image’s orientation will always follow the original orientation of the image once uploaded to AutoML as a dataset. Therefore, editing and rotating the image using default or other apps to correct such will not do the trick.

Upvotes: 1

Rally H
Rally H

Reputation: 142

Orientation correction is applied automatically as part of the image import process so this is an expected response.

A feature request has already been filed for this.

https://issuetracker.google.com/151399086

Upvotes: 0

Related Questions