1

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

junsiong2008
  • 107
  • 13
  • Google hasn't bothered with this as of 02/25/2021. Were you able to get around this? – arun Feb 26 '21 at 05:11
  • 1
    Hi Arun. You can follow the instruction here to enable the "orientation" column in File Explorer so that you can find out which photo is rotated: https://www.ivertech.com/Articles/Image-Rotation-Issue-With-Windows-10.aspx#:~:text=3)%20Go%20to%20the%20View,need%20to%20be%20manually%20rotated. Then, open the rotated image with Paint, and save the photo without doing anything. You will see the "Orientation" column of that photo being changed to "Normal" in the File Explorer. – junsiong2008 Feb 28 '21 at 08:02
  • Thx. I used Paint to change the Orientation to Normal. Then I uploaded the image to Google storage bucket at the same location the old file was. I also reimported the image into Datasets. The image is still rotated when I open to annotate it in Datasets. – arun Feb 28 '21 at 15:40

3 Answers3

1

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.

junsiong2008
  • 107
  • 13
0

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

Rally H
  • 132
  • 6
0

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

Yeghia
  • 510
  • 5
  • 8