Skip to content

Instantly share code, notes, and snippets.

@VedPDubey
Created July 13, 2021 16:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save VedPDubey/143beb54baf942a4b5535432c65c394a to your computer and use it in GitHub Desktop.
Save VedPDubey/143beb54baf942a4b5535432c65c394a to your computer and use it in GitHub Desktop.
train_dir = 'data1a/training'
test_dir = 'data1a/validation'
train_data = ImageDataGenerator(rescale = 1./255,shear_range = 0.2, zoom_range = 0.2, horizontal_flip = True)
#defining training set, here size of image is reduced to 150x150, batch of images is kept as 128 and class is defined as 'categorical'.
training_set = train_data.flow_from_directory(train_dir, batch_size = 32, target_size = (64,64), class_mode = 'categorical')
#applying same scale as training set, but only feature scaling is applied. image augmentation is avoided to prevent leakage of testing data.
test_data = ImageDataGenerator(rescale = 1./255)
#defining testing set
testing_set = test_data.flow_from_directory(test_dir, batch_size = 32, target_size = (64,64), class_mode = 'categorical')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment