0
votes

The training data is read from two .npy files. Say, train_set is regarded as X, and train_label is regarded as Y. Therefore, it is not a multiple input case. My task requires to augment the image patches in different manner. So how to define different Image Generator for different patches? Although there could be a lot of patches, I use 3 patches as an example:

for patch1:

datagen = ImageDataGenerator(rotation_range=20)

for patch2:

datagen = ImageDataGenerator(rotation_range=40)

for patch3:

datagen = ImageDataGenerator(rotation_range=60)

How to apply different generators on different patches, and how may I use the model.fit(...) or model.fit_generator(...) for the described scenario?

Also, Is there a way to rotate the image by a particular degree instead of a range?

Thanks!

1

1 Answers

0
votes

I didn't do it myself, but I think one approach is to use the first datagen and pass the first group of training data with fit_generator and with the selected number of epochs. Then, save weight and use the second datagen and the second group with fit_generator. You also need to set initial_epoch and also need to load the weights. To generalize the question, what you need to do is to resume training with the second datagen. Please see https://keras.io/getting-started/faq/#how-can-i-save-a-keras-model.