Images as Tensors: Pixels, Channels, and Batch Dimensions in Computer Vision Mastery
Images as Tensors: Pixels, Channels, and Batch Dimensions
Pixels/channels
Grayscale is one channel; RGB is three channels. Models usually consume float tensors.
Shapes
- H×W×C (NumPy/OpenCV)
- C×H×W (PyTorch)
- N×C×H×W (batch)
Common bug
Mixing BGR (OpenCV default) with RGB training pipelines breaks accuracy.

