Randomly augmenting images using Keras

Viewed 743

I am experimenting with MNIST dataset to learn Keras library. In MNIST, there are 60k training images and 10k validation images.

In both sets, I'd like to introduce augmentation on 30% of the images.

datagen = ImageDataGenerator(horizontal_flip=True, vertical_flip=True)
datagen.fit(training_images)
datagen.fit(validation_images)

This does not augment images and I am not sure how to use model.fit_generator method. My current model.fit is as following:

model.fit(training_images, training_labels, validation_data=(validation_images, validation_labels), epochs=10, batch_size=200, verbose=2)

How do I apply augmentation on some of the images in this dataset?

1 Answers
Related