normalization in image processing

后端 未结 3 616
佛祖请我去吃肉
佛祖请我去吃肉 2021-02-04 15:31

What is the correct mean of normalization in image processing? I googled it but i had different definition. I\'ll try to explain in detail each definition.

Norma

3条回答
  •  温柔的废话
    2021-02-04 15:44

    Answer by @Imanol is great, i just want to add some examples:

    Normalize the input either pixel wise or dataset wise. Three normalization schemes are often seen:

    1. Normalizing the pixel values between 0 and 1:
    img /= 255.0
    
    1. Normalizing the pixel values between -1 and 1 (as Tensorflow does):
    img /= 127.5
    img -= 1.0
    
    1. Normalizing according to the dataset mean & standard deviation (as Torch does):
    img /= 255.0
    mean = [0.485, 0.456, 0.406] # Here it's ImageNet statistics
    std = [0.229, 0.224, 0.225]
    
    for i in range(3): # Considering an ordering NCHW (batch, channel, height, width)
        img[i, :, :] -= mean[i]
        img[i, :, :] /= std[i]
    

提交回复
热议问题