Pixel values are often unsigned integers in the range between 0 and 255. Although these pixel values can be presented directly to neural network models in their raw format, this can result in challenges during modeling, such as slower than expected training of the model. Instead, there can be a great benefit in preparing the image pixel values prior to modeling, such as simply scaling pixel values to the range 0-1 to centering and even standardizing the values. This is called normalization and can be performed directly on a loaded image. The example below uses the PIL library (the standard image handling library in Python) to load an image and normalize its pixel values.
How to normalize pixel values to a range between zero and one.
How to center pixel values both globally across channels and locally per channel.How to standardize pixel values and how to shift standardized pixel values to +ve domain.