Why is Cloud AutoML Vision rotating my image?

540 views Asked by At

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

3

There are 3 answers

1
Rally H On BEST ANSWER

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

0
junsiong2008 On

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.

0
Yeghia On

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