Images are being rotated when shown

In lesson 2 I have a couple imgs loaded to the machine and it works all fine but most of the images are being shown rotated by 90 degrees.

dls.valid.show_batch(max_n=4, nrows=1)

Anyone any idea why this might be?

Note: on the machine when I open them they are not rotated.

Hi,
I had the same issue, PILImage doesn’t rotate the images according to their EXIF metadata.

I wrote a blog post about that -> https://manuelmazzuola.dev/2020/02/17/my-first-neural-network#install-the-libraries

you can find a piece of code that extends ImageBlock called ExifImageBlock so you can use it in the DataBlock

Cheers

3 Likes

Seems like @originof 's blog post has moved to here: My first neural network classifier, statue or painting? - manuelmazzuola.dev