Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
Add validation_split to fit_generator #3900 #9745
This is an alternative solution for adding validation_split to fit_generator(#3900 ).
I'd like to get your feedback.
train_dir, val_dir = keras.utils.data_utils.train_valid_split(original_dir, validation_split=0.1) # all data in train_dir which are alias to original_data. # and train_dir is a temporary directory. train_datagen = ImageDataGenerator( rescale=1./255, shear_range=0.2, zoom_range=0.2, horizontal_flip=True) val_datagen = ImageDataGenerator(rescale=1./255) train_generator = train_datagen.flow_from_directory( train_dir, target_size=(150, 150), batch_size=32, class_mode='binary') val_generator = val_datagen.flow_from_directory( val_dir, target_size=(150, 150), batch_size=32, class_mode='binary')
Thanks for the PR. This API looks fine, but since we have already merged this feature in the API, we will not pursue this alternative.
In terms of implementation, the use of
Thanks for the review.
is usage like this?