TL;DR
SASFormer is a simple yet powerful single-stage framework that tackles semantic segmentation using only sparse labels (like single points or scribbles). By repurposing the inherent self-attention maps of a Vision Transformer to propagate labels to unlabeled regions and enforcing consistency via a novel "affinity loss," it achieves state-of-the-art performance without the need for complex multi-stage training or auxiliary networks.
What Problem Does This Paper Address?
Semantic segmentation—the task of assigning a category to every pixel in an image—is notoriously expensive because it typically requires dense, pixel-perfect annotations. To lower costs, researchers use Sparsely Annotated Semantic Segmentation (SASS), where only a few points or scribbles are labeled per object.
The challenge with SASS is "filling in the blanks." Without a precise boundary, models often struggle to recognize the full extent of an object. Traditional solutions often rely on complex, multi-stage pipelines, heavy post-processing (like Conditional Random Fields), or auxiliary tasks (like boundary detection) to spread information from labeled pixels to their unlabeled neighbors. These methods are often computationally expensive and difficult to tune.
Methods
The authors introduce SASFormer, which is built upon the SegFormer architecture. Instead of adding external complexity, they look inside the transformer to solve the sparsity problem.
- Hierarchical Patch Attention Maps: Vision Transformers naturally calculate how much every "patch" of an image relates to every other patch (self-attention). SASFormer aggregates these attention maps across multiple levels of the encoder.
- Label Propagation: These attention maps act as a guide. By multiplying the network’s current predictions by the attention maps, the model "spreads" the predicted labels across regions that the transformer deems related.
- Affinity Loss: This is the core innovation. The authors introduce a loss function that minimizes the difference between the network’s raw predictions and the "propagated" predictions. This forces the model to ensure that pixels with high visual/semantic affinity (as determined by the attention mechanism) receive the same class label.
- Single-Stage Training: Unlike many predecessors that require generating pseudo-labels in one step and training on them in another, SASFormer trains end-to-end in a single pass.
Datasets
The model was evaluated on three major benchmarks:
- PASCAL VOC 2012: Tested using both point-wise (one pixel per object) and scribble-wise annotations.
- Cityscapes: Used to test performance under varying levels of label sparsity (10%, 20%, and 50% of full labels).
- ADE20k: Also used for varying sparsity tests to demonstrate the framework's robustness across different scene types.
Key Insights and Ideas
- Transformers are "SASS-Ready": The most elegant insight is that the self-attention mechanism in transformers is essentially a built-in affinity graph. While CNNs usually need an external CRF to model pixel relationships, transformers do this by design.
- Multi-Scale Synergy: The authors found that using attention maps from all four encoder blocks is crucial. Early layers capture low-level features like color and texture (helping with precise boundaries), while deeper layers capture high-level semantic consistency (helping identify the whole object).
- Noise Suppression: A common problem with transformers is "background distraction," where attention drifts to irrelevant areas. The affinity loss helps regularize this, effectively "cleaning up" the attention maps during training so they focus more tightly on the objects of interest.
Key Results
SASFormer sets a new high bar for sparsely supervised segmentation:
- Point-wise Supervision: On PASCAL VOC, SASFormer achieved 73.13% mIoU, significantly outperforming the previous state-of-the-art (TEL) at 69.33%.
- Scribble-wise Supervision: It reached 79.49% mIoU, surpassing the baseline SegFormer by over 6%.
- Flexibility: The authors showed that their affinity loss isn't tied to one specific model; it provided a significant performance boost (+3% to +6% mIoU) when added to other transformer backbones like SETR and Segmentor.
- Efficiency: By avoiding multi-stage training and complex auxiliary nets, SASFormer provides a more streamlined path to high-quality segmentation.
Limitations and Future Work
While SASFormer effectively suppresses background noise in attention maps, the authors acknowledge that the inherent tendency of transformers to distract attention toward the background remains a challenge. The paper focuses primarily on the PASCAL VOC, Cityscapes, and ADE20k datasets; exploring how this approach scales to "in-the-wild" data with even more extreme sparsity or class imbalance could be a fruitful next step. Additionally, while the L1 distance was chosen for the affinity loss, further exploration into more complex distance metrics might yield marginal gains.
Summary updated