Questions tagged «train-test-split»

5
使用ImageDataGenerator时的Keras分割火车测试集
我有一个目录,其中包含图像的子文件夹(根据标签)。我想在Keras中使用ImageDataGenerator时将此数据分为训练集和测试集。尽管keras中的model.fit()具有用于指定拆分的参数validate_split,但对于model.fit_generator()我找不到相同的参数。怎么做 ? train_datagen = ImageDataGenerator(rescale=1./255, shear_range=0.2, zoom_range=0.2, horizontal_flip=True) train_generator = train_datagen.flow_from_directory( train_data_dir, target_size=(img_width, img_height), batch_size=32, class_mode='binary') model.fit_generator( train_generator, samples_per_epoch=nb_train_samples, nb_epoch=nb_epoch, validation_data=??, nb_val_samples=nb_validation_samples) 我没有用于验证数据的单独目录,需要将其与训练数据分开
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.