How to evaluate model while the data splitted manually in deep learning?

0

Issue

I split my dataset separated with my model file.
So in my model file, I just run the model and set which is train, val, and test.
My model already has good results, but I struggled when I want to evaluate and predict the model.

Here’s my code to set which is train, val, and test file.

train_datagen = ImageDataGenerator(
rotation_range=45,
width_shift_range=0.2,
height_shift_range=0.2,
shear_range=0.2,
zoom_range=0.2,
horizontal_flip=True,
fill_mode="nearest")

when I run this code

score = model.evaluate(train_generator, test_generator, verbose=1)

this error appeared

ValueError: `y` argument is not supported when using `keras.utils.Sequence` as input.

ValueError: y argument is not supported when using keras.utils.Sequence as input.

Here’s my full code: https://colab.research.google.com/drive/11RXvin1sruAvzBahqEdAoaLXTBENtvVZ?usp=sharing

Any hints?

Solution

I do not think you should be passing both your train_generator and test_generator when evaluating your model. Maybe try this:

score = model.evaluate(test_generator, verbose=1)

Unlike the the method model.fit that can take a training and a validation set, model.evaluate only accepts one set of inputs.

Answered By – AloneTogether

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave A Reply

Your email address will not be published.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More