Image data preprocessing for neural networks

less than 1 minute read

  • 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()