1

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?

desertnaut
  • 57,590
  • 26
  • 140
  • 166

1 Answers1

1

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.

AloneTogether
  • 25,814
  • 5
  • 20
  • 39
  • 1
    Well, it's working now. i though that i've to give two parameters inside the model.evaluate() like what i see on the other source. Thanks for your help bro – Muhammad Rifqi Nov 11 '21 at 11:26