Segmentation
Segmentation assigns labels to pixels, voxels, residues, atoms, or regions. It is used when localization must be more precise than a bounding box.
For semantic image segmentation, the model predicts:
where each pixel receives one of class labels.
Types
- Semantic segmentation: class label per position.
- Instance segmentation: separate mask per object instance.
- Panoptic segmentation: semantic and instance segmentation combined.
- 3D segmentation: voxel, point-cloud, or structure-region labels.
Metrics
Intersection-over-union for a class is:
Mean IoU averages this across classes:
Output Space
Segmentation output is dense:
where is the predicted probability for class at position . The hard mask is usually:
For multi-label masks, each class may instead use an independent threshold.
Loss Choices
Common losses include pixel cross-entropy:
and Dice-style overlap:
The loss should match whether missing boundaries, small objects, foreground coverage, or class balance matters most.
Failure Boundary
Segmentation errors can come from:
- boundary shift;
- missing small regions;
- false positive regions;
- merged or split instances;
- label ambiguity from weak masks;
- resizing or interpolation artifacts.
Checks
- Are boundaries or interior regions more important?
- Is class imbalance severe?
- Are masks generated manually, automatically, or from weak labels?
- Does resizing preserve thin structures?
- For scientific data, does the mask correspond to a physically meaningful region?
- Are unlabeled pixels ignored, treated as background, or treated as unknown?
- Is the task semantic, instance, panoptic, or multi-label segmentation?
- Is metric computed per image, per class, or over the whole dataset?