# PeterL1n/BackgroundMattingV2

Real-Time High-Resolution Background Matting

Repository: https://github.com/PeterL1n/BackgroundMattingV2
Canonical: https://ross.abutalabs.com/products/backgroundmattingv2
Language: Python
License: MIT
License Family: permissive
Topics: computer-vision, machine-learning, matting, real-time
Last push: 2024-06-19T12:28:16+00:00

## Health v2 (maintenance only)
Score: 23/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 0, release rhythm 8, longevity 100
- inputs: {"age_days": 2102, "days_push": 805, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 7189, forks 959 (observed 2026-08-28T04:09:56.517339+00:00)

## What it is
Official PyTorch implementation of the CVPR 2021 paper 'Real-Time High-Resolution Background Matting'. It produces state-of-the-art alpha mattes for humans at 4K 30fps / HD 60fps on an Nvidia GPU, given a pre-captured background image, and includes pretrained weights, datasets, and training scripts.

## Use cases
- remove video background without a green screen
- real-time virtual background replacement for webcam
- extract alpha matte of a person from a photo
- segment human hair and fine details at 4K resolution
- train a matting model on VideoMatte240K
- benchmark matting inference speed on GPU

## When to choose
- you can capture a clean background plate of the scene
- you need high-resolution (HD/4K) real-time matting on an Nvidia GPU
- you want a research-grade model with pretrained weights and training code under MIT license

## When to avoid
- you cannot capture the background image beforehand - use Robust Video Matting instead
- you need a turnkey production pipeline with hardware-accelerated video encoding out of the box
- you have no CUDA-capable GPU

## Facets
- artifact type: library
- maturity: stable
- function: computer-vision, image-processing, video-processing, machine-learning, deep-learning
- domain: computer-vision, image-processing, machine-learning, deep-learning
- platform: python, cross-platform
- tags: background-matting, alpha-matting, green-screen, pytorch, real-time, cvpr-2021, video-matting, pretrained-models, video, gpu, linux

## Member repositories
- PeterL1n/BackgroundMattingV2 (main) score 23

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:09:56.517339+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-29T17:39:53.939306+00:00, confidence not recorded.
  - readme: https://github.com/PeterL1n/BackgroundMattingV2 (fetched 2026-08-28T04:09:56.517339+00:00, sha 60efc03ec959)
- Data as of 2026-08-30T08:39:29.467469+00:00.
