Answers for "split imagedatagenerator into x_train and y_train"

1

split imagedatagenerator into x_train and y_train

in python 2:

X_train, y_train = train_generator.next()
X_test, y_test = validation_generator.next()

in python 3:

X_train, y_train = next(train_generator)
X_test, y_test = next(validation_generator)
Posted by: Guest on December-01-2020
2

how to split image dataset into training and test set keras

train_datagen = ImageDataGenerator(rescale=1./255,
    shear_range=0.2,
    zoom_range=0.2,
    horizontal_flip=True,
    validation_split=0.2) # set validation split

train_generator = train_datagen.flow_from_directory(
    train_data_dir,
    target_size=(img_height, img_width),
    batch_size=batch_size,
    class_mode='binary',
    subset='training') # set as training data

validation_generator = train_datagen.flow_from_directory(
    train_data_dir, # same directory as training data
    target_size=(img_height, img_width),
    batch_size=batch_size,
    class_mode='binary',
    subset='validation') # set as validation data
Posted by: Guest on June-17-2020

Code answers related to "split imagedatagenerator into x_train and y_train"

Python Answers by Framework

Browse Popular Code Answers by Language