# Why we don't normalize the images?

I was watching the video from this stanford course on convolutional neural nets where the professor says (at 28:59) 'we do zero-mean the pixel values in image but we do not normalize the pixel values much because in images, at each location, we already have relatively comparable scale and distribution'. I do not understand what does she mean by 'relatively comparable scale and distribution'?

## 1 Answer

I'm not sure why he said that. Image Normalization is extremely common in practice!

Say you have an image with pixel values in $[0, 255]$. Besides removing the mean, you also want to divide by either the $(max - min)$ or by the standard deviation. The first step's goal is to reduce the mean of the dataset to zero, while the second's is to scale the pixel values down to a range close to $[-1, 1]$.

Note that all these measures (mean, min, max, std) are calculated on the whole dataset (not on each image individually.

• how do we calculate mean from whole dataset? I mean like do we calculate mean of whole dataset by calculating mean of each image and then add it to the running mean of all images or do we calculate mean by taking in account the spatial location of all images ? – samra irshad Sep 10 '18 at 10:40
• Just the mean of the pixel intensities of all pixels in the dataset. One way to do is is like you first said. – Djib2011 Sep 10 '18 at 18:34