Normalization and Standardization
You'll learn how to prepare pixel values for computer vision models using model-specific normalization, mean subtraction, and standardization techniques.
The Core Idea
Raw pixel values range from 0–255 (for 8-bit images), but neural networks train more efficiently when inputs fall within smaller, centered ranges. Different models expect different preprocessing "flavors": some want values in [0, 1], others in [-1, 1], and many pre-trained models require standardization using their specific training statistics.
Think of it like converting currencies: your raw image is in "pixel dollars" (0–255), but the model only speaks "normalized euros" (the scale it was trained on). You must convert correctly, or the model won't understand your input.
Three Common Approaches
Normalization (Min-Max Scaling): Rescale pixel values to [0, 1] by dividing by 255. Simple and common for custom models.
Zero-Centered Normalization: Rescale to [-1, 1] by dividing by 127.5 then subtracting 1. Used by models like GANs that benefit from symmetric ranges.
Standardization (Z-score): Subtract the mean and divide by standard deviation of the training dataset. This centers data around zero with unit variance. Critical: use the model's original training dataset statistics, not your current batch statistics. Pre-trained models like ResNet, EfficientNet, and VGG each have specific mean/std values (usually per RGB channel) that you must use.
Model-specific requirements are non-negotiable—using ImageNet statistics on a model trained without them will degrade performance significantly.
Key Takeaway: Always apply the exact normalization strategy your model was trained with—preprocessing mismatches are a leading cause of poor inference accuracy in deployed computer vision systems.