Semantic, Instance and Panoptic Segmentation

Three tasks that all colour in pixels, and differ in exactly two questions: do objects get separate ids, and does the background count.

Overview

Two questions

each segmentation task colours in pixels. What differs is the answer to two questions:

  1. Do two objects of the same class get separate identities?
  2. Does the background get labelled?

Switch between the three settings above and watch the two discs and the background. That is the entire taxonomy, visible in one scene.

Separate idsBackground labelled
Semanticnoyes
Instanceyesno
Panopticyesyes

Semantic, Instance and Panoptic Segmentation

This module needs JavaScript: the images are computed in the page rather than downloaded.

Worth knowing

Semantic: every pixel gets a class. Two adjacent cars are one region called 'car'.
Instance: every object gets its own id. The background is not labelled at all.
Panoptic: every pixel gets a class and objects keep separate ids. Both at once.
The distinction is things (countable objects) against stuff (sky, road, grass), which has no instances.

Semantic, Instance and Panoptic Segmentation

Three tasks, one scene, and the two questions that separate them.

Things and stuff

The vocab that makes this coherent is things against stuff.

Things are countable: people, cars, dogs, bottles. Asking "how many" makes sense, so instances make sense.

Stuff is uncountable: sky, road, grass, water. "How many skies" isn't a question. Stuff has extent but not instances.

Semantic segmentation treats all as stuff — it only ever assigns classes. Instance segmentation only handles things. It needs a thing to count. Panoptic segmentation covers both. This Is why it needed a name of its own.

Semantic

each pixel gets a class label. Two shared cars are one connected region labelled "car", and nothing in the output says there were two.

The standard architectures are fully convolutional: U-Net, DeepLab, SegFormer. The metric is mean IoU per class. This is the right task when what matters is area rather than count — how much of this field is diseased, which pixels are road, what fraction of the scan is tumour.

Instance

each object gets its own mask and identity, and pixels belonging to no object are left untagged.

Mask R-CNN is the canonical approach: detect boxes first, then predict a mask inside each. That sorting has a consequence. Masks can share, and a pixel can belong to two instances, because nothing forces a single answer per pixel.

This is the right task when counting matters: how many cells, how many people, which pallet is which.

Panoptic

each pixel gets just one class, and pixels belonging to things also get an instance id. Stuff regions get a class and no id.

The word means "all visible", and the point of the 2018 paper that named it was that the semantic and instance communities had been solving halves of the same problem with different metrics and different architectures.

The constraint that makes it harder than running both is just one label per pixel. Instance methods give shared masks and semantic methods skip instances, so mixing them needs resolving conflicts. Panoptic FPN and Mask2Former do it in one model instead.

Its metric, PQ, times a segmentation quality term (mean IoU over matched segments) by a spotting quality term (an F1 over whether segments were matched at all), which blocks a method from scoring well by getting the pixels roughly right while missing objects fully.

Choosing

Ask what the output is for.

Area, no counting — semantic. Land cover, tumour extent, drivable surface.

Counting or tracking individuals — instance. Cell counting, retail stock, people in a queue.

A complete scene description — panoptic. Autonomous driving needs both "where is the road" (stuff) and "which car is which" (things), and needs them steady.

PQ, worked

Panoptic quality is the one metric that spans both halves, and seeing it found shows why it resists the easy failures. It factors into segmentation quality times spotting quality: SQ is the mean IoU over *matched* segments, RQ is an F1 over whether segments were matched at all, TP / (TP + ½FP + ½FN).

Take a scene where 8 predicted segments matched ground truth at mean IoU 0.80, 1 guess matched nothing (a false plus), and 2 ground-truth objects were missed (false negatives):

termvalue
SQ (mean IoU of matches)0.80
RQ = 8 / (8 + 0.5 + 1)0.84
PQ = SQ × RQ0.67

The two factors guard different failures. A method that segments the pixels it finds beautifully but misses half the objects has a high SQ and a low RQ, so PQ falls. One that finds each object but traces them sloppily has the reverse. Only getting both right — the pixels *and* the object count — scores well, which is just the point of a metric built to end the split between the semantic community, who measured pixels with mIoU, and the instance community, who measured objects. It's also why a semantic mIoU and a panoptic PQ aren't close: they are answering different questions, and only one of them can tell two touching cars apart.

The taxonomy behind the metrics is two yes/no questions: do two objects of the same class get separate identities, and does the background get labelled. Semantic says no and yes — each pixel gets a class, two shared cars are one "car" region — so it's right when area matters and counting doesn't: tumour extent, drivable surface, land cover. Instance says yes and no. Each object gets its own mask, background is left untagged. Which is what counting needs, and because Mask R-CNN predicts a mask per detected box, its masks can share. Panoptic demands just one label per pixel *and* an instance id for the countable things, which is the constraint that makes it harder than running the other two and merging their outputs, since that merge needs a conflict rule.

The vocab that makes the split coherent is things against stuff: things are countable — people, cars — so instances make sense, while stuff is uncountable — sky, road — and has extent but no instances. Semantic treats all as stuff, instance handles only things, and panoptic covers both, which is just why it needed a name of its own.

Where it goes wrong

Using semantic segmentation to count. Two touching objects are one region. Post-hoc connected components will merge them.

Expecting instance segmentation to label the background. It doesn't. That isn't an oversight.

Checking mIoU with PQ. Different metrics on different tasks.

Skipping the one-label constraint. Merging separate semantic and instance outputs into a panoptic one needs a conflict rule, and the rule affects the score.

Questions people ask

What is the difference between semantic and instance segmentation? Semantic segmentation labels each pixel with a class, with no separation between objects of the same class. Instance segmentation also separates individual objects.

What is panoptic segmentation? It combines both. Countable things such as cars get instance IDs, and amorphous stuff such as sky or road gets a class label.

How is segmentation different from object detection? Detection outputs boxes, whereas segmentation outputs pixel-accurate masks. Segmentation costs more annotation effort but gives exact shapes.

Which metrics are used? Intersection over union per class, averaged as mIoU, and the Dice coefficient. Pixel accuracy is easily misled when the background dominates.

Which architectures are common? U-Net, DeepLab and FCN for semantic work, Mask R-CNN for instances, and transformer-based models such as SegFormer and Mask2Former.

Why do segmentation models use skip connections? Downsampling loses fine spatial detail. Skip connections pass high-resolution features straight to the decoder to sharpen the boundaries.

Three tasks that all look like colouring in

Semantic, instance and panoptic segmentation give pictures that look alike and answer different questions. This builds the same scene under all three, finds their metrics. Shows the exact query each one can't answer.

example_01.pyNumPy
Output

The next block builds a prediction where the model finds both people but merges them into one blob, and scores that prediction with the semantic metric.

example_02.pyNumPy
Output

The next block scores the same prediction with the instance metric: match predicted instances to ground truth by IoU.

example_03.pyNumPy
Output

The final block puts both metrics side by side for the same prediction and lists which task fits which problem.

example_04.pyNumPy
Output

Check yourself

0 of 3

Answer without scrolling back up.

  1. What is the difference between semantic and panoptic segmentation?

  2. Why does instance segmentation not label the background?

  3. What makes panoptic harder than running a semantic and an instance model together?

Cheat sheet

Semantic, Instance and Panoptic Segmentation

Compare semantic, instance and panoptic segmentation on the same scene and see the two questions that separate each task from the others.

COMPUTER VISION · vizlearn.in/computer_vision/segmentation_tasks.html

About the author

Ashish Jangra builds and maintains VizLearn. Every module here is written and the visualisation behind it hand-built, so the numbers in a readout come from the same code that draws the picture. Corrections are genuinely welcome and get priority over everything else — if a page states something wrong, or an animation misrepresents what the algorithm does, get in touch.