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

丶灬走出姿态 提交于 2020-01-25 07:24:07

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/59218782/when-passing-input-data-as-arrays-do-not-specify-steps-per-epoch-steps-argu

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!