I am training a CNN using the Keras ImageDataGenerator class. My code looks something like:
from keras.callbacks import LearningRateScheduler
from keras.callbacks import EarlyStopping
from keras.preprocessing.image import ImageDataGenerator
data_generator = ImageDataGenerator(
rotation_range = 15,
width_shift_range = 0.1,
height_shift_range = 0.1,
horizontal_flip = True
)
data_generator.fit(xtrain)
es = EarlyStopping(monitor = 'val_loss', mode = 'min', verbose = 1, patience = 100)
history = CNN_model.fit(data_generator.flow(xtrain, ytrain, batch_size = batch_size), \
epochs = num_epochs, \
validation_data = (xval, yval), \
callbacks = [LearningRateScheduler(learning_rate_schedule), es])
Now I have looked at the documentation and I don't entirely understand if it does this image augmentation to every image in each batch, or it is randomly selects a percentage of them? I am assuming that it does augmentation to each image but I am trying to understand.
If it is doing this to every image in my dataset, this means that I am not at all using an un-augmented image for any of my training epochs, correct?
Thanks!
