Reputation: 98
Does the rotation_range: Int. Degree range for random rotations
refer to the range [0, rotation_range] or [-rotation_range, rotation_range]. If I set rotation_range=40
, will my images be randomly rotated between [-40, 40] or [0, 40]?
Does ImageDataStore.flow
randomly generate different augmentations of an input image at every epoch or is a single augmentation generated at the start and used for all epochs.
For example, let's say I have some image A that is part of my inputs into the flow
method. Is image A augmented only once before training, and this augmented version used for all epochs? Or is image A randomly augmented every epoch?
When the param shuffle
is set to True
in the flow
method, does this mean the batches are shuffled every epoch, or the images within the batches are shuffled every epoch?
For example, lets say our training data consists of 15 images (labeled I1 - I15) is divided into 3 batches/mini-batches before epoch 1 starts (labeled B1, B2, B3).
Lets say before epoch 1, the images were assigned to the batches as follows:
Now in epoch 1, the batches are trained in the order B1, B2, B3.
When epoch 2 starts, will the images in B1, B2, B3 be shuffled so that each batch will not contain the same set of 5 images?
Upvotes: 0
Views: 1550
Reputation: 126
Question 1
The rotation range is [-rotation_range, rotation_range]. I suggest you to check your augmented images by using the parameter save_to_dir
in the method flow
. This way you can be sure that the images are being augmented as you expect.
Question 2
When calling next
, a random augmentation is applied to every image right after it's being loaded, according to the parameters you gave to the constructor of ImageDataGenerator
. I.e. an image can be left rotated in one epoch and in the next epoch the same image can be right rotated. That's what makes augmentation so efficient- you artificially increase the size of your data.
Question 3 The list of images is shuffled before each epoch. A batch of images will never repeat itself (well... you can calculate the odds)
Upvotes: 1