Image data preprocessing for neural networks
- We treat each pixel in the image as a variable. We want to make the mean and std of each pixel similar cross all training samples (cross the samples in a batch). So we need to do normalization over each pixel. (Not over one image.)
- There are several ways to do the normalization:
(x - x.min()) / (x.max() - x.min())
2*(x - x.min()) / (x.max() - x.min()) - 1
(x - x.mean()) / x.std()