Instance, semantic and panoptic
| Instance | Semantic | Panoptic | |
|---|---|---|---|
| Question it answers | Which objects, and exactly where? | Which class is each pixel? | Both, for every pixel |
| Separate objects | Yes | No | Yes, for countable classes |
| Every pixel labeled | No, only objects | Yes | Yes |
Choose instance segmentation when you need to count, measure or track individual objects; choose semantic segmentation when only the area of each class matters, such as road versus sidewalk. Panoptic segmentation combines the two.
How the models work
The classic design adds a mask branch to a two-stage detector: Mask R-CNN predicts a box for each object, then a small mask inside it. Detectron2 ships Mask R-CNN baselines, MMDetection covers many more architectures, and YOLO has segmentation variants that predict masks in a single stage.
Labels to prepare
Each object needs its own polygon or bitmap, with a class. A box is not enough. Polygon annotation is the usual choice; bitmaps suit hair-thin or ragged edges.
Pitfalls
- One polygon drawn around two touching objects, which teaches the model to merge them.
- An occluded object split in two by a pole, labeled as two objects instead of one object with two parts.
- Masks that overlap their neighbours, so the same pixel belongs to both.
In Supervisely
The Smart Tool in the image labeling tool returns a mask from a box, and polygons of touching objects share one border. Detectron2, MMDetection 3.0 and YOLO segmentation models train on polygons and bitmaps, and their evaluation report uses the detection metrics with IoU measured between masks.