Abstract
Zero-shot semantic segmentation (ZS3) aims to segment novel categories that have not been seen during training. Existing works typically formulate ZS3 as a pixel-level zero-shot classification problem, transferring semantic knowledge from seen classes to unseen ones using language models pre-trained only on text. However, this pixel-level formulation struggles to integrate powerful vision-language models like CLIP, which are pre-trained on image-text pairs and are inherently region-aware. We propose ZegFormer, which decouples ZS3 into two sub-tasks: 1) a class-agnostic grouping task to group pixels into segments, and 2) a zero-shot classification task on those segments. This decoupling provides a natural way to leverage large-scale vision-language models. ZegFormer outperforms previous methods on standard benchmarks by large margins, including a 22-point mIoU increase on PASCAL VOC and a 3-point increase on COCO-Stuff for unseen classes.
Introduction
Semantic segmentation—the task of assigning a category label to every pixel in an image—usually requires massive datasets with exhaustive pixel-level annotations. Zero-Shot Semantic Segmentation (ZS3) aims to break this dependency by training a model on "seen" classes and requiring it to generalize to "unseen" classes using only text descriptions.
Traditionally, ZS3 has been treated as a pixel-level classification problem, where researchers attempt to map individual pixel features to word embeddings. However, this is conceptually difficult because humans describe objects and regions with words, not individual pixels. Furthermore, powerful vision-language models like CLIP are "region-aware" rather than "pixel-aware," making them difficult to integrate into traditional pixel-wise architectures.
The ZegFormer Framework
To address these challenges, we propose ZegFormer, which abandons pixel-wise classification in favor of a two-stage decoupled approach.
1. Class-Agnostic Grouping
Using a Transformer-based architecture (specifically inspired by MaskFormer), the model learns to group pixels into $N$ segments. Crucially, this grouping process is class-agnostic; it learns the general concept of "objectness" or "region-ness" from seen classes. Because visual cues for boundaries and regions (like the texture of water or the shape of a limb) are often shared across categories, this grouping capability transfers easily to unseen classes.
2. Segment-Level Zero-Shot Classification
Once the segments are identified, the model classifies them using the CLIP text encoder to create embeddings for all possible class names (using prompts like "A photo of a [class] in the scene").
To further refine results, ZegFormer treats each predicted segment like a small image. During inference, the model crops or masks the original image based on these segments and runs them through the CLIP image encoder. Fusing the scores from the segment embeddings and the CLIP image embeddings provides a final, highly accurate prediction. This allows the model to leverage the complementary strengths of Transformer features (better for background "stuff") and CLIP image crops (better for discrete "things").
Experimental Results
ZegFormer achieved state-of-the-art results across all standard ZS3 benchmarks:
- PASCAL VOC: Achieved 63.6 mIoU on unseen classes, a staggering 22-point increase over previous methods.
- COCO-Stuff: Improved the unseen mIoU by 3 points, reaching 33.2.
- ADE20k-Full: We introduced a new, challenging benchmark with 847 classes. ZegFormer's zero-shot performance (5.3 mIoU) was remarkably close to a fully supervised model (5.6 mIoU), proving its robustness in large-scale, open-vocabulary scenarios.
Qualitative results demonstrate that while pixel-level baselines often produce noisy or fragmented labels for unseen classes, ZegFormer produces clean, high-quality masks that align much better with human annotations.
Conclusion
By decoupling segmentation into grouping and classification, ZegFormer bridges the gap between semantic segmentation and large-scale vision-language models. This shift not only improves accuracy and efficiency but also aligns the task with the way language naturally describes the visual world. Future work will explore even more efficient grouping methods and the potential for full open-vocabulary segmentation.
Code is available at: https://github.com/dingjiansw101/ZegFormer
Summary updated