Image Data Pre-processing

Hi,

I am dividing my pixels training and test data by 255.0 in preprocessing step. I am bit confused about min max normalization. Is it same thing but different name which actually i am doing?

Thank you!

AFAIK, min-max normalization is to rescale the image pixel values to be between [0, 1].
The formula is,

scaled_img = (img - img.min()) / (img.max() - img.min())

In case of images ranging [0, 255]. img.min() = 0, img.max() = 255.
Thus, min-max normalization for these images is to divide by 255. (this assumes that image range is [0, 255])

Hope this helps!

1 Like

Thank you…

So you mean diving pixel data by 255.0 is min max normalization. My image data values range from 0 to 255, that’s why I am dividing with 255.0

You are right. Sometimes, the images might not exactly range from [0, 255]. i.e, it may be [10, 250].
If you want to min-max normalize according to the definition, you have to apply the formula.

1 Like