train_datagen = image.ImageDataGenerator( rescale = 1./255, # to normalize bigger values. Convert from 0-255 to 0-1 range. shear_range = 0.2, zoom_range = 0.2, horizontal_flip = True ) # only rescaling done on test dataset test_datagen = image.ImageDataGenerator( rescale = 1./255 ) train_generator = train_datagen.flow_from_directory( directory=TRAIN_PATH, target_size=(224,224), batch_size=32, class_mode='binary', save_to_dir = SAVE_TRAIN_PATH, save_prefix='', save_format='png' ) validation_generator = test_datagen.flow_from_directory( VAL_PATH, target_size = (224,224), batch_size = 32, class_mode = 'binary' ) # train_generator.class_indices validation_generator.class_indices # generate augmented images and save into the directory for i in range(5): train_generator.next()