Skip to content

Instantly share code, notes, and snippets.

@aniruddha27
Created April 5, 2020 12:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aniruddha27/be63e6913d41a6353497bf0c73c8da55 to your computer and use it in GitHub Desktop.
Save aniruddha27/be63e6913d41a6353497bf0c73c8da55 to your computer and use it in GitHub Desktop.
# ImageDataGenerator flipping
datagen = ImageDataGenerator(horizontal_flip=True, vertical_flip=True)
# iterator
aug_iter = datagen.flow(img, batch_size=1)
# generate samples and plot
fig, ax = plt.subplots(nrows=1, ncols=3, figsize=(15,15))
# generate batch of images
for i in range(3):
# convert to unsigned integers
image = next(aug_iter)[0].astype('uint8')
# plot image
ax[i].imshow(image)
ax[i].axis('off')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment