Andrew Zhao
Andrew Zhao

Reputation: 3

How to make sure all the images are the same orientation?

I am trying to do an shoes image classification task and want to make sure my input data all have the same orientation.

The majority of the images have the shoes pointing to the right: Right pointing shoe

But some of the shoes are pointing to the left: Left pointing shoe

I would like to make sure that all images point to the right and if they are pointed to the left, I would like to mirror that image. Is there a way in Python to automatically detect the correct orientation of an image?

Upvotes: 0

Views: 411

Answers (1)

Ganesh Tata
Ganesh Tata

Reputation: 1195

In image classification tasks, it is important to curate your dataset such that it encapsulates the different variations present in the data. This is to ensure that your model generalizes well, and it can predict accurately on unseen data. This is where image augmentation is helpful, since it enables you to augment the dataset to account for variations in data that were initially not present.

For instance, as you mentioned in one of your comments, one of the classes consists of all shoes pointed to the right. So, are all shoes in the test data / real-word data of this class also oriented to the right? Since this is highly unlikely, it is important to account for different orientations of the shoe for each class.

If this is one of the images in your training data -
wide demo pic

Then through augmentation you can include the left oriented image(s) in the training data - wide demo pic

For more information, please refer to data augmentation.

Upvotes: 1

Related Questions