Level 0: Foundation
★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.Every pixel, every object
Semantic segmentation colours every pixel by class but cannot tell two cars apart. Instance segmentation outlines each car but ignores the road and sky. Panoptic segmentation does both:
- every pixel gets a class;
- pixels of countable “things” (cars, people) also get an instance number;
- uncountable “stuff” (road, sky, grass) does not.
Panoptic FPN gets there by adding a small “stuff” branch to Mask R-CNN and merging the two outputs. A predicted segment counts as correct only if its IoU with the true segment is above 0.5; try it in the demo.
A driving or robot perception stack needs both: drivable surface and free space (stuff) and each agent to track (things), in one consistent map.
- 1. Panoptic segmentation labels…
- 2. Sky is…
- 3. Panoptic FPN adds to Mask R-CNN…
Level 1: Beginner
★★☆☆☆ Basic⏱ 20 minSecondary-school mathematics: arithmetic and elementary algebra.By hand
Panoptic quality.
- Match predicted and ground-truth segments of the same class when IoU > 0.5. Such matches are unique, since non-overlapping segments cannot both cover more than half of one segment.
- With TP matches, FP unmatched predictions and FN unmatched truths:
- PQ = Σ IoU(TP) / (TP + ½FP + ½FN);
- PQ = SQ × RQ, where SQ = mean IoU of matches and RQ = TP / (TP + ½FP + ½FN), an F1 score.
- Example (exercise 1): matches with IoU 0.8 and 1.0, one FP and one FN give SQ 0.9, RQ 2/3 and PQ 0.6.
Datasets.
- COCO panoptic has 80 thing and 53 stuff classes (133).
- Cityscapes has 8 things and 11 stuff.
Semantic branch.
- Each FPN level (strides 4–32) goes through 0, 1, 2 or 3 stages of 3 × 3 convolution, GroupNorm, ReLU and 2× bilinear upsampling, to reach 1/4 scale with 128 channels.
- The levels are summed, then a 1 × 1 convolution and 4× upsampling give per-pixel stuff classes.
- Loss: λᵢ(L_cls + L_box + L_mask) + λₛ L_sem. For example, λᵢ = 1 and λₛ = 0.5 give a total of 1.7 for losses 0.4, 0.3, 0.5 and 1.0.
- 1. PQ for IoU sum 1.8, TP 2, FP 1, FN 1:
- 2. RQ is…
- 3. COCO panoptic classes:
Level 2: Intermediate
★★★☆☆ Intermediate⏱ 25 minUndergraduate students and practising engineers.Panoptic FPN in code
Exercise 1.
- Panoptic quality on a 10 × 10 example gave TP 2, FP 1 and FN 1, SQ 0.9, RQ 2/3 and PQ 0.6.
Merging (detectron2’s defaults).
- Sort instances by score and drop those below 0.5.
- Paste each into an empty panoptic map, taking only free pixels.
- Drop an instance if more than half of it is already taken.
- Fill the remaining pixels with stuff classes from the semantic branch, dropping stuff regions smaller than 4096 pixels.
Practice.
- detectron2’s
PanopticFPNand thepanopticapievaluation (PQ, SQ, RQ for things and stuff) are the reference implementations. - Sharing one backbone for both tasks roughly halves the compute of running Mask R-CNN and a separate FPN segmentation network, with similar accuracy.
- The loss weights need tuning per dataset, as the two tasks compete for the shared features.
inst = sorted([i for i in instances if i.score >= 0.5], key=lambda i: -i.score)
pan = np.zeros(hw, int)
for k, i in enumerate(inst, 1):
free = i.mask & (pan == 0)
if free.sum() < 0.5 * i.mask.sum(): continue # mostly covered: drop
pan[free] = k
for c in stuff_classes: ... # fill the rest from the semantic map (area ≥ 4096)- 1. detectron2's instance score threshold for merging:
- 2. Minimum stuff area kept:
- 3. The semantic branch works at…
Level 3: Advanced
★★★★☆ Advanced⏱ 25 minGraduate level, with full derivations and proofs.Theory
Unique matching.
- Suppose two non-overlapping predictions both had IoU > 0.5 with one ground-truth segment G.
- Each would then cover more than half of G, so together more than all of G, which is impossible.
- The same holds the other way round. So PQ needs no matching algorithm, unlike AP.
SQ × RQ.
- PQ separates how well matched segments fit (SQ) from how many are found (RQ).
- A method can trade one for the other: dropping uncertain segments raises RQ through fewer FPs but may lose TPs.
- PQ is reported separately for things and stuff, since stuff regions are large and easier to overlap.
Why merging matters.
- Mask R-CNN outputs overlapping masks with scores, but a panoptic map allows one label per pixel.
- The order and filters decide which object wins disputed pixels and whether duplicates survive as false positives.
- Exercise 2 measures each rule’s contribution.
- 1. IoU > 0.5 matching is unique because…
- 2. Dropping uncertain segments mainly…
- 3. Merging is needed because instance masks…
Level 4: Expert
★★★★★ Expert⏱ 30 minResearchers: original papers and open problems.How should overlapping masks be merged?
History.
- A. Kirillov, K. He, R. Girshick, C. Rother and P. Dollár defined panoptic segmentation and PQ (CVPR 2019). The name joins “semantic” and “instance” (pan: all, optic: seen).
- A. Kirillov, R. Girshick, K. He and P. Dollár introduced Panoptic FPN (CVPR 2019) as a single-network baseline.
- Panoptic-DeepLab (2020) did it bottom-up, and MaskFormer and Mask2Former (E10-9) unified all three tasks with mask queries.
Exercise 2. We build 60 synthetic 96 × 96 scenes:
- each has 5 ground-truth elliptical objects painted in order (later ones occlude earlier ones);
- each object has a good candidate mask shifted by up to 2 pixels (score 0.6–0.95);
- half the objects have a sloppy, 1.4 × larger duplicate (score 0.3–0.7);
- each scene has three random false positives (score 0.05–0.5).
Four merging rules turn candidates into a panoptic map, which we score with PQ on things (seed 0):
| merging rule | PQ |
|---|---|
| arbitrary order, later overwrites | 0.259 |
| score order, keep every candidate’s free pixels | 0.392 |
| + drop if more than 50% is already taken | 0.480 |
| + drop scores below 0.5 (detectron2’s defaults) | 0.587 |
- Each rule helps.
- Score order lets good masks claim pixels first.
- The overlap rule removes duplicates that would otherwise become FPs.
- The score threshold removes the remaining false positives.
- Seeds 1–3 give 0.633, 0.643 and 0.624 with the full rules.
- The threshold’s gain is partly built in: our false positives score at most 0.5 and good masks at least 0.6. Real detectors’ scores separate less cleanly.
- PQ stays well below 1: occluded ground-truth objects are partial while candidates are whole, which cuts IoU, as it does in real scenes.
Panoptic FPN in AI, robotics and aerospace
- Driving: panoptic maps give free space (stuff) and agents (things) in one output for planning.
- Robotics: a single network for scene layout and graspable objects saves compute on board.
- Earth observation: land cover (stuff) and individual buildings or vehicles (things) together.
References
- A. Kirillov, K. He, R. Girshick, C. Rother, P. Dollár (2019). “Panoptic segmentation.” Proc. CVPR.
- A. Kirillov, R. Girshick, K. He, P. Dollár (2019). “Panoptic feature pyramid networks.” Proc. CVPR.
- B. Cheng et al. (2020). “Panoptic-DeepLab: a simple, strong, and fast baseline for bottom-up panoptic segmentation.” Proc. CVPR.