Why does caffe io load_image normalize rgb values of png files from 0-1?

时间:2018-07-25 04:22:07

标签: image-processing neural-network deep-learning computer-vision caffe

The caffe.io.load_image() function call on a png, returns a numpy 3d array, with the rgb values as normalized floats in the 0-1 range instead of 0-255.

Is this:

  1. common practice when loading images into array like structures?
  2. have something to do with how the caffe network layers uses the images?
  3. something to do with how png files are stored?

Thanks

1 个答案:

答案 0 :(得分:1)

不仅在深度学习中,而且在图像处理/计算机视觉的其他领域,都将像素值标准化为[0..1](而不是[0..255])范围是常见的做法。
这样做主要是因为原生uint8像素值不易使用-uint8容易上浮/下浮。因此,将像素值转换为float范围内的[0..1]类型更为方便。

试图应对深层网络中消失/爆炸的梯度,有许多理论论文分析了激活值的分布(例如,见this work)。这些工作通常假定值呈正态分布-因此按比例缩放。您还将遇到许多网络,这些网络除了缩放网络外,还从输入中减去“图像均值”。