Skip to content

Instantly share code, notes, and snippets.

@jonathanoheix
Created January 4, 2019 08:27
Show Gist options
  • Save jonathanoheix/ca479048ecfbf90634a974e298f968c2 to your computer and use it in GitHub Desktop.
Save jonathanoheix/ca479048ecfbf90634a974e298f968c2 to your computer and use it in GitHub Desktop.
from keras.preprocessing.image import ImageDataGenerator
# number of images to feed into the NN for every batch
batch_size = 128
datagen_train = ImageDataGenerator()
datagen_validation = ImageDataGenerator()
train_generator = datagen_train.flow_from_directory(base_path + "train",
target_size=(pic_size,pic_size),
color_mode="grayscale",
batch_size=batch_size,
class_mode='categorical',
shuffle=True)
validation_generator = datagen_validation.flow_from_directory(base_path + "validation",
target_size=(pic_size,pic_size),
color_mode="grayscale",
batch_size=batch_size,
class_mode='categorical',
shuffle=False)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment