TL;DR
Adapting the Segment Anything Model (SAM) to cross-domain few-shot segmentation typically requires tedious manual prompting and struggles with severe domain shifts. The proposed Composable Meta-Prompt (CMP) framework automates prompt generation by combining LLM-derived semantic knowledge with frequency-domain alignment. This approach eliminates manual intervention and achieves state-of-the-art performance across diverse target domains, including medical and satellite imagery.
What Problem Does This Paper Address?
Few-shot semantic segmentation (FSS) aims to segment novel object classes using only a few labeled examples. While standard FSS works well when training and testing data share the same distribution, it struggles with Cross-Domain Few-Shot Segmentation (CD-FSS)—where the model must generalize to entirely different domains (e.g., moving from natural images to satellite photos or medical scans).
Foundation models like Meta's Segment Anything Model (SAM) possess incredible zero-shot capabilities, making them ideal candidates for this task. However, SAM suffers from two critical limitations in CD-FSS:
- Manual Prompt Dependency: SAM relies heavily on human-crafted prompts (like bounding boxes or points) for each test image, making large-scale deployment impractical.
- Domain Degradation: SAM’s performance drops significantly when it encounters specialized domains that deviate sharply from its natural-image-heavy training data.
The authors address a fundamental question: How can we develop an automated, domain-adaptive prompting mechanism that preserves SAM's segmentation power while effectively bridging domain gaps?
Methods
The authors introduce the Composable Meta-Prompt (CMP) framework, which automatically synthesizes domain-adaptive prompts through three synergistic modules:
- Reference Complement and Transformation (RCT): To enrich scene understanding, the framework queries a Large Language Model (LLM) to identify objects that typically co-occur with the target class (e.g., asking what co-exists with a "bird"). These are treated as negative categories. Both target and negative classes are converted into semantic prototypes using a CLIP text encoder, while visual prototypes are extracted from the support images.
- Composable Meta-Prompt Generation (CMPG): This module automatically synthesizes prompts at both semantic and geometric levels, ensuring compatibility with SAM's native prompt encoder. It uses self-attention to refine the prototypes and a learnable adapter to convert soft spatial priors into mask embeddings, completely removing the need for manual prompt design.
- Frequency-Aware Interaction (FAI): To mitigate domain shifts, this module processes intermediate features in the frequency domain using Fast Fourier Transforms (FFT). It features two mechanisms: Cross-domain Frequency Alignment (CDFA), which uses a memory bank of source domain statistics to align target domain styles, and Support-Query Frequency Enhancement (SQFE), which performs bidirectional amplitude spectrum interactions to reduce variations between support and query images.
Datasets
The model is meta-trained on PASCAL VOC 2012 (with SBD augmentation) as the source domain. To evaluate cross-domain generalization, it is tested on four distinct target datasets:
- FSS-1000: Natural objects (1000 classes).
- DeepGlobe: Satellite and remote sensing imagery.
- ISIC2018: Medical imaging for skin lesion segmentation.
- Chest X-ray: Medical imaging for pulmonary screening.
Key Insights and Ideas
- Cognitive Composition: Inspired by human cognition, which generalizes by combining multiple internal representations, CMP successfully blends text-based semantic context (from LLMs) with visual-spatial geometry.
- Negative Context is Powerful: Instead of only teaching the model what the target object looks like, the RCT module explicitly teaches the model what not to segment by leveraging LLM knowledge of co-occurring objects.
- Style Alignment via Frequency: Rather than relying solely on spatial feature alignment—which can inadvertently distort object semantics—the FAI module manipulates the amplitude spectrum. This allows the model to adapt to new visual styles (like X-rays or satellite views) while preserving structural integrity.
Key Results
CMP achieves state-of-the-art (SOTA) performance across all evaluated benchmarks, outperforming both standard ResNet-based architectures and existing SAM-based adaptation methods.
- Overall Performance: CMP achieves an average 71.8% mIoU in 1-shot and 74.5% mIoU in 5-shot scenarios, outperforming the previous best methods by 10.5% and 8.5% respectively.
- Medical Domain Gains: On the challenging ISIC dataset, CMP hits 60.5% mIoU in the 1-shot setting, representing a massive leap over prior SAM-based methods like APSeg (45.4%) and PerSAM (23.3%).
- Ablation Insights: Ablation studies confirm that the automated prompt generation (CMPG) is the most critical component; removing it causes the largest performance drop (-6.7% mIoU).
Limitations and Future Work
The authors note that the framework's performance degrades under extreme domain shifts or when the initial coarse foreground mask is highly inaccurate due to severe support-query mismatches. Future work will likely need to address how to robustly handle cases where the support and query images look radically different despite containing the same semantic class.
Summary updated