Principle:LaurentMazare Tch rs ImageNet Preprocessing
| Knowledge Sources | |
|---|---|
| Domains | Computer_Vision, Data_Preprocessing |
| Last Updated | 2026-02-08 14:00 GMT |
Overview
Standardized image preprocessing pipeline that resizes images to 224x224 and applies ImageNet channel-wise normalization for pretrained model compatibility.
Description
ImageNet preprocessing transforms raw images into the format expected by pretrained vision models. This involves two steps: (1) resizing the image to 224x224 pixels (the standard input resolution for most ImageNet models), and (2) applying channel-wise normalization using the ImageNet training set statistics (mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225]). This normalization ensures that input pixel values match the distribution the pretrained weights were trained on, which is critical for transfer learning and inference accuracy.
Usage
Use this principle whenever performing inference with pretrained ImageNet models (ResNet, VGG, EfficientNet, etc.). The normalization must match the training-time preprocessing exactly.
Theoretical Basis
Preprocessing Pipeline:
1. Load image from file (any format: jpg, png, tga, bmp)
2. Resize to 224x224 pixels
3. Convert to float32 tensor of shape [3, 224, 224]
4. Normalize per channel:
normalized[c] = (pixel[c] - mean[c]) / std[c]
mean = [0.485, 0.456, 0.406] (R, G, B)
std = [0.229, 0.224, 0.225] (R, G, B)