question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Difference between steps_per_epoch and epochs in model.fit_generator

See original GitHub issue

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?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

5reactions
samre12commented, Aug 13, 2017

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.

1reaction
ISosnovikcommented, Aug 6, 2017

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

Read more comments on GitHub >

github_iconTop Results From Across the Web

What's the difference between "samples_per_epoch" and ...
fit() takes numpy arrays data into memory, while fit_generator() takes data from the sequence generator such as keras.utils.Sequence which works ...
Read more >
What to set in steps_per_epoch in Keras' fit_generator?
steps_per_epoch: Integer. Total number of steps (batches of samples) to yield from generator before declaring one epoch finished and starting ...
Read more >
keras.fit() and keras.fit_generator() - GeeksforGeeks
We can calculate the value of steps_per_epoch as the total number of samples in your dataset divided by the batch size. -> Epochs...
Read more >
How to set steps_per_epoch,validation_steps and ...
steps_per_epoch is batches of samples to train. It is used to define how many batches of samples to use in one epoch. It...
Read more >
Keras: BATCH_SIZE, STEPS_PER_EPOCH, and fit_generator
By definition, an epoch is a full pass of the dataset. The number of steps that are required to complete an epoch is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found