If I understand correctly the ImageDataGenerator class is a generator and returns batches of images when called, but what I don't seem to understand is:
- featurewise_center
- featurewise_std_normalization
The documentation says:
- featurewise_center: Boolean. Set input mean to 0 over the dataset, feature-wise.
- featurewise_std_normalization: Boolean. Divide inputs by std of the dataset, feature-wise.
How can you set mean to 0 over entire dataset when you have only a batch of images at any given time? and same for normalization.
Best Answer
You are right, normally you would not be able to tell these from a single batch of loaded samples.
This is why before you use
ImageDataGenerator
for generating batches, you need to fit it to your data, to calculate the statistics necessary for normalization.Here is an example from Keras documentation