Created
July 15, 2020 11:32
-
-
Save nitin-bommi/8b6f78a6571d9bc5259fef0c3b2cf27e to your computer and use it in GitHub Desktop.
This file contains 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
# importing the library | |
import tensorflow as tf | |
# generating new images | |
train_datagen = tf.keras.preprocessing.image.ImageDataGenerator(rescale = 1./255, | |
rotation_range = 60, | |
width_shift_range = 0.2, | |
height_shift_range = 0.2, | |
shear_range = 0.2, | |
zoom_range = 0.2, | |
horizontal_flip = True) | |
# storing the images in batches | |
train_generator = train_datagen.flow_from_directory(training_dir, | |
target_size = (300, 300), | |
class_mode = 'binary', | |
batch_size = 128) | |
# rescaling the px values | |
validation_datagen = tf.keras.preprocessing.image.ImageDataGenerator(rescale = 1./255) | |
# storing the images in batches | |
validation_generator = validation_datagen.flow_from_directory(validation_dir, | |
target_size = (300, 300), | |
class_mode = 'binary', | |
batch_size = 128) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment