Add model card, pipeline tag, and links to paper and code
#1
by nielsr HF Staff - opened
README.md
CHANGED
|
@@ -1,3 +1,66 @@
|
|
| 1 |
---
|
| 2 |
license: cc-by-nc-sa-4.0
|
|
|
|
| 3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
license: cc-by-nc-sa-4.0
|
| 3 |
+
pipeline_tag: image-segmentation
|
| 4 |
---
|
| 5 |
+
|
| 6 |
+
# SAM2Matting: Generalized Image and Video Matting
|
| 7 |
+
|
| 8 |
+
This repository contains the official checkpoints for **SAM2Matting**, a generalized matting framework that decouples high-level tracking from dedicated low-level matting to support robust image and video matting of any open-world targets.
|
| 9 |
+
|
| 10 |
+
[📄 Paper](https://huggingface.co/papers/2606.27339) | [🏠 Project Page](https://henghuiding.com/SAM2Matting/) | [💻 GitHub](https://github.com/FudanCVL/SAM2Matting)
|
| 11 |
+
|
| 12 |
+
<p align="center">
|
| 13 |
+
<img src="https://raw.githubusercontent.com/FudanCVL/SAM2Matting/main/assets/teaser.png" width="90%" alt="SAM2Matting qualitative results"/>
|
| 14 |
+
</p>
|
| 15 |
+
|
| 16 |
+
## Highlights
|
| 17 |
+
- **Decoupled design**: Combines a VOS tracker for temporal consistency with ROI Detection & Progressive Matting for fine details.
|
| 18 |
+
- **Image-only training, video SOTA**: Strong zero-shot video matting performance without requiring expensive video matting datasets.
|
| 19 |
+
- **Diverse prompts**: Supports masks, points, boxes, and text prompts.
|
| 20 |
+
- **Open-world generalization**: Robust matting for humans, animals, anime, translucent objects, and rapid-motion scenes.
|
| 21 |
+
|
| 22 |
+
## Installation
|
| 23 |
+
|
| 24 |
+
To run SAM2Matting locally, clone the repository and install the dependencies:
|
| 25 |
+
|
| 26 |
+
```bash
|
| 27 |
+
# clone the repo and enter directory
|
| 28 |
+
git clone https://github.com/FudanCVL/SAM2Matting.git
|
| 29 |
+
cd SAM2Matting
|
| 30 |
+
|
| 31 |
+
# create and activate conda environment
|
| 32 |
+
conda create -n sam2matting python=3.10 -y
|
| 33 |
+
conda activate sam2matting
|
| 34 |
+
|
| 35 |
+
# install required packages
|
| 36 |
+
pip install -r requirements.txt
|
| 37 |
+
```
|
| 38 |
+
|
| 39 |
+
## Quick Start
|
| 40 |
+
|
| 41 |
+
The codebase provides separate inference scripts for image and video matting.
|
| 42 |
+
|
| 43 |
+
To run video matting on a sample with SAM2-based trackers, run:
|
| 44 |
+
|
| 45 |
+
```bash
|
| 46 |
+
python inference_video_sam2.py --save_mp4
|
| 47 |
+
```
|
| 48 |
+
|
| 49 |
+
To enable compilation for faster execution (though the first run may be slower):
|
| 50 |
+
|
| 51 |
+
```bash
|
| 52 |
+
python inference_video_sam2.py --save_mp4 --compiled
|
| 53 |
+
```
|
| 54 |
+
|
| 55 |
+
## Citation
|
| 56 |
+
|
| 57 |
+
If you find SAM2Matting useful in your research, please consider citing the work:
|
| 58 |
+
|
| 59 |
+
```bibtex
|
| 60 |
+
@inproceedings{SAM2Matting,
|
| 61 |
+
title={{SAM2Matting}: Generalized Image and Video Matting},
|
| 62 |
+
author={Shen, Ruiqi and Jie, Guangquan and Liu, Chang and Ding, Henghui},
|
| 63 |
+
booktitle={European Conference on Computer Vision (ECCV)},
|
| 64 |
+
year={2026}
|
| 65 |
+
}
|
| 66 |
+
```
|