AI Foundations ← pitcsolutions.com All lessons

Lesson 6 of 13 in Deep learning, about 12 minutes

Computer Vision

A camera sees millions of numbers. Computer vision is how an AI turns those numbers into “that is a dog”.

By the end of this lesson you will be able to

  • explain how a computer “sees” an image as numbers
  • tell apart classification, detection and segmentation
  • describe how CNNs and Vision Transformers learn visual features

Computer Vision (CV) is the branch of AI that lets computers see, analyse and understand images and videos. The goal is not to display a picture but to extract meaning from it.

Human brainComputer vision
Eyes capture lightCamera captures pixels
Brain recognises objectsAI model recognises objects
Learns from experienceLearns from training data
Understands contextLearns patterns from data
Recognises objects instantlyUses mathematical models to predict objects
Classroom question: how did your brain know it's a dog?

Show a picture of a dog. Everyone says “a dog” instantly, but few can explain how. During childhood your brain learned thousands of features: four legs, tail, fur, snout, ear shape, the way it moves. A neural network learns the same way, from labelled images. (Panel 6 of the brain infographic in lesson 5 shows exactly this process.)

How a computer sees an image

You see a dog. The computer sees a grid of millions of pixels, and every pixel is just three numbers: how much Red, Green and Blue light it contains, each from 0 to 255. [255, 0, 0] is pure red. A 1920×1080 photo has over 2 million pixels, so over 6 million numbers.

Try it: pixels are just numbers

Move the sliders to mix a colour, or hover over (tap) the tiny 10×10 “image” to read its pixel values.

How AI learns to recognise a dog

1. Collect 1000 dogs, 1000 cats, 1000 birds→2. Train a CNN or Vision Transformer→3. New image → “Dog, 98.7%”

During training the model learns that dogs tend to have fur, a tail, a snout, a certain ear shape and body structure. Step 3, predicting on a new image, is inference.

Eight major computer vision tasks

The same street scene analysed three ways: classification gives one label, detection draws boxes around a car and a person, segmentation colours every pixel by class Classification “street” Object detection car 0.97 person what, and where (boxes) Segmentation every pixel gets a class
Classification: one label. Detection: labels plus boxes. Segmentation: sky, road, car and person, pixel by pixel.
  1. 1. Image classification

    “What is in this image?” One label, e.g. cat.

    Google Photos, medical diagnosis, plant disease detection

  2. 2. Object detection

    “What objects are here, and where?” Bounding boxes around car, person, dog.

    Self-driving cars, CCTV, security, retail

  3. 3. Image segmentation

    “Exactly which pixels belong to each object?” Every pixel is classified: road, sky, car, person.

    Medical imaging, satellite images, autonomous driving

  4. 4. Face recognition

    Not just finding a face, but knowing whose face it is.

    Phone unlock, attendance systems, airport security

  5. 5. OCR

    Optical Character Recognition turns a photo of an invoice into editable text.

    Google Lens, cheque processing, passport scanning

  6. 6. Pose estimation

    Finds body joints: head, shoulders, elbows, knees.

    Fitness and yoga apps, sports analytics

  7. 7. Image captioning

    Picture in, sentence out: “A boy is playing football.” Combines vision with NLP.

    Accessibility tools, photo search

  8. 8. Image generation

    Text in, picture out: “A tiger wearing sunglasses”.

    DALL·E, Stable Diffusion, Midjourney

Deep learning changed everything

Before 2012, engineers hand-wrote feature detectors for edges, corners, textures and shapes. Then CNNs learned these features automatically, and accuracy jumped.

CNN: Convolutional Neural Network

The most famous deep learning model for images. Instead of looking at the whole image at once, it slides small filters across it and builds understanding gradually, layer by layer, much like a child learns:

CNN layers learn a hierarchy: layer 1 edges, layer 2 corners, layer 3 eyes, layer 4 face, layer 5 person 1. Edges 2. Corners 3. Eyes 4. Face 5. Person
Early layers detect simple things; deeper layers combine them into whole objects.

Vision Transformers (ViT)

Modern AI increasingly uses Vision Transformers. Instead of sliding small filters, the image is cut into small patches that are treated like words in a sentence, and a Transformer uses attention to relate every patch to every other patch.

Image→Small patches→Transformer→Prediction

Real-life examples

ApplicationCV task
Face unlockFace recognition
TeslaObject detection
Amazon GoCustomer tracking
Google LensOCR + object detection
Instagram filtersFace landmark detection
Medical AIDisease detection
ManufacturingDefect detection
AgricultureCrop disease detection
Traffic camerasVehicle detection
DronesObject tracking
Sports analyticsPlayer tracking
Smart parkingEmpty space detection

Fun facts

Try it: a busy street photo

Look at any busy street photo and ask: how many people? How many cars? Where is the traffic light? Which objects are moving? Each question is a different CV task:

You notice…AI task
“A dog”Classification
“A dog, over there”Object detection
The dog's exact outlineSegmentation
Who a person isFace recognition
The words on a signboardOCR
How someone is standingPose estimation

Key takeaways

  • To a computer, an image is a grid of numbers: three values (R, G, B) per pixel.
  • Classification says what; detection says what and where; segmentation says exactly which pixels.
  • CNNs learn features layer by layer (edges → objects); Vision Transformers treat patches like words.
  • Computer vision turns pixels into understanding.

Check your understanding

1. A self-driving car must know where each pedestrian is. Which task?

Detection gives both the label and the location (a bounding box) of each object.

2. What does the pixel value [0, 0, 255] represent?

The three numbers are Red, Green, Blue. Only blue is at full strength.

3. What did CNNs change compared with older computer vision?

Before CNNs, edge and shape detectors were hand-designed. CNNs learn them from data.