Keras: Difference between steps_per_epoch and epochs in model.fit_generator

Created on 3 Aug 2017  路  5Comments  路  Source: keras-team/keras

I have doubt about the parameter steps_per_epoch and epochs in model.fit_generator.

I found that below two functions work the same way.
model.fit_generator(generate_arrays_from_file, steps_per_epoch=10, epochs=1)
model.fit_generator(generate_arrays_from_file, steps_per_epoch=1, epochs=10)

Am I right? Or I can do something between epochs?

stale

Most helpful comment

model.fit_generator requires the input dataset generator to run infinitely. steps_per_epoch is used to generate the entire dataset once by calling the generator steps_per_epoch times where as epochs gives the number of times the model is trained over the entire dataset.
As @ISosnovik pointed out, callbacks can be used to perform certain operations such as Tensorboard Logging (specific to Tensorflow backend), model checkpointing etc. at the end of each epoch.

All 5 comments

You can use callbacks. In this case, some operations would be performed when the epoch is started/ended.

@ISosnovik Thank you for your answer!

model.fit_generator requires the input dataset generator to run infinitely. steps_per_epoch is used to generate the entire dataset once by calling the generator steps_per_epoch times where as epochs gives the number of times the model is trained over the entire dataset.
As @ISosnovik pointed out, callbacks can be used to perform certain operations such as Tensorboard Logging (specific to Tensorflow backend), model checkpointing etc. at the end of each epoch.

This issue has been automatically marked as stale because it has not had recent activity. It will be closed after 30 days if no further activity occurs, but feel free to re-open a closed issue if needed.

I have a doubt in what is the difference between steps_per_epochs and batch size

Was this page helpful?
0 / 5 - 0 ratings