RefSAM: Efficiently Adapting Segmenting Anything Model for Referring Video Object Segmentation

Yonglin Li, Jing Zhang, Xiao Teng, Long Lan, Xinwang Liu

TL;DR

Meta’s Segment Anything Model (SAM) is a powerhouse for image segmentation, but it struggles with language-guided video tasks due to its lack of native cross-modality understanding. RefSAM bridges this gap by introducing an end-to-end, parameter-efficient framework that adapts SAM for Referring Video Object Segmentation (RVOS). By injecting lightweight cross-modal alignment and temporal tracking modules, RefSAM achieves state-of-the-art performance while keeping the core foundation model frozen.

What Problem Does This Paper Address?

Referring Video Object Segmentation (RVOS) requires a model to track and outline a specific object across video frames based on a natural language description (e.g., "a man in a red sweatshirt performing breakdance").

While SAM generalizes incredibly well to unseen images, it has two major limitations for RVOS:

  1. No Native Text Support: SAM expects visual prompts like points, bounding boxes, or masks—not natural language.
  2. No Temporal Awareness: SAM processes static images and lacks a mechanism to track objects over time.

To use SAM for video tracking, existing methods typically deploy a multi-stage pipeline: an object detector (like Grounding DINO) generates a bounding box from the text description in the first frame, which is then passed to a SAM-based tracker. However, these multi-stage pipelines suffer from error propagation (if the detector misses the object initially, the tracker fails entirely) and are cumbersome to train and deploy. RefSAM solves this by creating a unified, end-to-end framework.

Methods

RefSAM adapts SAM for video and language inputs using a parameter-efficient tuning strategy. The core weights of SAM's Visual Encoder and a T5 Text Encoder are frozen, while a few lightweight modules are introduced and trained:

Fig. 2: The overall pipeline of RefSAM. It mainly consists of five key components: 1) Backbone: Visual Encoder of SAM [13] with Adapter and Text Encoder; 2) Cross-Modal MLP; 3) Hierarchical Dense Attention; 4) Mask Decoder of SAM; and 5) Implicit Tracking Module. We construct cross-modal Sparse Embeddings and Dense Embeddings to learn text-visual information and predict masks. We use the implicit tracking module to generate a track token and provide historical information for the mask decoder.
  • Adapters in the Visual Encoder: Small, trainable bottleneck layers are inserted into the latter half of SAM's ViT blocks to help the visual features align better with language concepts.
  • Cross-Modal MLP: This module projects text embeddings from the T5 encoder directly into SAM's native prompt space, generating Sparse Embeddings that act like virtual point or box prompts.
  • Hierarchical Dense Attention (HDA): Standard SAM only uses the final layer of the visual encoder. RefSAM introduces HDA to fuse intermediate, multi-scale visual features with the text embeddings, creating Dense Embeddings that help the model segment tiny or complex objects.
  • Implicit Tracking Module (ITM): To handle the temporal aspect of video, the ITM takes the abstract mask token generated by SAM's decoder in the current frame and transforms it into a track token. This token provides historical context to the decoder when processing the subsequent frame.
Fig. 1: RefSAM integrates multi-view information from diverse modalities and successive frames at different timestamps in an online manner. Similar to SAM, RefSAM generates three types of token outputs: IOU token output (green), main mask token output (light blue), and three-scale mask token outputs (dark blue). We feed the main mask token output into RefSAM’s tracking module to obtain the track token that can provide historical information for the mask decoder and assist RefSAM in predicting the mask for the next frame.

Datasets

The authors evaluated RefSAM across both video and static image benchmarks:

  • RVOS Benchmarks: Refer-Youtube-VOS (a large-scale dataset with ~15,000 expressions) and Ref-DAVIS17.
  • RIS (Referring Image Segmentation) Benchmarks: To prove its versatility on static images, the model was tested on RefCOCO, RefCOCO+, and G-Ref.

Key Insights and Ideas

  • Text as a Native Prompt: Instead of using an external model to turn text into bounding boxes, RefSAM translates text directly into SAM's internal prompt embedding space.
  • Tracking via Abstract Tokens: Rather than passing explicit masks or bounding boxes across frames, RefSAM implicitly tracks objects by passing the abstract mask token through time via the ITM. This preserves spatiotemporal consistency without heavy computational overhead.
  • Hierarchical Features for Text Grounding: The authors discovered that standard SAM features are too coarse for language grounding. Incorporating intermediate encoder layers via the HDA module is crucial for mapping complex text queries to multi-scale visual objects.

Key Results

RefSAM achieved outstanding results, significantly outperforming both traditional RVOS methods and multi-stage SAM baselines:

  • Ref-DAVIS17: RefSAM achieved a 71.9 J&F score, outperforming the previous state-of-the-art method (OnlineRefer) by 7.1 points. It also vastly outperformed the multi-stage baseline of SAM-Track + Grounding DINO (57.1 J&F).
  • Refer-Youtube-VOS: It scored 67.6 J&F, capturing a 1.6-point lead over the previous best-performing model (SOC).
  • Efficiency: Because the foundation models are frozen, RefSAM is highly parameter-efficient. Depending on the backbone size (ViT-B to ViT-H), it only requires tuning between 9.9M and 33.0M parameters.

Limitations and Future Work

While RefSAM outperforms multi-stage SAM trackers in speed (achieving up to 9.5 FPS with a ViT-B backbone), it is still marginally slower than highly specialized, non-foundation RVOS models like ReferFormer.

For future work, the authors plan to investigate more advanced cross-modal fusion mechanisms to further bridge the semantic gap between vision and language domains.

Summary updated

BibTeX
@inproceedings{li2023refsam,
  author = {Yonglin Li and Jing Zhang and Xiao Teng and Long Lan and Xinwang Liu},
  title = {{RefSAM: Efficiently Adapting Segmenting Anything Model for Referring Video Object Segmentation}},
  booktitle = {Neural Networks},
  year = {2023},
}
Figure