RefSAM: Efficiently adapting segmenting anything model for referring video object segmentation

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

TL;DR

This paper introduces RefSAM, the first end-to-end framework to adapt the powerful Segment Anything Model (SAM) for Referring Video Object Segmentation (RVOS). RefSAM effectively bridges the gap between visual and linguistic modalities by introducing novel cross-modal fusion modules and a parameter-efficient fine-tuning strategy, achieving state-of-the-art results on multiple benchmarks.

What Problem Does This Paper Address?

Referring Video Object Segmentation (RVOS) is a challenging task that requires accurately segmenting a target object in a video based on a natural language description. While general image segmentation models like SAM have shown remarkable capabilities, they are not directly suited for RVOS. This is primarily because RVOS demands a deep understanding of both visual cues across multiple frames and the semantic meaning of language, and it often lacks explicit ground truth masks for the first frame. Existing methods often rely on multi-stage pipelines or struggle to effectively fuse information from different modalities, leading to suboptimal performance and deployment complexities. RefSAM aims to overcome these limitations by adapting SAM in an end-to-end manner for RVOS.

Methods

RefSAM builds upon the foundation of SAM by introducing several key innovations:

  • Cross-Modal MLP: This lightweight module projects text embeddings from the referring expression into sparse and dense embeddings. These embeddings act as user-interactive prompts, similar to points or bounding boxes in SAM, but derived from language.
  • Hierarchical Dense Attention (HDA) Module: This module is designed to fuse hierarchical visual features (from different layers of SAM's encoder) with the language-derived sparse embeddings. This fusion helps in accurately segmenting objects of various sizes and capturing fine-grained visual-semantic information.
  • Implicit Tracking Module (ITM): To leverage temporal information, ITM generates a "track token" from the current frame's mask prediction. This token is then fed into the mask decoder for subsequent frames, providing historical context and improving spatiotemporal consistency.
  • Parameter-Efficient Fine-Tuning: Instead of retraining the entire SAM model, RefSAM employs an adapter tuning strategy. This involves adding small adapter layers to the latter half of SAM's image encoder and fine-tuning only these adapters, along with the newly introduced modules. This significantly reduces training costs and time.

Datasets

RefSAM was evaluated on the following datasets:

  • Refer-Youtube-VOS: A large-scale dataset for referring video object segmentation.
  • Ref-DAVIS17: An extension of the DAVIS17 dataset, providing language descriptions for objects in videos.
  • Three referring image segmentation (RIS) datasets: RefCOCO, RefCOCO+, and G-Ref.

Key Insights and Ideas

  • SAM's potential for RVOS: The paper demonstrates that SAM, with appropriate adaptations, can be a powerful foundation for RVOS, outperforming previous methods.
  • Bridging the visual-linguistic gap: The Cross-Modal MLP and HDA module are crucial for effectively aligning and fusing information from text and video, a core challenge in RVOS.
  • Importance of temporal context: The Implicit Tracking Module highlights the benefit of incorporating historical segmentation information for improved video segmentation.
  • Parameter-efficient adaptation: Fine-tuning only a small portion of SAM's architecture (adapters) is sufficient to achieve state-of-the-art performance, making the approach more practical.
  • End-to-end learning: RefSAM's end-to-end design simplifies the pipeline, avoiding the issues associated with multi-stage approaches.

Key Results

  • RefSAM achieved state-of-the-art performance on Ref-DAVIS17 with a J&F score of 71.9, outperforming the previous best method (OnlineRefer) by 7.1 points.
  • On Refer-Youtube-VOS, RefSAM achieved a J&F score of 67.6, surpassing strong baselines like PerSAM and SAM-Track and improving upon SOC by 1.6 points.
  • The model also demonstrated competitive results on referring image segmentation datasets.
  • Ablation studies confirmed the effectiveness of each proposed module (Cross-Modal MLP, HDA, ITM) and the benefits of using adapters.
  • RefSAM achieved an inference speed of 9.5 FPS with a ViT-B backbone.

Limitations and Future Work

  • Model Size: While parameter-efficient tuning is employed, the underlying SAM backbone is still large. The paper explores different sizes of visual encoders (ViT-B, ViT-L, ViT-H), showing that larger backbones yield better performance, indicating a trade-off between performance and computational cost.
  • Inference Speed: While competitive, RefSAM's inference speed is marginally slower than some other methods like ReferFormer and SgMg.
  • Future Work: The authors suggest investigating more advanced designs for cross-modal fusion in future work. They also highlight the versatility of RefSAM for other tasks like referring image segmentation.

Summary updated

BibTeX
@inproceedings{li2023refsam,
  author = {Yonglin Li and Jing Zhang and Xiao Teng and Haoyu Zhang and Xinwang Liu and Long Lan},
  title = {{RefSAM: Efficiently adapting segmenting anything model for referring video object segmentation}},
  booktitle = {Neural Networks},
  year = {2023},
}
Figure