I am interested in using ImageDataGenerator in Keras to increase data. But this requires that the training and validation catalogs with subdirectories for classes be loaded separately, as shown below (this is from the Keras documentation). I have one directory with 2 subdirectories for 2 classes (Data / Class1 and Data / Class2). How I accidentally broke it into training and verification catalogs.
train_datagen = ImageDataGenerator( rescale=1./255, shear_range=0.2, zoom_range=0.2, horizontal_flip=True) test_datagen = ImageDataGenerator(rescale=1./255) train_generator = train_datagen.flow_from_directory( 'data/train', target_size=(150, 150), batch_size=32, class_mode='binary') validation_generator = test_datagen.flow_from_directory( 'data/validation', target_size=(150, 150), batch_size=32, class_mode='binary') model.fit_generator( train_generator, steps_per_epoch=2000, epochs=50, validation_data=validation_generator, validation_steps=800)
I am interested in restarting my algorithm several times with a random separation of training and validation.
source share