Abstract
Open-Vocabulary Semantic Segmentation (OVSS) aims to recognize arbitrary categories by leveraging Vision-Language Pre-trained (VLP) models. However, adapting these models to specific target domains with limited labeled data remains a challenge. We present TFM² (Training-Free Mask Matching), a plug-and-play adapter that enhances OVSS models using a handful of labeled examples. By constructing a region-based key-value cache and refining it through three specialized modules—Intra-Class Dynamic Filter, Inter-Class Channel Reduction, and Cache Value Feature Alignment—TFM² improves state-of-the-art performance by up to 5% mIoU without requiring any gradient-based fine-tuning.
Introduction
Traditional semantic segmentation is limited to a closed set of classes defined during training. OVSS breaks this barrier by using models like CLIP to align visual features with text embeddings. Despite this flexibility, a gap exists in "few-shot" scenarios where a model must adapt to a specific domain using only a few labeled masks.
Existing cache-based adapters often rely on global image features, which lack the spatial precision necessary for dense segmentation tasks. Fine-tuning the entire network is often computationally prohibitive and requires substantial data. TFM² addresses these issues by focusing on mask-level features, allowing for more precise alignment between visual regions and their categorical labels in a completely training-free manner.
Methodology
The core of TFM² is a Mask Cache, a key-value store where "keys" represent visual features of masks and "values" represent their corresponding labels. The framework processes few-shot masks and test images through a unified pipeline to generate final predictions.
To ensure the robustness of the cache, TFM² introduces three refinement modules:
- Intra-Class Dynamic Filter: This module calculates cosine similarity between masks of the same class to identify and filter out unrepresentative outliers, ensuring the cache keys are robust.
- Inter-Class Channel Reduction: VLP embeddings often contain redundant information. This module selects the most discriminative feature channels—those with high variance and low similarity between different classes—to sharpen classification boundaries.
- Cache Value Feature Alignment: Using Kullback-Leibler (KL) divergence, this module refines cache values to bridge the distribution gap between visual features and text embeddings, calibrating the visual-textual mapping.
During inference, the system generates "cache logits" from this refined store and fuses them with the base model's predictions via a weighted average to produce the final segmentation map.
Experimental Results
We evaluated TFM² across four challenging benchmarks: ADE20k-150, ADE20k-847, Pascal Context (PC-59), and PC-459. These datasets provide a wide array of categories to rigorously test open-vocabulary capabilities.
TFM² demonstrated consistent improvements across various base models (SAN, SimSeg, OVSeg) and backbones (ResNet, ViT, Swin):
- Performance Gains: The method improved mIoU by 1% to 5% across different settings.
- State-of-the-Art Enhancement: When applied to the SAN (ViT-L) model on ADE20k-150, it boosted performance from 32.0% to 37.2% mIoU (+5.2%).
- Efficiency: As a training-free method involving only linear operations, TFM² adds negligible latency to the inference process.
Discussion and Conclusion
TFM² proves that a well-engineered, region-based cache can provide significant gains with zero training overhead. Key insights include the superiority of mask-level features over global context for segmentation and the effectiveness of feature pruning (Channel Reduction) in improving class discriminability.
However, the method is sensitive to the quality of the few-shot examples; unrepresentative masks can hinder performance when the number of shots is extremely low (e.g., K=2). Future work may explore dynamic hyperparameter tuning or integrating universal segmentation models like Segment Anything (SAM) to further refine initial mask proposals. In summary, TFM² offers a highly efficient and effective solution for adapting OVSS models to new domains in data-scarce environments.
Summary updated