Batch Size in ImageDataGenerator

Hi,

  1. How do I decide on the Batch_size field in the Training vs Validation ImageDataGenerator?

  2. Also, in what cases should we define steps_per_epoch? If we do not define this, how does the training gets impacted? Also, how to calculate this steps_per_epoch?

  3. If I have selected batch_size=32 for a training generator and batch_size = 10 for validation generator. The steps per epoch for the training and validation generator will be different based on the total samples in training and validation sets. How is it handled during the training?

Hello there,

The batch size is normally a power of 2 due to the binary system of computers, according to your computing power and its architecture (and optimizer) you can choose a batch size that is relevant to it so you dont overload the processing unit(s). The batch size can be the same for both train and val.

Step per epoch is defined in case for example you dont want to go through the entire train or val dataset (lets say you want to finish faster), if you dont define it, it does a division per batch size and keeps going till the end.

Should not be a problem in term of handling but usually its chosen a power of 2 for speed,

1 Like