Images as Tensors: Pixels, Channels, and Batch Dimensions

Computer Vision Mastery 16 min min read Updated: Mar 03, 2026 Beginner
Images as Tensors: Pixels, Channels, and Batch Dimensions
Beginner Topic 2 of 8

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.

Get Newsletter

Subscibe to our newsletter and we will notify you about the newest updates on Edugators