May 2020
Beginner to intermediate
430 pages
10h 39m
English
Next, we will repeat the process for validation in the following code. The process is the same as for the training generator, except we'll validate the image directory instead of training the image directory:
from keras.preprocessing.image import ImageDataGeneratorval_dir = '/home/…/visual_search/furniture_images/val'val_datagen = ImageDataGenerator(preprocessing_function=preprocess_input,rotation_range=90,horizontal_flip=True,vertical_flip=True)val_generator = val_datagen.flow_from_directory(val_dir,target_size=(img_height, img_width),batch_size=batchsize)
The preceding code shows the final validation data generator.