Skip to content

Instantly share code, notes, and snippets.

Created April 25, 2018 16:33
What would you like to do?
# Shift images vertically or horizontally
# Fill missing pixels with the color of the nearest pixel
datagen = ImageDataGenerator(width_shift_range=.2,
# fit parameters from data
# Configure batch size and retrieve one batch of images
for X_batch, y_batch in datagen.flow(x_train, y_train, batch_size=9):
# Show 9 images
for i in range(0, 9):
pyplot.subplot(330 + 1 + i)
pyplot.imshow(X_batch[i].reshape(img_rows, img_cols, 3))
# show the plot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment