DL0182 Semantic, Instance, and Panoptic Segmentation

What are the differences between Semantic, Instance, and Panoptic Segmentation, and when is each task formulation used in practice, for example inside an autonomous-driving perception stack?

Answer

The three tasks differ in what a label is allowed to be. Semantic segmentation assigns every pixel exactly one class out of K and has no notion of object identity, so two touching cars collapse into a single connected “car” region. Instance segmentation does the opposite: it detects and masks each countable object separately with a confidence score, but it only covers thing classes, ignores amorphous stuff such as road, sky, and vegetation, and its masks may overlap each other or leave pixels uncovered. Panoptic segmentation is the union of the two: every pixel receives one pair (c_p, z_p) of class plus instance id, stuff classes get a single segment with no id, things get one segment per object, and the output is a strict partition of the image with no overlaps and no unlabeled pixels except an explicit void region. Which formulation you pick follows the consumer of the output, not fashion. A planner that needs to count and track individual vehicles needs ids, whereas a free-space or sky-replacement module only needs a region mask.

(1) Label Space: semantic returns a class per pixel, instance returns a set of scored binary masks with classes, and panoptic returns a class plus an id per pixel.
(2) Things Versus Stuff: instance segmentation is defined only on countable things; semantic segmentation handles both but cannot separate two instances; panoptic handles both and separates instances.
(3) Overlap Constraint: instance masks are independent and can overlap, while panoptic forces a non-overlapping partition, which means any fusion of two heads must resolve conflicts explicitly.
(4) Metrics Differ In Kind: semantic uses mIoU, instance uses mask AP averaged over IoU thresholds and scores, and panoptic uses PQ at a single fixed matching threshold with no score sweep.
(5) Annotation Cost: stuff-only masks are cheap polygon paint, per-instance boundaries between adjacent same-class objects are the most expensive labels in the dataset.
(6) Practical Selection: use semantic for region questions, instance for counting and tracking, and panoptic when a downstream module needs one consistent scene interpretation per pixel.

Three panels showing the same toy scene of sky, road, two touching cars, and a person labeled three ways: semantic where both cars form one car region, instance where only the two cars and the person get scored masks that slightly overlap while sky and road are ignored, and panoptic where every pixel receives one class plus instance id with the two cars separated by a hard boundary

Figure 1: One scene, three label spaces. The interesting pixels are the ones on the boundary between the two touching cars: semantic segmentation is structurally unable to place that boundary, instance segmentation places it but may let the two masks overlap and says nothing about road or sky, and panoptic segmentation is required to place it and to label every remaining pixel exactly once.

In practice the formulation is chosen by the consumer. Free-space and drivable-area estimation, land-cover mapping from satellite imagery, portrait or sky matting, and organ or tumor delineation are region questions, so semantic segmentation is sufficient and its cheaper labels are a real advantage. Counting, tracking, and grasping are identity questions: counting cells in a microscopy image, tracking each pedestrian across frames, or picking one item out of a bin all require per-object masks, so instance segmentation (or its video extension) is the right task. Panoptic segmentation earns its extra cost when a single downstream consumer must be handed one coherent interpretation of every pixel, which is why it is the natural output format for driving perception and robot scene understanding, where the same map must answer both “is this pixel drivable” and “which vehicle is this”. A useful diagnostic question is whether two adjacent objects of the same class must ever be told apart. If the answer is no, panoptic annotation is money spent on a distinction nobody reads.

Mathematical Formulation:
f_{\mathrm{sem}}(p) = c_p
f_{\mathrm{ins}} = \{(m_j, c_j, s_j)\}_{j=1}^{M}
f_{\mathrm{pan}}(p) = (c_p, z_p)
\mathrm{mIoU} = \frac{1}{K}\sum_{k=1}^{K}\frac{TP_k}{TP_k + FP_k + FN_k}
\mathrm{PQ} = \mathrm{SQ} \times \mathrm{RQ}
\mathrm{SQ} = \frac{1}{|TP|}\sum_{(g,q) \in TP}\mathrm{IoU}(g,q)
\mathrm{RQ} = \frac{|TP|}{|TP| + \frac{1}{2}|FP| + \frac{1}{2}|FN|}

Where:

  • p is a pixel, c_p its class, and z_p its instance id, which is undefined (shared) for stuff classes and unique per object for thing classes.
  • K is the number of classes, split into disjoint thing and stuff subsets by the dataset definition rather than by the model.
  • m_j is the j-th predicted binary mask, c_j its class, and s_j its confidence; the M masks are independent, so they may overlap and their union need not cover the image.
  • TP, FP, and FN in PQ count segments, not pixels, with a ground-truth segment g and a prediction q matched when \mathrm{IoU}(g,q) > 0.5; that threshold makes the matching provably unique because panoptic segments cannot overlap.
  • \mathrm{SQ} is segmentation quality, the mean IoU of matched pairs, and \mathrm{RQ} is recognition quality, the F1 score over segments; PQ is reported per class and then averaged, and often split into \mathrm{PQ}^{\mathrm{th}} and \mathrm{PQ}^{\mathrm{st}}.
  • TP_k in mIoU counts pixels of class k, which is why mIoU is blind to how many objects a class region contains.

Worked Example (One Image):
\mathrm{SQ} = 3.10 / 4 = 0.775
\mathrm{RQ} = 4 / (4 + 1 + 1) = 0.667
\mathrm{PQ} = 0.775 \times 0.667 = 0.517

Four matched segments whose IoUs sum to 3.10 give an SQ of 0.775, and two false positives plus two false negatives each contribute a half count to the RQ denominator, so RQ is 0.667 and PQ lands at 0.517. The decomposition is the practically useful part: a high SQ with a low RQ means the masks are accurate but segments are being missed or hallucinated, which points at the classification and duplicate-removal path, while a high RQ with a low SQ means the right objects are found with sloppy boundaries, which points at output resolution and boundary supervision.

Diagram of panoptic quality computation with a left column of six ground-truth segments and a right column of six predicted segments, arrows joining four matched pairs labeled with IoU values 0.92, 0.81, 0.74 and 0.63, a red dashed pair at IoU 0.38 that fails the threshold and counts as both a false positive and a false negative, one unmatched ground-truth sky segment, one spurious truck prediction, and a side panel computing SQ 0.775, RQ 0.667 and PQ 0.517

Figure 2: PQ is a segment-level bipartite matching followed by a product of two interpretable factors. The pair at IoU 0.38 is the detail that separates candidates who have read the metric from those who have not: it is not a weak match, it is no match at all, and it is charged once as a false positive and once as a false negative.

PropertySemanticInstancePanoptic
Output per pixelOne class idZero, one, or several scored masksExactly one (class, instance id) pair
Stuff classesCoveredNot part of the taskCovered as one segment per class
Separates same-class objectsNoYesYes, and mandatory
Overlapping masksImpossible by constructionAllowed and commonForbidden, conflicts must be resolved
Standard metricmIoU over pixelsMask AP swept over IoU and scorePQ = SQ x RQ at IoU above 0.5
Classic architectureFCN, DeepLab, per-pixel softmaxMask R-CNN, box then mask headPanoptic FPN, or mask-classification with queries
Typical useFree space, land cover, matting, organ delineationCounting, tracking, robotic graspingDriving and robot scene understanding, one map for all consumers

Login to view more content


Log in to track your progress

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *