7
$\begingroup$

I am new to deep learning. I am trying to understand some concepts. I know "mean" is an average value and "variance" is deviation from mean.I have read some research papers, all say that we pre-process our data first. But how these concepts are related to image pre-processing? Why these concepts are used as pre-processing of image data?
Actually i am unable to understand that how these techniques contribute towards classification.I searched it on google but may be i searched with less descriptive keywords
Please bear my very basic question,

$\endgroup$
  • $\begingroup$ Actually variance is the average of the squares of differences from the mean. Are you asking about "standardisation" or "rescaling"as preprocessing step? It is designed to avoid a single explanatory variable dominating the others just because it has a wide range of numerical values. $\endgroup$ – Henry May 2 '16 at 21:41
  • $\begingroup$ This is usually referred to as image normalization, and you can find reasons for it in the link. $\endgroup$ – Alex R. May 2 '16 at 21:52
  • $\begingroup$ Excellent answer for why we normalize feature vectors, from wikipedia: "Since the range of values of raw data varies widely, in some machine learning algorithms, objective functions will not work properly without normalization. For example, the majority of classifiers calculate the distance between two points by the Euclidean distance. If one of the features has a broad range of values, the distance will be governed by this particular feature. Therefore, the range of all features should be normalized so that each feature contributes approximately proportionately to the final d." $\endgroup$ – Anna Vopureta Feb 22 at 17:07
  • $\begingroup$ That comment would be stronger if it elaborated on how 0-mean unit variance rescaling is related to images. $\endgroup$ – Sycorax Feb 22 at 17:13
  • $\begingroup$ @Sycorax Images are treated as regular feature vectors that are fed to the model. There is nothing special about images, all statements regarding normalization apply equally to images and other feature vectors. $\endgroup$ – Anna Vopureta Feb 22 at 17:17
3
$\begingroup$

This is a very good question and you need to understand this to gain more understanding into deep learning.

Basically, you have raw images, lets take one image. This image has 3 channels and in each channel pixel values range from 0 to 255.

Our goal here is to squash the range of values for all the pixels in the three channels to a very small range. This is where Preprocessing comes in. But dont think preprocessing only involves the mean and std devtn techniques there are many other like PCA, whitening etc.

1) Using mean: By computing the mean of say, the first red pixel values across all the training images will get you the average red color value that is present across all the training images at the first position. Similarly you find this for all the red channel values, green channel values. Finally you get an average image from all the training images.

Now if you subtract this mean image from all the training images you obviously transform the pixel values of the images, the image is no longer interpretable to the human eye, the pixal values now lie in range from positive to negative where the mean lies at zero.

2) Now if you again divide these by std deviation you essentially squash the pixel value range before to a small range.

BUT WHY ALL THIS? I will say from my experience that doing this preprocessing on the images and then giving these transformed images to the classifier model will run faster and better. That's why.

As you are into deep learning, look into batch normalization after you understand this normalization concept

$\endgroup$
  • 5
    $\begingroup$ Batch normalisation is related to internal shift in distribution and have nothing to do what we are talking. $\endgroup$ – SmallChess Feb 24 '17 at 0:05
  • 1
    $\begingroup$ "from my experience the model runs faster and better", doesn't sound that convincing. $\endgroup$ – Anna Vopureta Feb 22 at 17:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.