TL;DR
This paper introduces two simple yet highly effective ways to adapt the Segment Anything Model (SAM) for unsupervised moving object segmentation in videos by combining it with optical flow. By either feeding optical flow directly as an input image or using it as a segmentation prompt, the proposed models drastically outperform previous complex, self-supervised methods on both single- and multi-object benchmarks.
What Problem Does This Paper Address?
Discovering and segmenting moving objects in video sequences—known as motion segmentation or unsupervised video object segmentation (VOS)—is a foundational computer vision task. Historically, solving this required complex, tailored pipelines involving self-supervised learning, object-centric representations, or amodal training schemes.
While optical flow provides crucial motion cues (like boundaries and part grouping), it suffers from background noise, camera movement, and the obvious limitation that objects disappear from the flow field when they temporarily stop moving. The authors ask a straightforward question: Can we leverage the massive zero-shot segmentation power of foundation models like SAM to solve these classic motion segmentation challenges without overcomplicating the architecture?
Methods
The authors propose two distinct frame-level architectures to integrate SAM with optical flow, followed by a sequence-level association mechanism to track object identities over time.
1. Flow-as-Input (FlowI-SAM)
In this setup, optical flow fields are converted into 3-channel RGB images using a standard color wheel and fed directly into SAM's image encoder. Instead of using SAM's default IoU prediction head (which struggles with over-segmentation), the authors finetune the lightweight mask decoder to predict a foreground object IoU (fIoU) score. To handle noisy motion fields, they average spatial features extracted across multiple frame gaps (e.g., 1, -1, 2, -2 frames).
2. Flow-as-Prompt (FlowP-SAM)
Here, SAM takes the standard RGB frame as input to exploit its rich appearance priors. Meanwhile, a separate, lightweight Flow Prompt Generator processes the optical flow to produce specialized prompt tokens. These tokens act as queries that guide SAM's mask decoder to focus specifically on moving regions. This model outputs both an fIoU score and a Moving Object Score (MOS) to determine if a prompt lands on a valid moving object.
3. Sequence-Level Mask Association
To turn frame-level masks into consistent video tracks, the authors introduce a post-processing module based on temporal consistency. By warping masks from adjacent frames using optical flow and applying a three-way Hungarian matching algorithm, the system auto-regressively decides whether to propagate an existing object mask or instantiate a new one.
Datasets
- Training: Pre-trained on a synthetic video dataset (introduced by Xie et al., 2022) and finetuned on real-world sequences from the DAVIS training sets.
- Evaluation (Single-Object): DAVIS2016, SegTrackv2 (STv2), FBMS-59, and MoCA (Moving Camouflaged Animals).
- Evaluation (Multi-Object): DAVIS2017, DAVIS2017-motion, and YouTubeVOS2018-motion.
Key Insights and Ideas
- SAM's internal representations transfer to motion fields: Surprisingly, SAM’s heavy image encoder (pre-trained purely on RGB images) can extract highly precise object boundaries and structures when fed raw, colorized optical flow.
- Redefining "Objectness" is key: Standard SAM is designed to over-segment images into hierarchical parts (objects, subparts, etc.). Introducing
fIoUandMOSallows the network to filter out background segments or incomplete object fragments effectively. - Modality Complementarity:
FlowI-SAMandFlowP-SAMexcel in opposite scenarios.FlowI-SAMis appearance-agnostic, making it perfect for camouflaged animals or heavy motion blur.FlowP-SAMleverages RGB textures, allowing it to cleanly separate multiple interacting objects that share similar optical flow signatures. Layering them together yields the best results.
Key Results
The proposed approaches achieve new state-of-the-art results across all major unsupervised video object segmentation benchmarks, often outperforming prior methods by over 10%.
- Frame-Level Performance: On the multi-object DAVIS17-motion benchmark, combining FlowP-SAM and FlowI-SAM achieves an IoU ($\mathcal{J}$) of 80.0%, compared to the previous best of 59.3%. On DAVIS16, it reaches 86.2%.
- Sequence-Level Performance: When tracking objects across entire videos, the sequence-level model achieves 87.7% $\mathcal{J}$ on DAVIS16 and 74.3% on DAVIS17-motion, outperforming highly engineered unsupervised VOS pipelines like DEVA and UVOSAM.
Limitations and Future Work
The primary bottleneck of this work is its inference speed. Because it relies on the computationally heavy Vision Transformer (ViT-H) backbone from the vanilla SAM model, processing times are relatively slow (e.g., ~0.97 seconds per image for FlowP-SAM).
However, the authors note that their framework is entirely modular. They demonstrate that swapping the vanilla SAM backbone for more recent, lightweight alternatives like EfficientSAM or SAM 2 can cut inference times down significantly (from 0.97s to 0.08s per image) while retaining strong performance. Future work will likely focus on native integration with these faster architectures and improving tracking robustness during long-term occlusions.
Summary updated