Batch_size (ImageDataGenerator) vs batch_size (in model.fit) vs steps_per_epoch (in model.fit)

Hi all…

In the courses I saw different way to set the batch size for training.

batch_size can be defined in ImageDatagenerator but also in in model.fit, and it is possible to set it using steps_per_epoch, still in model.fit.

Can conflicts arise if batch_size will be defined differently using the ImageDataGenerator or mode.fit method? If both are set, which one will be used as the batch size used for epoch?

steps_per_epoch can also be used to define batch, I suppose, in model.fit. I think it’s a little less straightforward. Can there also arise a conflict with batch_size defined in ImageDatagenerator? When is steps_per_epoch useful instead of batch_size?

Thank you for your support.
Francesco

Hello,

I think that batch_size parameter in model.fit() is the one that determines the batch_size in model compilation, the steps_per_epoch determines when to end the epoch (you may end it before all data is exhausted).

Have a read at this link: