Mask_rcnn: About the handling of "steps_per_epoch"

Created on 11 May 2018  路  3Comments  路  Source: matterport/Mask_RCNN

Hi there,
I am confused with the document here:

steps_per_epoch: Total number of steps (batches of samples) to yield from generator before declaring one epoch finished and starting the next epoch. It should typically be equal to the number of unique samples of your dataset divided by the batch size.

In my poor understanding, the steps_per_epoch should be "EXACTLY THE SAME" as "NUM_OF_SAMPLES / batch_size", so all the samples can be iterated once.

To understand more about this param, I really want to know what keras dose when step_per_epoch is set un-typically .

To be clear, my questions are:

  1. when step_per_epoch < NUM_OF_SAMPLES / batch_size

    if some of the samples were skipped? So, the trainer gets the input size < NUM_OF_SAMPLES?

  2. when step_per_epoch > NUM_OF_SAMPLES / batch_size,

    if some of the samples imported multiple times to the trainer, so the actual input size > NUM_OF_SAMPLES?

Thank you so much for your time.

Most helpful comment

For anyone who may concern, Keras issue#10164 solved my question.

All 3 comments

For anyone who may concern, Keras issue#10164 solved my question.

@ziyigogogo I see how it works based on your question at https://github.com/keras-team/keras/issues/10164 but I'm curious if you've found what is _ideal_? Should you just always set steps_per_epoch = num_samples / batch_size ? Have you done any experimentation with this? I just realized I have 100 images and have been setting batch_size=1 and then 30 steps_per_epoch, so my real epoch count is basically a third of what I thought it was.

@patrickcgray
In my experience, there is no general IDEAL setting.
But in my practice, i always let num_epoch * batch_size * setps_per_peoch > num_images.
So that during training process, all your images can be used at least once.
In your example, batch_size =1 and 30 steps_per_epoch, so I set num_epoch = 4.
As the result, all 100 images plus 20 duplicated images(from your 100 images) are used for training.

Was this page helpful?
0 / 5 - 0 ratings