Reputation: 41
I have a code to augment images like the following,
# Augmentation
train_datagen = ImageDataGenerator(rotation_range=5, # rotation
width_shift_range=0.2, # horizontal shift
zoom_range=0.2, # zoom
horizontal_flip=True, # horizontal flip
brightness_range=[0.2,0.8]) # brightness
# Epochs
epochs = 25
# Batch size
batch_size = 32
history = model.fit(train_datagen.flow(x_train,y_train,
batch_size=batch_size,
seed=27,
shuffle=False),
epochs=epochs,
steps_per_epoch=x_train.shape[0] // batch_size,
validation_data=(x_test,y_test),
verbose=1)
I am trying to understand exactly how many extra images will be created in the training process as a result of augmentation. The second question is how can I create extra 50K images on the fly for the training?
Upvotes: 1
Views: 217
Reputation: 11
The datagenerator doesn't create new images it rather just transforms it for each epoch. if you have x_train ) = [x1,x2,x3] images in your entire training set, upon training in each epoch the model should see the same x_train BUT your x_train is so small (just 3 images) so the thing is for each epoch the datagen will feed the model the whole x_train slightly transformed (according to the parameters you put in ImageDataGenerator) e.g.:
Upvotes: 1