If we have 500 images and we want to set batch size=20 so 500/20= 25 samples in each batch and epoch size is 5 so each epoch 25 sample will be given to model as forward pass and update weights right? My question is after given 25 samples and what about next epoch same 25 samples are given or other 25 samples from dataset which were not shown to model?
CodePudding user response:
- Batch size: how many samples are there in each batch [20]
- Epoch: period required for all samples to be consumed [500 samples, 25 batches]
Overall typically it will look like this:
20 20 20
[ BATCH1][ BATCH2] ..... [ BATCH25] [ BATCH1][ BATCH2] ..... [ BATCH25]
[ EPOCH1 ] [SHUFFLE] [ EPOCH2 ]
500
Thus you will get 25 batches, each of 20 samples, which will form a single epoch of 500 samples, when the split will get reshuffled and new epochs starts, again consisting of 25 (now different) batches.
CodePudding user response:
The model sees in each epoch the same 25 samples of 20 images for training, the other images it would see would be the validation samples if they exist or if participation was defined. Everything to do with splitting the data, making sure the sample is random and so on is done before the training stage.