Created
June 18, 2019 05:53
-
-
Save netsatsawat/5b86ee1f679fc59c68c293728f71dfb0 to your computer and use it in GitHub Desktop.
Use to demonstrate the ImageDataGenerator class and flow_from_directory() method
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
training_datagen = tf.keras.preprocessing.image.ImageDataGenerator(rescale=1./255., | |
rotation_range=30, | |
zoom_range=0.3, | |
width_shift_range=0.2, | |
height_shift_range=0.2, | |
fill_mode='nearest', | |
horizontal_flip=True) | |
validation_datagen = tf.keras.preprocessing.image.ImageDataGenerator(rescale=1./255.) | |
testing_datagen = tf.keras.preprocessing.image.ImageDataGenerator(rescale=1./255.) | |
training_generator = training_datagen.flow_from_directory('../data/Train/', | |
target_size=IMAGE_SIZE, | |
batch_size=32, | |
color_mode='rgb', | |
shuffle=True, | |
seed=SEED) | |
validatation_generator = validation_datagen.flow_from_directory('../data/Eval/', | |
target_size=IMAGE_SIZE, | |
batch_size=32, | |
color_mode='rgb', | |
shuffle=True, | |
seed=SEED) | |
testing_generator = testing_datagen.flow_from_directory('../data/Test/', | |
target_size=IMAGE_SIZE, | |
batch_size=1, | |
shuffle=False, | |
color_mode='rgb', | |
seed=SEED) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment