Introduction
Semantic segmentation models have traditionally been "closed-set" systems, trained to recognize a fixed list of categories like "car," "tree," or "road." If a user wants the model to recognize a new category, they typically face a massive bottleneck: collecting thousands of pixel-perfect annotations and retraining the model from scratch.
Given that the English language contains hundreds of thousands of nouns, but most datasets only cover a few hundred, this creates a severe "vocabulary gap." Models remain blind to the vast majority of visual concepts. While "few-shot" and "zero-shot" methods have attempted to bridge this gap, they often rely on complex generative setups or still require a handful of labeled examples to work effectively.
Enter LSeg (Language-driven Semantic Segmentation), a novel architecture that maps image pixels and text labels into a shared embedding space. By leveraging pre-trained language models like CLIP, LSeg enables true "zero-shot" semantic segmentation, allowing users to segment images using arbitrary label sets at test time without any additional fine-tuning.
Methods: The LSeg Architecture
To achieve this flexibility, LSeg moves away from predicting fixed class indices and instead predicts continuous embeddings.
The system relies on a Dual-Encoder Architecture:
- Text Encoder: A pre-trained and frozen CLIP model converts a user-provided list of labels (e.g., "grass," "building," "cat") into a set of continuous vector embeddings.
- Image Encoder: A Dense Prediction Transformer (DPT) processes the input image and produces a high-dimensional embedding for every single pixel.
During training, Contrastive Alignment is used to teach the image encoder to produce pixel embeddings that closely match (via dot product) the text embedding of their ground-truth label.
Because the model learns to align pixels with semantic concepts rather than fixed IDs, it enables Dynamic Labeling. At test time, a user can provide any list of labels. The model calculates the similarity between every pixel and every provided label, assigning each pixel to the most similar text embedding. Finally, Spatial Regularization Blocks (using depthwise convolutions) are employed to upsample and refine these predictions, handling the memory constraints of high-resolution transformers while ensuring the model remains label-equivariant.
Key Insights
- Language as a Semantic Bridge: By utilizing CLIP’s pre-trained knowledge, LSeg inherits a deep understanding of semantic relationships. It inherently knows that a "cat" is more similar to a "pet" or "furry" than to a "car." This allows the model to generalize to synonyms or related concepts it never explicitly saw in a segmentation dataset.
- Breaking the Fixed-Channel Constraint: Traditional models require $N$ output channels for $N$ classes. LSeg uses a fixed embedding dimension (e.g., 512), making the output head independent of the number of classes and allowing for infinite flexibility during inference.
- Zero-shot Surpasses Few-shot: Surprisingly, LSeg often outperforms specialized few-shot models that are given one or five example images of a new class, despite LSeg seeing zero examples. This suggests that broad linguistic supervision provides a more powerful prior for generalization than a handful of visual examples.
Key Results
The authors evaluated LSeg across several rigorous benchmarks, proving its efficacy in both zero-shot and standard settings:
- State-of-the-Art Zero-Shot: On the PASCAL-5i benchmark, LSeg (using a ResNet101 backbone) achieved 47.4 mIoU, significantly outperforming the previous zero-shot baseline, ZS3Net (38.3 mIoU).
- Beating Few-Shot Models: On the FSS-1000 dataset, LSeg reached 87.8 mIoU, surpassing the state-of-the-art 1-shot model, HSNet (86.5 mIoU), despite never seeing the target classes during training.
- No Performance Penalty: On the ADE20K validation set (150 classes), LSeg matched the performance of a standard fixed-label DPT model (47.25 vs 47.63 mIoU). This demonstrates that language-driven flexibility does not come at the cost of traditional accuracy.
Limitations and Future Work
While powerful, LSeg has limitations. The model is susceptible to "Closest Neighbor" Errors: if the true label is missing from the provided set, the model forces the pixel into the closest semantic neighbor (e.g., labeling a "dog" as a "toy" if "dog" isn't an option). It also occasionally suffers from Hierarchical Confusion, struggling when multiple labels are technically correct, such as labeling a window as "house" because it is part of the house. Future work may involve training with "negative" text samples to help the model better delineate boundaries between closely related concepts.
Summary updated