Home > Software engineering >  How to evaluate model while the data splitted manually in deep learning?
How to evaluate model while the data splitted manually in deep learning?

Time:11-12

I'm still working on using deep learning.

The way I did with my model is, 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

is there any hint guys to solve my problem? thanks for your help before

CodePudding user response:

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.

  • Related