Abstract
Traditional semantic segmentation models rely on parametric classification heads, where fixed weights or queries are learned for each class. This approach often fails to capture intra-class variance and scales poorly with large vocabularies. This paper introduces a nonparametric alternative, ProtoSeg, which represents classes as sets of data-driven prototypes. By utilizing online clustering and a distance-based objective, ProtoSeg improves feature space structure and achieves state-of-the-art performance across major benchmarks like ADE20K and Cityscapes while significantly reducing parameter counts in the classification head.
Introduction
Semantic segmentation has long been dominated by the "parametric" paradigm. Whether utilizing classic Fully Convolutional Networks (FCNs) or modern Transformer-based architectures like SegFormer, the final stage of the pipeline—mask decoding—typically involves a learnable weight matrix or a set of query vectors. In this setup, each class is represented by a single vector in the embedding space.
While effective, this standard approach suffers from three fundamental limitations. First, it oversimplifies class representation; a single vector cannot adequately capture the diverse visual appearances of a category (e.g., a "car" viewed from different angles or in different lighting). Second, it scales poorly; as the number of categories increases in large-vocabulary datasets, the parameter count of the classification head grows linearly, hindering generalization. Finally, standard cross-entropy objectives focus on relative class scores rather than the geometric structure of the embedding space, often leading to poorly clustered features.
The ProtoSeg Framework
To address these issues, we propose ProtoSeg, a nonparametric framework that replaces learnable class weights with non-learnable, data-driven prototypes. In this view, each class is represented by $K$ prototypes—mean feature vectors of sub-clusters within that class—derived directly from the training data.
Online Clustering and Momentum Updates
To identify these prototypes dynamically during training, ProtoSeg employs an efficient online clustering strategy. Using the Sinkhorn-Knopp algorithm, the model assigns pixels to prototypes in a differentiable manner within each training batch. To ensure stability and consistency as the encoder evolves, the prototypes are updated using a momentum-based moving average of the features assigned to them. This allows the prototypes to track the shifting feature distribution without requiring explicit backpropagation through the prototype values themselves.
Triple Loss Objective
The model is optimized using a tripartite loss function designed to shape a robust embedding space:
- Cross-Entropy ($L_{CE}$): Maintains standard discriminative performance.
- Pixel-Prototype Contrastive ($L_{PPC}$): A contrastive loss that pulls pixel embeddings toward their assigned prototypes and pushes them away from others.
- Pixel-Prototype Distance ($L_{PPD}$): Directly minimizes the Euclidean distance between a pixel and its corresponding prototype to ensure intra-class compactness.
Experimental Results
We evaluated ProtoSeg on three primary benchmarks: ADE20K, Cityscapes, and COCO-Stuff. The results demonstrate that the prototype-based approach consistently outperforms parametric baselines across various backbones, including ResNet, HRNet, and MiT (SegFormer).
- ADE20K: ProtoSeg improved the mIoU of FCN by 1.2% and SegFormer by 0.8%.
- Cityscapes: The model achieved 83.0% mIoU on the test set, surpassing the parametric SegFormer baseline.
- Large Vocabulary Scaling: On the ADE20K-Full dataset (847 classes), ProtoSeg outperformed the parametric baseline by 1.7% mIoU. Notably, it achieved this while using 6.5 million fewer parameters in the classification head, demonstrating superior efficiency for complex, real-world scenarios.
Qualitative analysis further reveals that ProtoSeg is more adept at capturing fine structural details and handling objects with high intra-class variance, as the multiple prototypes per class allow for a more nuanced representation of visual sub-categories.
Discussion and Limitations
The "prototype view" suggests that traditional softmax weights are essentially just learnable prototypes. By making these prototypes non-learnable and data-driven, we gain a more interpretable and scalable framework. This approach explicitly shapes the feature space, pulling pixels into tight, distinct clusters, which improves the model's robustness.
However, the method is not without challenges. The online clustering step, while optimized for GPUs (adding approximately 2.5ms per 10k pixels), introduces additional complexity to the training pipeline. Furthermore, because the prototypes are derived directly from data, the model may be more sensitive to label noise or mislabeled pixels compared to parametric models that can "average out" noise through weight updates.
Conclusion
ProtoSeg represents a significant shift in how we approach semantic segmentation. By moving from parametric weights to nonparametric prototypes, we can build models that are more scalable, more efficient, and better at capturing the inherent complexity of the visual world. Future work will explore the application of this prototype view to unsupervised representation learning and the unification of image-level and pixel-level classification tasks.
Summary updated