Skip to main content

22. Images as Tensors

Images can be represented as tensors. A single channel is RGB Value of a pixel. If a image is 1920x1080 it means it is essentially a cuboid of size 1920 x 1080 x 3

For a color image:

channels × height × width

A batch adds another dimension, it is how many images will be analysed in 1 pass:

batch × channels × height × width

pytorchcommonly uses:

[B, C, H, W]

For example:

[32, 3, 224, 224]

means:

32 images
3 channels
224 height
224 width