Beyond Prototypes: Semantic Anchor Regularization for Better Representation Learning

Yanqi Ge, Qiang Nie, Ye Huang, Yong Liu, Chengjie Wang, Feng Zheng, Wen Li, Lixin Duan

Abstract

Semantic segmentation relies on learning discriminative feature representations where pixels of the same class cluster together. Traditional methods utilize data-dependent "prototypes" to guide this process, which often leads to biased representations in long-tailed datasets. We present Semantic Anchor Regularization (SAR), a plug-and-play training module that replaces dynamic prototypes with fixed, pre-defined semantic anchors. SAR decouples class centers from noisy training features, significantly improving class separability and robustness to data imbalance with zero additional cost during inference.

Introduction

In semantic segmentation, the objective is to map every pixel to a specific category. Effective models must achieve high intra-class compactness and inter-class separability. Most state-of-the-art approaches employ prototypes—calculated as the mean feature vector of a class within a batch or dataset—to supervise feature clustering. However, this approach suffers from a fundamental flaw: prototypes are inherently coupled with the training data distribution. In imbalanced or "long-tailed" scenarios, prototypes for rare classes become biased toward more frequent features, leading to feature entanglement and poor generalization.

Semantic Anchor Regularization (SAR)

To address the limitations of prototype-based learning, we propose Semantic Anchor Regularization (SAR). The core idea is to utilize "ideal" class centers that are independent of the training features.

The SAR framework architecture, featuring an auxiliary stream that maps pre-defined anchors into the semantic space to guide pixel-level feature learning.

As illustrated in the architecture above, SAR introduces an auxiliary stream during training:

  1. Pre-defined Anchors: The model starts with fixed anchors generated from a stable distribution (e.g., normal or orthogonal).
  2. Embedding and Alignment: A lightweight embedding layer projects these anchors into the semantic space. A shared classifier ensures these anchors are well-separated and semantically meaningful.
  3. Regularization Loss: The model is optimized using a pixel-to-anchor loss ($L_{p2a}$), which pulls pixel features toward their corresponding fixed anchors rather than moving prototypes.
  4. Stability via EMA: Exponential Moving Average (EMA) updates are used to maintain anchor stability, preventing them from drifting toward biased feature clusters.

Crucially, this auxiliary stream is discarded after training, ensuring that SAR adds no computational overhead to the final inference model.

Experimental Results

We evaluated SAR across three major benchmarks: Cityscapes, ADE20K, and Pascal-Context. The method consistently improves performance across various backbones, including HRNet, ResNet, and SegFormer.

Quantitative Performance

On the challenging ADE20K dataset, SAR achieved a 1.3% mIoU improvement over previous state-of-the-art prototype methods. Notably, it significantly boosted performance for "tail" classes (rare objects), demonstrating superior robustness to data imbalance. On Cityscapes, SAR improved HRNet performance by 1.5% mIoU.

Qualitative Analysis

Qualitative comparison between the baseline HRNet and HRNet equipped with SAR. SAR produces cleaner masks and better handles fine details and rare class instances (highlighted in dashed boxes). Beyond Prototypes: Semantic Anchor Regularization for Better Representation Learning, page 7

Qualitative comparison between the baseline HRNet and HRNet equipped with SAR. SAR produces cleaner masks and better handles fine details and rare class instances (highlighted in dashed boxes).

Visual comparisons demonstrate that SAR leads to more precise segmentation boundaries and fewer misclassifications in complex scenes. By providing stable, well-dispersed targets during training, the model learns to better distinguish between semantically similar but distinct categories.

Conclusion

Semantic Anchor Regularization offers a simple yet effective alternative to prototype-based representation learning. By decoupling class centers from training data, SAR mitigates the biases inherent in long-tailed distributions. Its "plug-and-play" nature and zero inference cost make it a highly practical addition to modern semantic segmentation pipelines. Future work will explore the extension of semantic anchors to multi-modal and natural language processing tasks.

Summary updated

BibTeX
@inproceedings{ge2024beyond,
  author = {Yanqi Ge and Qiang Nie and Ye Huang and Yong Liu and Chengjie Wang and Feng Zheng and Wen Li and Lixin Duan},
  title = {{Beyond Prototypes: Semantic Anchor Regularization for Better Representation Learning}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2024},
  doi = {10.1609/aaai.v38i3.27958},
}
Figure