I would like to generate augmented data for images by Random rotation, shifts, shear and flips.
I have found this keras
function.
The function keras.preprocessing.image.ImageDataGenerator
But I've seen this being used to directly train networks.
Is there a way to input images and then save the transformed images on HDD instead of how if currently works in examples in this link
Or is there another simple plug and use python package I can use instead of implementing everything with numpy
or opencv
?
You can save the images outputted by ImageGenerator to HDD. One option is to use datagen.flow as follows:
A second option is to manually loop over each image, load it, and apply a random transformation. Once you have instantiated your ImageGenerator, just call:
Then, save the transformed image to HDD using PIL etc.
A third option is to manually loop over each image, load it, and apply a random transformation using a third party program. I recommend imgaug, found here.
Basically - this is
generator
which is infinitely returning a batches of images. One could do the following:to save images from
keras
image generator.