Reputation: 68
I am trying to do simple task in which the model takes an image as input and produce another image as output. There are two folders named input which contains the input images and another folder named output which contains the ground truth images or y label. To split the entire folder in training and validation split I did following steps:
# This is supposed to make training split which contains x label
train_set_X = train_datagen.flow_from_directory(
train_path,
class_mode='input',
classes=['input'],
subset='training'
)
# This is supposed to make validation split which contains x label
validation_set_X = train_datagen.flow_from_directory(
train_path,
class_mode='input',
classes=['input'],
subset ='validation'
)
# THis makes the training split's Y label
train_set_Y = train_datagen.flow_from_directory(
train_cleaned_path,
class_mode='input',
classes=['output'],
subset ='training'
)
# THis makes the validation split's Y label
validation_set_Y =train_datagen.flow_from_directory(
train_cleaned_path,
class_mode='output',
classes=['train_cleaned'],
subset ='validation'
)
but when I used above mentioned splits as follows :
history= conv_NN.fit(train_set_X, train_set_Y,
validation_data = (validation_set_X, validation_set_Y),
epochs=20, batch_size=16,
callbacks= [early_stop,tensorboard_callback],
verbose=1)
I get the following error:
ValueError: `y` argument is not supported when using `keras.utils.Sequence` as input.
Kindly help me to know what is going on here and what wrong I am doing? Thanks in advance.
Upvotes: 0
Views: 189
Reputation: 8112
when using generators model.fit expects the generator to provide both the x and y values. Therefore you can not specify the y labels as you did with the code
history= conv_NN.fit(train_set_X, train_set_Y
I think you can achieve what you want with
train_gen=zip(train_set_X,train_set_Y)
valid_gen=zip(validation_set_X,validation_set_Y)
history= conv_NN.fit(train_gen,valisation_data = valid_gen,
epochs=20, batch_size=16,
callbacks= [early_stop,tensorboard_callback],
verbose=1)
Upvotes: 1