I am resizing my RGB images stored in a folder(two classes) using following code:
from keras.preprocessing.image import ImageDataGenerator
dataset=ImageDataGener
Heres a very simple version of saving augmented images of one image wherever you want:
Here we figure out what changes we want to make to the original image and generate the augmented images
You can read up about the diff effects here- https://keras.io/preprocessing/image/
datagen = ImageDataGenerator(rotation_range=10, width_shift_range=0.1,
height_shift_range=0.1,shear_range=0.15,
zoom_range=0.1,channel_shift_range = 10, horizontal_flip=True)
read in the image
image_path = 'C:/Users/Darshil/gitly/Deep-Learning/My
Projects/CNN_Keras/test_augment/caty.jpg'
image = np.expand_dims(ndimage.imread(image_path), 0)
save_here = 'C:/Users/Darshil/gitly/Deep-Learning/My
Projects/CNN_Keras/test_augment'
datagen.fit(image)
for x, val in zip(datagen.flow(image, #image we chose
save_to_dir=save_here, #this is where we figure out where to save
save_prefix='aug', # it will save the images as 'aug_0912' some number for every new augmented image
save_format='png'),range(10)) : # here we define a range because we want 10 augmented images otherwise it will keep looping forever I think
pass