← AI Terminology

Instance Segmentation

Instance segmentation is a computer vision task that simultaneously detects every object in an image and produces a pixel-level mask for each individual instance — distinguishing not just where objects are, but the exact pixel boundary of each one, even when they overlap.

It combines object detection (bounding boxes) with semantic segmentation (pixel labelling).
Why It Matters in AI
Bounding boxes are imprecise — a box around a person includes background and overlapping objects. Instance segmentation produces exact pixel masks: the exact outline of each car, person, or tumour in the image. This precision is required for autonomous vehicle scene understanding, surgical robotics, medical image analysis, and augmented reality where objects must be precisely extracted from backgrounds.
Key Points
Aspect Description
SAM Promptable: click a point → SAM produces the mask for that object — zero-shot, open-world
Metrics Mask AP (Average Precision) at various IoU thresholds — COCO benchmark standard
Key models Mask R-CNN, SOLOv2, CondInst, YOLOv8-seg, SAM (Segment Anything Model)
Mask R-CNN Two-stage: Faster R-CNN backbone + parallel mask prediction head — foundational model (2017)
vs Detection Detection gives bounding boxes; instance seg gives pixel-perfect masks per instance
vs Semantic seg Semantic seg: every pixel gets a class (all cars = "car"); Instance seg: each car gets a unique mask
Simple Analogy
Detection draws a rectangle around each person; semantic segmentation paints every person pixel the same colour; instance segmentation precisely cuts out the exact shape of Person 1 in green, Person 2 in blue, Person 3 in red — each a unique, precise silhouette even when they overlap.
Common Usage Examples
  • detectron2.projects.MaskRCNN — Mask R-CNN instance segmentation in Detectron2
  • from ultralytics import YOLO; model = YOLO('yolov8n-seg.pt'); results = model(image) — YOLOv8 segmentation
  • SAM: predictor.predict(point_coords=[[500, 400]], point_labels=[1]) — click to get mask
  • Medical imaging: instance segmentation of individual cells, tumours, or anatomical structures
  • Autonomous vehicles: Waymo and Tesla use instance segmentation to distinguish individual pedestrians
Summary
In short: Instance segmentation draws a precise pixel mask around every individual object in an image — the precision required when bounding boxes are too coarse for the application.