Start studying
Module 3 · Computer Vision Module contents
Module 3  ·  Card 1 / 22beginner

Images and Pixels

A digital image is a grid of pixels, each holding a brightness value.

Greyscale images have one channel with values from 0 to 255.

Colour images have three channels for red, green and blue.

So a 224x224 colour image is a tensor of shape 224 x 224 x 3.

Pixel values are usually scaled into 0 to 1 before being fed to a network.

Learn in depth ↓
Module 03 · Computer Vision · 22 concepts
In depth  /  15 lines

Images and Pixels, in more detail

An image is a grid of numbers, and that is the whole story as far as a model is concerned.

Each pixel holds a brightness value, usually from 0 for black to 255 for white.

A greyscale image needs one such number per pixel.

A colour image needs three, for how much red, green and blue that pixel contains.

So a 224 by 224 colour image is 224 times 224 times 3, which is just over 150,000 numbers.

Those three layers are called channels, and the shape is written as height, width, channels.

Frameworks sometimes put channels first instead, which is a common source of shape errors.

Values are almost always scaled into 0 to 1 or centred around zero before training.

Networks train badly on inputs that run to 255, since the gradients come out uneven.

Models are usually normalised with the mean and spread of the dataset they were pretrained on.

Resolution is a direct cost, since doubling each side quadruples the pixels and the compute.

Most classification networks resize everything to a fixed size such as 224 by 224.

That resize can destroy the very detail you needed, which matters in medical and satellite imagery.

Formats like JPEG lose information when saved, and repeated saving compounds the damage.

A model is only ever seeing this grid of numbers, never a picture.

Want the full technical article? Wikipedia ↗
Test yourself

One question on this card. Every option explains itself once you pick, right or wrong.

Question 1
What shape is a 224x224 RGB image as a tensor?
Computer Vision

22 concepts in this module, then a graded test with every answer explained.

Study this module →
↑↓ move↵ openesc close