Vision and Language Reference Prompt into SAM for Few-shot Segmentation

Kosuke Sakurai, Ryotaro Shimizu, Masayuki GotoarXiv 2025

Abstract

Segment Anything Model (SAM) represents a large-scale segmentation model that enables powerful zero-shot capabilities with flexible prompts. While SAM can segment any object in zero-shot, it requires user-provided prompts for each target image and does not attach any label information to masks. Few-shot segmentation models addressed these issues by inputting annotated reference images as prompts to SAM and can segment specific objects in target images without user-provided prompts. Previous SAM-based few-shot segmentation models only use annotated reference images as prompts, resulting in limited accuracy due to a lack of reference information. In this paper, we propose a novel few-shot segmentation model, Vision and Language reference Prompt into SAM (VLP-SAM), that utilizes the visual information of the reference images and the semantic information of the text labels by inputting not only images but also language as reference information. In particular, VLP-SAM is a simple and scalable structure with minimal learnable parameters, which inputs prompt embeddings with vision-language information into SAM using a multimodal vision-language model. To demonstrate the effectiveness of VLP-SAM, we conducted experiments on the PASCAL-5i and COCO-20i datasets, and achieved high performance in the few-shot segmentation task, outperforming the previous state-of-the-art model by a large margin (6.3% and 9.5% in mIoU, respectively).

Introduction

The Segment Anything Model (SAM) has revolutionized computer vision with its zero-shot segmentation capabilities. However, it faces two significant challenges in practical applications: the requirement for manual prompts (points or boxes) for every target image and its "semantic blindness," as it cannot naturally associate masks with specific category labels.

Few-shot segmentation (FSS) aims to mitigate these issues by using a small set of annotated reference images to guide the model. While previous SAM-based FSS models relied exclusively on visual similarity, they often struggled with ambiguous visual features. VLP-SAM addresses this by integrating text labels alongside reference images, providing a semantic anchor that stabilizes segmentation performance.

Comparison of SAM-based prompting strategies, highlighting the integration of text labels in VLP-SAM.

Methodology

The core of the proposed framework is the VLP (Vision and Language Prompt) Encoder, which replaces SAM’s standard prompt encoder to enable multimodal prompting.

Multimodal Embedding with CLIP Surgery

Standard Vision-Language Models (VLMs) like CLIP often prioritize global image features, which can be detrimental to pixel-level tasks like segmentation. VLP-SAM utilizes CLIP Surgery, a variant that preserves spatial resolution and pixel-to-text correlations. This allows the model to embed target images, reference images, and text labels (e.g., "a photo of a [label]") into a shared latent space while maintaining crucial spatial information.

Feature Fusion and Prompting

The VLP encoder aggregates visual prototypes from reference images and textual prototypes from labels. It also generates "pseudo-masks" based on visual similarity and attention masks that map text labels to image pixels. These features are processed through a transformer-based architecture where learnable queries use cross-attention to interact with reference and target features, ultimately producing a refined prompt embedding for SAM’s mask decoder.

Efficiency and Scalability

VLP-SAM is designed for efficiency. The heavy-duty components—the SAM image encoder and the VLM—remain frozen. Only the lightweight VLP encoder, consisting of approximately 1.4 million parameters, is trained. This makes the framework highly scalable and easy to adapt to new domains.

Experimental Results

The model was rigorously evaluated on the PASCAL-5$^i$ and COCO-20$^i$ benchmarks, which test the model's ability to segment "unseen" classes not present during training.

Quantitative results showing VLP-SAM outperforming the previous state-of-the-art (VRP-SAM) across multiple benchmarks.

VLP-SAM achieved a new state-of-the-art (SOTA) performance:

  • PASCAL-5$^i$: Reached 77.01% mIoU, a 6.3% improvement over the previous SOTA (VRP-SAM).
  • COCO-20$^i$: Reached 59.92% mIoU, representing a significant 9.5% improvement.

These results underscore the value of language as a stabilizer; text labels provide high-level context that helps the model distinguish between visually similar but categorically different objects.

Conclusion

VLP-SAM demonstrates that combining foundational vision models with semantic language prompts significantly enhances few-shot segmentation. By training only a minimal prompt encoder, the model achieves massive performance gains while remaining computationally efficient. Future work may explore reducing the dependency on reference masks or incorporating additional modalities like 3D or depth data to further refine the VLP encoder's accuracy.

Summary updated

BibTeX
@misc{sakurai2025vision,
  author = {Kosuke Sakurai and Ryotaro Shimizu and Masayuki Goto},
  title = {{Vision and Language Reference Prompt into SAM for Few-shot Segmentation}},
  year = {2025},
  eprint = {2502.00719},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2502.00719},
}
Figure