So, I'm using a pretrained PNASNet-5-Large model to do some image classification.

In the file, it says that the input range is in [0,1] (I'm assuming pixel values of input images). The images I have are already in this range. The channel means and standard deviation for RGB channels are stated as [0.5, 0.5, 0.5], [0.5, 0.5, 0.5] respectively. Now when I use the torchvision.transforms.Normalize to normalize the images using the stated means and standard deviations, the pixel values get to the range [-1,1].

The code I wrote for normalization:

transforms.Normalize([0.5, 0.5, 0.5],[0.5, 0.5, 0.5])

I believe I'm missing something fundamental. Should I normalize the images or should I not? Thanks!

  1. Standardization of the pixel values would bring it mean close to 0 and standard deviation as 1.
  2. Normalization will squeeze the values between 0 and 1. For RGB images, divide each channel i.e each pixel value by 255. For reference regarding Standardization see here and for normalization see here.

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.