# How to benefit Data augmentation when it yields to different classes

I'm trying to classify rooftop sky images orientations, whether it is horizontal or vertical. Knowing that the most obvious feature here is known: orientation. I can simply augment each class by rotating it 90° so it belongs to the other class. It is like dynamic augmentation to different classes.

Using keras image classification capabilities, obviously defeats the purpose:

datagen = ImageDataGenerator(
zoom_range=0.2, # randomly zoom into images
#       rotation_range=90,  # mistaken the model
horizontal_flip=True,  # randomly flip images
vertical_flip=False)  # randomly flip images


I am using keras for classification but open to other libraries, and techniques other than deep learning.

• So, basically, you can use any other augmentation provided in keras ImageDataGenerator instead of rotation? You could use rotation_range with a small value, like up to 10 degrees ... Dec 17 '18 at 13:05
• Other data augmentation techniques provided in ImageDataGenerator should not result in a class change. Dec 17 '18 at 13:08
• that's what I'm emphasizing. I want to augment data in an aware way to other classes. In my case, augmenting each class (horizontal and vertical) by rotation of 90° to the other opposite labeled class. how could I achieve this ? Dec 17 '18 at 21:09

You could rotate images manually (without using ImageDataGenerator) and save it to disk. That way you would know which images you have rotated - so you would know which images have changed the class.
After it, when using ImageDataGenerator, you need to set rotation_range to small value in order to be sure that it won't change the classes of images.