NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Matting by Generation

Zhixiang Wang, Baiang Li, Jian Wang, Yu-Lun Liu, Jinwei Gu, Yung-Yu Chuang, Shin'ichi Satoh · DOI

Abstract

Image matting is traditionally framed as a regression problem, where models are trained to predict alpha values from RGB inputs. However, this approach is limited by the quality of human-annotated ground truths, which often lack fine-grained details. We present "Matting by Generation," a novel framework that treats matting as a conditional generative task. By leveraging the rich priors of pre-trained Latent Diffusion Models (LDM), our method produces high-fidelity alpha mattes that capture intricate details like individual hair strands, often surpassing the quality of manual annotations.

Introduction

Image matting—the precise extraction of a foreground object and its transparency (the alpha matte)—is a fundamental yet ill-posed problem in computer vision. With three unknowns (foreground color, background color, and opacity) for every pixel in a standard RGB image, the system is inherently under-determined.

Conventional regression-based models attempt to map pixels directly to alpha values. While effective to a degree, these models are constrained by their training data. Human-annotated "ground truth" labels are frequently imperfect, appearing blurry or missing fine structures. Consequently, regression models tend to overfit these errors, leading to "mushy" edges and artifacts, particularly in complex regions like hair or fur.

Methodology

Our approach shifts the paradigm from regression to conditional generative modeling. Instead of predicting a value, we task a diffusion model with generating a matte that is semantically and texturally consistent with the input image.

Latent Diffusion Prior

The core of our framework is built upon Stable Diffusion. By utilizing weights pre-trained on massive datasets, the model possesses a deep understanding of natural image boundaries and textures. This prior allows the model to "hallucinate" realistic details that may be missing or obscured in the training labels.

Dual-Path Inference

To maintain computational efficiency while processing high-resolution (HR) images, we implement a two-stage inference process:

  1. Low-Resolution (LR) Path: Generates a global, coarse alpha matte to establish the overall structure.
  2. High-Resolution (HR) Path: Uses the LR matte to identify regions of high uncertainty (typically boundaries). Patch-based diffusion is then applied specifically to these areas, ensuring fine-grained detail without the overhead of full-image HR processing.

Versatile Guidance

The model is highly flexible, supporting guidance-free operation or accepting various hints such as trimaps, coarse masks, scribbles, or text prompts (e.g., "extract the person"). This versatility allows for precise control in complex or crowded scenes.

Experimental Results

The proposed generative framework achieves state-of-the-art performance across several benchmarks, including P3M-10K and PPM-100.

Quantitative Performance

On the PPM-100 dataset, our model achieved a Sum of Absolute Differences (SAD) of 56.9, a significant improvement over previous leading models such as ViTAE-S (62.6) and P3M (93.3).

Qualitative Superiority

As shown in Figure 1, our method produces significantly "crisper" results compared to regression-based baselines. While models like ViTAE-S often produce "halo" artifacts or blurred edges around hair, our generative approach reconstructs distinct, fine strands. Remarkably, the generated matte often contains more realistic detail than the human-annotated ground truth, demonstrating the power of the diffusion prior to overcome "dirty" labels.

Qualitative comparison of Matting by Generation against ViTAE-S and human annotation. Note the superior detail in the hair region produced by our generative approach.

Discussion and Limitations

Beyond portrait matting, the model exhibits strong zero-shot generalization, successfully matting non-human subjects like animals despite being trained primarily on human data. This is attributed to the broad semantic knowledge inherent in the pre-trained Stable Diffusion weights.

However, challenges remain. The "diffusion tax" results in slower inference times—approximately 5 seconds for a 512x512 image on a V100 GPU. Additionally, frame-by-frame processing can lead to temporal flickering in video sequences. Future research will focus on model distillation for faster inference and the integration of temporal priors for video production.

Summary updated

BibTeX
@inproceedings{wang2024matting,
  author = {Zhixiang Wang and Baiang Li and Jian Wang and Yu-Lun Liu and Jinwei Gu and Yung-Yu Chuang and Shin'ichi Satoh},
  title = {{Matting by Generation}},
  booktitle = {SIGGRAPH (Conference Paper Track)},
  year = {2024},
  doi = {10.1145/3641519.3657519},
}
Figure