Skip to content

Instantly share code, notes, and snippets.

@ResidentMario
Created January 28, 2019 21:55
Show Gist options
  • Select an option

  • Save ResidentMario/015ed964c80f04dfb449b0ca4f454cd9 to your computer and use it in GitHub Desktop.

Select an option

Save ResidentMario/015ed964c80f04dfb449b0ca4f454cd9 to your computer and use it in GitHub Desktop.
from keras.preprocessing.image import ImageDataGenerator
train_datagen = ImageDataGenerator(
rotation_range=40,
width_shift_range=0.2,
height_shift_range=0.2,
rescale=1/255,
shear_range=0.2,
zoom_range=0.2,
horizontal_flip=True,
fill_mode='nearest'
)
test_datagen = ImageDataGenerator(
rescale=1/255
)
train_generator = train_datagen.flow_from_directory(
'../data/images_cropped/quilt/open_images/',
target_size=(128, 128),
batch_size=16,
class_mode='binary'
)
validation_generator = test_datagen.flow_from_directory(
'../data/images_cropped/quilt/open_images/',
target_size=(128, 128),
batch_size=16,
class_mode='binary'
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment