SAM2Matting: Generalized Image and Video Matting

TL;DR

SAM2Matting leverages pre-trained VOS trackers (e.g., SAM2, SAM3) with region proposal and multi-scale alpha refinement, achieving state-of-the-art zero-shot video and image matting performance.

cs.CV 🔴 Advanced 2026-06-26 78 views
Ruiqi Shen Guangquan Jie Chang Liu Henghui Ding
image matting video matting tracker-to-matting deep learning high-fidelity details

Key Findings

Methodology

This paper introduces SAM2Matting, a decoupled framework that integrates pre-trained Video Object Segmentation (VOS) trackers such as SAM2 and SAM3 with dedicated low-level matting modules. The core architecture involves an ROI detector that combines multi-scale image features, VOS mask priors, and raw image cues to identify regions requiring fine-grained alpha estimation. A progressive alpha predictor then refines the alpha matte through a multi-scale cascade, supervised at each stage with L1, Laplacian, and matte-mask consistency losses. The training is performed solely on image datasets, leveraging rich image matting data, which enables the model to generalize effectively to video scenarios without additional video-specific annotations. The framework maintains high temporal consistency by freezing the tracker and focusing training on the matting components, resulting in a robust, efficient pipeline capable of supporting diverse prompts including masks, points, boxes, and text.

Key Results

  • On zero-shot video matting benchmarks V-HIM60 and Video-Matte, SAM2Matting achieves MAD scores of 11.77 and 13.76 respectively, outperforming recent state-of-the-art methods such as MatAnyone2 and MaGGIe. The dtSSD metric, indicating temporal consistency, is also significantly improved, demonstrating the model’s ability to produce stable, high-fidelity results in challenging dynamic scenes.
  • In image matting benchmarks like P3M-500-NP and AM-2K, SAM2Matting variants outperform existing methods, with MAD values as low as 0.97 and MSE reductions, confirming its superior detail recovery capability. Ablation studies highlight the effectiveness of ROI detection and multi-scale refinement strategies, with speed reaching 40 FPS on 1080p videos, making it practical for real-world applications.
  • Extensive qualitative evaluations show that SAM2Matting preserves intricate hair strands, semi-transparencies, and target attachments across diverse scenarios, including in-the-wild sequences with complex backgrounds and rapid motion. The model demonstrates excellent generalization, robustness, and efficiency, validating its potential for broad deployment.

Significance

This work addresses the longstanding challenge of achieving high-quality, generalizable video matting without reliance on costly, narrowly scoped datasets. By decoupling high-level tracking from low-level detail estimation, SAM2Matting offers a scalable solution that leverages abundant image data, significantly reducing annotation costs. Its zero-shot performance across human-centric and natural scenes paves the way for practical applications in film editing, virtual backgrounds, augmented reality, and content creation. The approach also opens new avenues for integrating large-scale pre-trained trackers with specialized low-level modules, fostering innovation in video understanding and synthesis.

Technical Contribution

The main technical contributions include: 1) a decoupled tracker-to-matting architecture that preserves tracking robustness while enabling detailed alpha refinement; 2) a novel ROI detector that fuses multi-source priors to accurately locate regions needing fine details; 3) a multi-scale cascade refinement process with comprehensive supervision and consistency constraints, ensuring high-fidelity alpha matte generation. These innovations collectively enable the model to outperform existing methods in both accuracy and efficiency, even in zero-shot settings.

Novelty

This research is the first to effectively integrate pre-trained VOS trackers into a high-fidelity video matting pipeline through a decoupled, multi-component architecture. Unlike prior end-to-end methods that struggle with generalization and detail preservation, SAM2Matting leverages the strengths of large-scale tracking models and image matting datasets, introducing a region proposal and progressive refinement strategy that significantly advances the state of the art in zero-shot video and image matting.

Limitations

  • Despite its robustness, the model may still struggle with extremely fast or complex motions where ROI detection fails to precisely localize fine details, leading to minor artifacts.
  • Training relies solely on image data, which, while effective, may limit performance in scenarios with unusual lighting, transparency, or highly dynamic backgrounds without further fine-tuning.
  • Computational costs, though optimized, remain non-trivial for ultra-high-resolution videos or real-time applications, necessitating further efficiency improvements.

Future Work

Future research will explore multi-modal prompts, such as text and audio cues, to guide the matting process more flexibly. Additionally, integrating self-supervised learning techniques could enhance adaptation to unseen scenarios. Extending the framework to multi-object and multi-class settings, as well as optimizing for real-time deployment on edge devices, are promising directions. Combining generative models for scene synthesis and editing could further expand the application scope, making high-quality, zero-shot video editing accessible across industries.

AI Executive Summary

In recent years, the demand for high-fidelity image and video editing has surged, driven by applications in film production, virtual reality, and social media content creation. Central to these applications is the task of image and video matting—precisely extracting foreground objects from complex backgrounds at the pixel level. While significant progress has been made in image matting through deep learning models like GFM, MODNet, and context-aware networks, extending these techniques to videos remains a formidable challenge.

Video matting requires not only accurate spatial details but also temporal consistency across frames. Traditional approaches often rely on explicit target annotations, such as trimaps or initial masks, which are labor-intensive to produce and limit scalability. Moreover, existing datasets for video matting are expensive to annotate, predominantly human-centric, and lack diversity, restricting models' ability to generalize to real-world scenarios with complex backgrounds, fast motions, and semi-transparent objects.

To address these issues, the authors propose SAM2Matting, a novel framework that decouples high-level tracking from low-level detail estimation. By leveraging pre-trained VOS trackers like SAM2 and SAM3, the system maintains robust temporal coherence. A dedicated ROI detector, combining multi-scale features and priors from the tracker, accurately identifies regions requiring fine-grained alpha estimation. The core innovation lies in a progressive, multi-scale alpha predictor that refines the matte iteratively, supervised at each stage with carefully designed loss functions, including matte-mask consistency and smoothness constraints.

Remarkably, SAM2Matting is trained solely on image datasets, yet it achieves state-of-the-art performance in zero-shot video matting benchmarks such as V-HIM60 and Video-Matte. Quantitative results show MAD scores of 11.77 and 13.76, outperforming recent methods like MatAnyone2 and MaGGIe. The dtSSD metric, reflecting temporal stability, also surpasses prior approaches, confirming the model’s ability to produce stable, high-quality results in dynamic scenes.

In image matting tasks, SAM2Matting variants outperform existing algorithms, with MAD as low as 0.97 and significant reductions in MSE, demonstrating its capacity for detailed and accurate foreground extraction. Ablation studies validate the effectiveness of ROI detection, multi-scale cascade refinement, and supervision strategies, highlighting the importance of each component.

The broader impact of this work is substantial. It offers a scalable, resource-efficient solution that reduces reliance on costly video annotations, enabling high-quality, real-time applications across industries. Its generalization to diverse scenarios—including natural environments, fast-moving targets, and complex backgrounds—opens new horizons for virtual content creation, film post-production, and augmented reality.

Despite these advances, challenges remain. The model can still face difficulties with extremely rapid motions or highly complex scenes, and further improvements in efficiency and multi-object handling are needed. Future directions include integrating multi-modal prompts, self-supervised learning, and scene synthesis techniques to push the boundaries of zero-shot, high-fidelity video matting even further.

Deep Analysis

Background

图像抠图作为计算机视觉的基础任务,旨在从复杂背景中提取目标前景。早期方法如基于Trimap的深度网络(如DeepMatting、Context-Aware Matting)通过引入先验信息显著提升了精度,但对用户交互依赖较大。自动抠图方法(如MODNet、GFM)试图实现无提示抠图,但在复杂场景中表现仍有限。视频抠图则面临目标追踪与细节还原的双重挑战,传统方法多依赖昂贵的标注数据,且泛化能力不足。近年来,基于深度学习的VOS模型如STM、AOT提供了强大的目标追踪能力,但难以直接应用于高质量抠图。大规模视频抠图数据集(如V-HIM、VideoMatte)虽推动了研究,但标注成本高,限制了模型的泛化。综上,现有技术在追踪鲁棒性、细节还原和数据依赖方面仍有明显不足,亟需新的解决方案。

Core Problem

核心问题在于如何在保持目标追踪鲁棒性的同时,实现极致的细节还原。传统端到端模型在追踪和抠图的联合优化中难以兼顾两者,导致在复杂背景或快速运动场景中表现不佳。高质量视频抠图需要大量标注数据,成本高昂且难以扩展。此外,现有方法对不同场景的适应性不足,特别是在非人类目标或自然环境中表现有限。如何在减少标注依赖的同时,提升模型的泛化能力和细节还原能力,成为亟待解决的难题。

Innovation

本研究的创新点主要体现在:1)提出SAM2Matting的解耦架构,将高层次的目标追踪与低层次的细节抠图分离,利用预训练追踪器保持鲁棒性;2)设计ROI检测器,结合多源先验信息(如VOS掩码、多尺度特征)精准识别细节区域,避免规则化操作的局限;3)引入逐步细化的多尺度Alpha预测机制,通过多层监督确保细节恢复的高保真。相比传统端到端模型,这一架构显著降低了对标注数据的依赖,提高了泛化能力,同时实现了高效的推理速度。

Methodology

  • �� 追踪器输入:视频帧,输出目标掩码,保持时间一致性。
  • �� ROI检测器:结合多尺度特征、VOS掩码和图像信息,采用卷积层预测ROI logits,利用层次融合生成最终ROI区域。
  • �� 伪Trimap生成:基于ROI区域和目标掩码,构建像素级的伪Trimap,为Alpha估计提供空间先验。
  • �� 逐步细化:多尺度级联结构,输入包括图像特征、伪Trimap、上一尺度预测的Alpha,逐层优化Alpha值。
  • �� 损失设计:ROI检测器采用焦点损失和光滑L1损失,Alpha预测结合L1、Laplacian和一致性损失,确保边界平滑和细节还原。
  • �� 训练策略:冻结追踪器,仅训练抠图组件,利用丰富的图像抠图数据实现高质量训练,模型在多个数据集上进行验证。

Experiments

采用多源图像抠图数据集(如P3M-500-NP、AM-2K)进行训练,验证模型在不同场景下的泛化能力。测试基准包括视频抠图V-HIM60、Video-Matte,采用MAD、MSE、Grad、Conn、dtSSD等指标,进行零样本评估。对比多项SOTA方法,进行消融实验验证ROI检测器、逐步细化和监督策略的有效性。模型在不同VOS追踪器(SAM2.1-Tiny、SAM2.1-Base+、SAM3)上实现,确保架构的通用性和效率。实验还包括速度测试(达40FPS)和资源消耗分析,验证其实用性。

Results

在视频抠图基准V-HIM60和Video-Matte上,SAM2Matting的MAD值分别为11.77和13.76,优于现有方法,dtSSD指标也表现优异,显示出强大的时间一致性和细节还原能力。在图像抠图任务中,MAD最低至0.97,MSE显著降低,优于传统方法。消融实验显示ROI检测器优于形态学或掩码直接方法,逐步细化策略提升了边界平滑和细节还原。模型在复杂背景和快速运动场景中表现稳定,验证了其强泛化能力。

Applications

该方法适用于虚拟背景、影视特效、增强现实等行业,尤其在需要高精度、低延迟的场景中表现出色。用户只需提供目标提示(如掩码、点、框或文本),即可实现高质量抠图,减少人工标注成本。未来,结合多模态提示和自监督学习,有望实现更智能的场景理解与交互,推动虚拟内容生成和实时视频编辑的发展。

Limitations & Outlook

模型在极端快速运动或极端复杂背景下仍可能出现细节丢失或边界模糊,受限于ROI检测器的识别能力。训练仅依赖图像数据,虽然泛化良好,但在某些特殊材质或光照条件下仍需微调。对于超高分辨率或大规模视频,计算资源消耗较大,未来需优化算法效率和模型结构。此外,模型在多目标场景中的表现仍有提升空间,需结合多目标检测和多任务学习进一步增强鲁棒性。

Plain Language Accessible to non-experts

想象你在一个工厂里工作,工厂里有很多不同的机器和工人。每个工人都在做自己的事情,但有时候需要找到某个特定的工人或者机器,特别是在繁忙的环境中。传统的方法就像用放大镜盯着每个工人,试图找到目标,但这样很慢,而且容易出错。

现在,这个新方法像是给工厂配备了智能的监控系统,它可以自动追踪目标工人,识别出需要特别关注的区域,然后用更细的放大镜逐步观察这些区域,确保每个细节都清楚。这套系统只需要事先看过一些普通的工厂照片,就能在实际工作中表现得很好,即使环境复杂、目标快速移动,也能准确找到目标的细节。

这就像你在玩一个追踪游戏,系统帮你锁定目标区域,然后逐步放大,直到你能看到目标的发梢、每一片叶子。这种方法不仅快,还非常准确,能在各种复杂场景中工作,比如人群中、自然环境里,甚至在夜晚或光线变化大的情况下都能表现出色。这为未来的视频编辑、虚拟现实和电影制作带来了极大的便利。

Abstract

Despite impressive advances in image matting, video matting remains challenging due to the inherent gap between high-level tracking, which requires frame-wise understanding, and low-level matting, which focuses on extremely fine-grained details. Existing methods attempt this with expensive and narrowly-scoped video matting datasets, which may limit out-of-domain generalization and compromise tracking robustness. We rethink the paradigm with SAM2Matting, a tracker-to-matting framework that advances VOS trackers to high-fidelity video matting. Specifically, it decouples the task by enhancing a foundational tracker (e.g., SAM2, SAM3) with a region-proposal bridge and dedicated matting heads, enabling the uncompromised tracker to handle temporal consistency while the matting components resolve fine-grained details. Notably, despite being trained only on images, SAM2Matting establishes new state-of-the-art performance on video matting, supports diverse prompt types, maintains strong temporal consistency, and demonstrates robust generalization across both human-centric and in-the-wild scenarios.

cs.CV

References (20)

Tripartite Information Mining and Integration for Image Matting

Yuhao Liu, Jiake Xie, Xiaosong Shi et al.

2021 67 citations ⭐ Influential

MatAnyone: Stable Video Matting with Consistent Memory Propagation

Peiqing Yang, Shangchen Zhou, Jixin Zhao et al.

2025 22 citations ⭐ Influential View Analysis →

Real-Time High-Resolution Background Matting

Shanchuan Lin, Andrey Ryabtsev, Soumyadip Sengupta et al.

2020 301 citations ⭐ Influential View Analysis →

Matting Anything

Jiacheng Li, Jitesh Jain, Humphrey Shi

2023 44 citations ⭐ Influential View Analysis →

Mask-Guided Matting in the Wild

Kwanyong Park, Sanghyun Woo, Seoung Wug Oh et al.

2023 22 citations ⭐ Influential

MaGGIe: Masked Guided Gradual Human Instance Matting

Chuong Huynh, Seoung Wug Oh, Abhinav Shrivastava et al.

2024 20 citations ⭐ Influential View Analysis →

MatAnyone 2: Scaling Video Matting via a Learned Quality Evaluator

Peiqing Yang, Shangchen Zhou, Kai Hao et al.

2025 5 citations ⭐ Influential View Analysis →

Context-Aware Image Matting for Simultaneous Foreground and Alpha Estimation

Qiqi Hou, Feng Liu

2019 173 citations ⭐ Influential View Analysis →

SAM 3: Segment Anything with Concepts

Nicolas Carion, Laura Gustafson, Yuan-Ting Hu et al.

2025 531 citations ⭐ Influential View Analysis →

Privacy-Preserving Portrait Matting

Jizhizi Li, Sihan Ma, Jing Zhang et al.

2021 92 citations ⭐ Influential View Analysis →

Enabling Trimap-Free Image Matting With a Frequency-Guided Saliency-Aware Network via Joint Learning

Linhui Dai, Xiangjun Song, Xiaohong Liu et al.

2023 6 citations ⭐ Influential

Improved Image Matting via Real-time User Clicks and Uncertainty Estimation

Tianyi Wei, Dongdong Chen, Wenbo Zhou et al.

2020 40 citations ⭐ Influential View Analysis →

End-to-end Video Matting with Trimap Propagation

Wei-Lun Huang, Ming-Sui Lee

2023 16 citations ⭐ Influential

Robust High-Resolution Video Matting with Temporal Guidance

Shanchuan Lin, Linjie Yang, Imran Saleemi et al.

2021 211 citations ⭐ Influential View Analysis →

Diffusion for Natural Image Matting

Yihan Hu, Yiheng Lin, Wei Wang et al.

2023 23 citations ⭐ Influential View Analysis →

VideoMaMa: Mask-Guided Video Matting via Generative Prior

Sangbeom Lim, Seoung Wug Oh, Jiahui Huang et al.

2026 2 citations View Analysis →

Matte Anything: Interactive Natural Image Matting with Segment Anything Models

J. Yao, Xinggang Wang, Lang Ye et al.

2023 69 citations View Analysis →

Deep Video Matting via Spatio-Temporal Alignment and Aggregation

Yanan Sun, Guanzhi Wang, Qiao Gu et al.

2021 71 citations View Analysis →

Object-Aware Video Matting with Cross-Frame Guidance

Huayu Zhang, Dongyue Wu, Yuanjie Shao et al.

2025 2 citations View Analysis →

MODNet: Real-Time Trimap-Free Portrait Matting via Objective Decomposition

Zhanghan Ke, Jiayu Sun, Kaican Li et al.

2020 226 citations View Analysis →