Moving Object Segmentation: All You Need is SAM (and Flow)

Junyu Xie, Charig Yang, Weidi Xie, Andrew Zisserman

Introduction

Moving Object Segmentation (MOS) is the task of identifying and outlining objects in a video based solely on their movement. This presents a classic "chicken and egg" problem: to segment an object perfectly, one needs to know it is an object; but to identify a moving object, a high-quality segment is often required to isolate its motion from the background. While the Segment Anything Model (SAM) has revolutionized image segmentation, it is fundamentally "motion-blind." Conversely, traditional optical flow is excellent at discovering moving entities but often yields blurry or noisy boundaries. Researchers from Oxford's Visual Geometry Group (VGG) bridge this gap by injecting motion cues into SAM’s high-fidelity segmentation pipeline through two novel architectures: FlowI-SAM and FlowP-SAM.

Methodology

The proposed framework integrates optical flow with SAM using two distinct strategies, complemented by a temporal association module for video consistency.

  1. FlowI-SAM (Flow-as-Input): This model treats optical flow as a standard 3-channel RGB image. By finetuning SAM’s lightweight mask decoder to recognize "textures" in the flow field, the model segments objects based purely on motion boundaries, making it highly robust to complex visual textures or camouflage.
  2. FlowP-SAM (Flow-as-Prompt): This dual-stream approach uses a standard RGB frame as input but employs a "Flow Prompt Generator" (a small transformer) to process optical flow. This generator produces prompts that guide SAM to the moving objects within the RGB image, leveraging RGB for crisp boundaries.
  3. Sequence-level Association: To ensure temporal consistency, the authors use a module based on Hungarian matching and flow-based warping. This ensures that frame-by-frame segments form a consistent video track, preventing identity flickering.
Overview of FlowI-SAM, FlowP-SAM, and Sequence-level Mask Association.

Key Technical Insights

  • Repurposing "Objectness": A significant insight is that SAM’s internal IoU prediction head can be repurposed into a "Foreground Objectness" (fIoU) score. This helps the model distinguish between complete moving objects and background noise.
  • Multi-Gap Flow: To handle slow-moving objects, the authors compute flow across multiple temporal "gaps" (e.g., $t \pm 2$) and average the features. This significantly stabilizes the discovery of objects that might be momentarily stationary.
  • Complementary Modalities: FlowI-SAM excels in scenarios where RGB is unreliable (e.g., camouflage), while FlowP-SAM provides the high-resolution detail inherent in RGB. Combining these models allows for robust performance across diverse video conditions.
Detailed architecture of FlowP-SAM featuring the Flow Prompt Generator and Flow Transformer.

Experimental Results

The models were evaluated on a comprehensive suite of benchmarks, including DAVIS2016, MoCA (Moving Camouflaged Animals), and YouTube-VOS2018-motion.

  • State-of-the-Art Performance: On the DAVIS16 benchmark, FlowI-SAM achieved a Jaccard index ($J$) of 79.4%, and the combined sequence-level model reached 87.7%. This represents a massive leap over previous unsupervised methods, which often hovered in the 60s or low 70s.
  • Camouflage Mastery: On the MoCA dataset, the motion-based approach achieved a success rate of 0.647, far surpassing previous specialized methods designed for camouflaged objects.
  • Simplicity and Efficiency: Despite using a frozen SAM backbone and relatively simple prompt generators, the method outperformed much more complex "object-centric" representation models that require elaborate training schemes.

Discussion and Future Work

While the results are state-of-the-art, the primary bottleneck remains the computational cost of SAM’s heavy ViT-H image encoder. Future iterations could utilize more efficient backbones like EfficientSAM or the recently released SAM2. Additionally, while temporal association is effective for short intervals, long-term occlusions (exceeding 10 frames) still pose a challenge. Finally, as an unsupervised motion-driven model, it occasionally struggles with ambiguous semantic definitions where motion boundaries do not align perfectly with human-annotated object boundaries (e.g., separating a rider from a bicycle).

Summary updated

Abstract

The objective of this paper is motion segmentation – discovering and segmenting the moving objects in a video. This is a much studied area with numerous careful, and sometimes complex, approaches and training schemes including: self-supervised learning, learning from synthetic datasets, object-centric representations, amodal representations, and many more. Our interest in this paper is to determine if the Segment Anything model (SAM) can contribute to this task.
BibTeX
@inproceedings{xie2024moving,
  author = {Junyu Xie and Charig Yang and Weidi Xie and Andrew Zisserman},
  title = {{Moving Object Segmentation: All You Need is SAM (and Flow)}},
  booktitle = {ACCV},
  year = {2024},
  url = {https://openreview.net/forum?id=Pxn12Jhvrq},
}
Figure