Search code examples
tensorflowmodel-fitting

How to fit train and validation data together


history = model.fit(
    train_generator,
    validation_generator,
    steps_per_epoch= 2403//32,
    epochs= 5,
)

This is the code , that I'm currently using and I'm getting the following error: ValueError: 'y' argument is not supported when using 'keras.utils.Sequence' as input. I've 2403 training images and 600 validation images , I'm using a batch size of 32 , pls guide me on how to do this.


Solution

  • You need to pass your validation data as follows when your inputs are generated from the generator.

    history = model.fit(
        train_generator,
        validation_data=validation_generator,
        steps_per_epoch= 2403//32,
        epochs= 5,
    )