▶ Sign up free for the video, slides & prompts
The lesson below is open to all. Enter your email once to unlock every video, slide deck, prompt and code example on this device.
Checking…
Computer Vision in Practice · Lesson 9 of 15 · 2 min read · 5 min video
Image segmentation
Labelling every pixel, from road scenes to medical scans.
📄 Download slides (PDF)· free sign-upBoxes are rough: a box around a person also contains road and sky. Segmentation labels every pixel, giving the exact outline of each object.
Three kinds of segmentation
- Semantic segmentation: each pixel gets a class: road, sky, building, person. Two people next to each other merge into one "person" area
- Instance segmentation: each object gets its own mask: person 1, person 2, car 1
- Panoptic segmentation: both together: every pixel gets a class, and countable objects get separate IDs
Where it's used
- Self-driving and road safety: where exactly is the drivable road?
- Medical imaging: outlining a tumour in a scan
- Agriculture: measuring crop area or diseased leaves from drone photos
- Satellite images: mapping buildings, water and green cover around Visakhapatnam
- Photo editing: background removal
How it works: U-Net
The classic segmentation model has a U shape:
- An encoder (a CNN) shrinks the image while building up features: what is here?
- A decoder grows it back to full size: where exactly is it?
- Skip connections pass fine details from encoder to decoder, so edges stay sharp
The output is one value per pixel per class.
A pre-trained segmentation model
Measuring it
- IoU per class, then averaged: mean IoU (mIoU)
- Dice score, common in medical imaging
Labelling is expensive
Drawing exact outlines takes far longer than drawing boxes. Use tools that help, like SAM (Segment Anything), which can outline an object from a single click. More on that in the next lesson.
In one line
Segmentation labels every pixel, by class or by individual object, and encoder–decoder models like U-Net do it by combining "what" features with fine "where" details.
Share with a friend