Created
August 3, 2018 07:33
-
-
Save sameerg07/3a236a8ff7597976cb072c4b7308bb69 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from keras.preprocessing.image import ImageDataGenerator,img_to_array, load_img | |
datagen = ImageDataGenerator( | |
rotation_range=40, | |
width_shift_range=0.2, | |
height_shift_range=0.2, | |
shear_range=0.2, | |
zoom_range=0.2, | |
horizontal_flip=True, | |
fill_mode='nearest') | |
img = load_img('test1.jpg') | |
x = img_to_array(img) # creating a Numpy array with shape (3, 150, 150) | |
x = x.reshape((1,) + x.shape) # converting to a Numpy array with shape (1, 3, 150, 150) | |
i = 0 | |
for batch in datagen.flow(x,save_to_dir='preview', save_prefix='obama', save_format='jpeg'): | |
i += 1 | |
if i > 36: | |
break |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment