harinsamaranayake
harinsamaranayake

Reputation: 961

When passing input data as arrays, do not specify `steps_per_epoch`/`steps` argument. Please use `batch_size` instead

My code is below :

model.fit_generator(generator=(train_image_list, train_mask_list),epochs=1000,shuffle=True)

Both the train_image_list and train_mask_list contains image lists.When trying to run the above code in Google Colab I get the following error:

When passing input data as arrays, do not specify `steps_per_epoch`/`steps` argument. Please use `batch_size` instead.

In the Keras documentation, fit_generator() do not specify a parameter called 'batch_size'. How to solve this issue?

Upvotes: 0

Views: 1862

Answers (1)

Nicolas Gervais
Nicolas Gervais

Reputation: 36584

It means that you should use the normal fit() method, and specify the batch_size argument rather than passing arrays as generators.

model.fit(train_image_list, train_mask_list, epochs=1000, batch_size=32)

From the documentation of fit_generator():

generator: A generator or an instance of Sequence (keras.utils.Sequence) object in order to avoid duplicate data when using multiprocessing. The output of the generator must be either a tuple (inputs, targets)...

You're passing arrays, not a generator object. So Keras is telling you that you can't use fit_generator this way.

Upvotes: 1

Related Questions