Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
B

BackgroundMattingV2

> 编程语言
Open source

Real-Time High-Resolution Background Matting

7.2K stars0 likes1 views
WebsiteGitHub

About

Real-Time High-Resolution Background Matting

Real-Time High-Resolution Background Matting

Official repository for the paper Real-Time High-Resolution Background Matting. Our model requires capturing an additional background image and produces state-of-the-art matting results at 4K 30fps and HD 60fps on an Nvidia RTX 2080 TI GPU.

  • Visit project site
  • Watch project video

Disclaimer: The video conversion script in this repo is not meant be real-time. Our research's main contribution is the neural architecture for high resolution refinement and the new matting datasets. The inference_speed_test.py script allows you to measure the tensor throughput of our model, which should achieve real-time. The inference_video.py script allows you to test your video on our model, but the video encoding and decoding is done without hardware acceleration and parallization. For production use, you are expected to do additional engineering for hardware encoding/decoding and loading frames to GPU in parallel. For more architecture detail, please refer to our paper.

 

New Paper is Out!

Check out Robust Video Matting! Our new method does not require pre-captured backgrounds, and can inference at even faster speed!

 

Overview

  • Updates
  • Download
    • Model / Weights
    • Video / Image Examples
    • Datasets
  • Demo
    • Scripts
    • Notebooks
  • Usage / Documentation
  • Training
  • Project members
  • License

 

Updates

  • [Jun 21 2021] Paper received CVPR 2021 Best Student Paper Honorable Mention.
  • [Apr 21 2021] VideoMatte240K dataset is now published.
  • [Mar 06 2021] Training script is published.
  • [Feb 28 2021] Paper is accepted to CVPR 2021.
  • [Jan 09 2021] PhotoMatte85 dataset is now published.
  • [Dec 21 2020] We updated our project to MIT License, which permits commercial use.

 

Download

Model / Weights

  • Download model / weights (GitHub)
  • Download model / weights (GDrive)

Video / Image Examples

  • HD videos (by Sengupta et al.) (Our model is more robust on HD footage)
  • 4K videos and images

Datasets

  • Download datasets

 

Demo

Scripts

We provide several scripts in this repo for you to experiment with our model. More detailed instructions are included in the files.

  • inference_images.py: Perform matting on a directory of images.
  • inference_video.py: Perform matting on a video.
  • inference_webcam.py: An interactive matting demo using your webcam.

Notebooks

Additionally, you can try our notebooks in Google Colab for performing matting on images and videos.

  • Image matting (Colab)
  • Video matting (Colab)

Virtual Camera

We provide a demo application that pipes webcam video through our model and outputs to a virtual camera. The script only works on Linux system and can be used in Zoom meetings. For more information, checkout:

  • Webcam plugin

 

Usage / Documentation

You can run our model using PyTorch, TorchScript, TensorFlow, and ONNX. For detail about using our model, please check out the Usage / Documentation page.

 

Training

Configure data_path.pth to point to your dataset. The original paper uses train_base.pth to train only the base model till convergence then use train_refine.pth to train the entire network end-to-end. More details are specified in the paper.

 

Project members

  • Shanchuan Lin*, University of Washington
  • Andrey Ryabtsev*, University of Washington
  • Soumyadip Sengupta, University of Washington
  • Brian Curless, University of Washington
  • Steve Seitz, University of Washington
  • Ira Kemelmacher-Shlizerman, University of Washington

* Equal contribution.

 

License

This work is licensed under the MIT License. If you use our work in your project, we would love you to include an acknowledgement and fill out our survey.

Community Projects

Projects developed by third-party developers.

  • After Effects Plug-In

Issues· 47 open

View all issuesOpen on GitHub
  • #216

    Verify evals on Papers with Code

    Updated Sep 14, 2026
  • #202

    inference_video.py:IndexError: Idx: 0 out of length: 1

    Updated Jun 26, 2025
  • #212

    自己实际场景的情况下,如何微调模型?

    Updated Nov 14, 2024
  • #211

    I have only one GPU , when I running train_refine.py, Show error: RuntimeError: Distributed package doesn't have NCCL built in

    Updated Nov 12, 2024
  • #111

    Questions about training

    Updated Jun 14, 2024
  • #203

    train_refine.py运行一段时间过后就会卡死不动

    Updated Jun 13, 2024
  • #209

    Please confirm the commands to reproduce all four stages.

    Updated Jun 12, 2024
  • #207

    请问V2版本resnet怎么转成onnx模型?

    Updated Feb 22, 2024
  • #206

    About align_corners setting?

    Updated Jan 3, 2024
  • #107

    可以加微信吗?作者求加入啊

    Updated Oct 10, 2023

> Tags

Pythoncomputer-visionmachine-learningmattingreal-time

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 22, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言