Alpha Matte Generation from Single Input for Portrait Matting

Dogucan Yaman, Hazim Kemal Ekenel, Alexander WaibelWorkshops @ CVPR 2022 · DOI

Introduction

Image matting is the process of precisely separating a foreground subject from its background, accounting for semi-transparent pixels like wisps of hair or sheer clothing. Traditionally, this is a "constrained" problem requiring a trimap (a hand-drawn map labeling pixels as foreground, background, or unknown) or a background image (a shot of the scene without the subject).

However, creating trimaps is tedious, and having a clean background shot is often impossible in "in-the-wild" photography. While "single-input" matting exists, it often struggles with two primary issues: sensitivity to complex backgrounds and "feature vanishing," where subtle details of a coarse segmentation mask are lost when processed alongside raw image data in deep neural networks.

Methodology

The authors propose a two-stage pipeline based on a Conditional Generative Adversarial Network (cGAN) that requires only a single RGB image.

The two-stage GAN-based architecture featuring dual encoders and a refinement block.

Dual-Encoder Architecture

The core innovation lies in the use of two separate encoders to prevent feature vanishing:

  • Content Encoding Block: Processes the raw RGB image to extract visual features.
  • Segmentation Encoding Block: Processes a combination of a coarse mask (generated by DeepLabv3+) and the extracted foreground. This provides the network with dedicated spatial guidance.

Refinement and Loss Functions

To handle the finest details, a Refinement Block processes 64x64 patches specifically along the subject's borders. The model is trained using a suite of targeted loss functions, including Border Loss for edge precision and Alpha Coefficient Loss to evaluate semi-transparent pixels separately from solid regions. A multi-scale discriminator ensures both global consistency and fine-grained detail.

Datasets and Training

The model was trained and evaluated using several high-quality matting datasets:

  • Adobe Image Matting (AIM) and Distinctions (D646) for diverse subjects.
  • PhotoMatte85 (PM85) and PPM-100 for evaluation on real-world images with natural backgrounds.

For training, subjects were composited onto backgrounds from MSCOCO, while PASCAL VOC backgrounds were utilized for testing.

Key Results

The proposed method significantly outperformed existing single-input state-of-the-art (SOTA) models both quantitatively and qualitatively.

Qualitative results from the MGM baseline, which the proposed model outperforms in fine detail.
  • Quantitative Performance: On the PM85 dataset, the model achieved a Mean Squared Error (MSE) of 0.19, a substantial improvement over MODNet (2.32) and MGM (0.38).
  • User Study: In a study with 30 participants, the model’s results were rated "Much Better" than MODNet's in 41.55% of cases.
  • Robustness: Unlike background-matting models that require static scenes, this framework remains stable in dynamic environments because it relies solely on the current frame.

Conclusion and Future Work

While the framework achieves SOTA results for single-input matting, it remains dependent on the quality of the initial coarse segmentation. Furthermore, the use of consecutive residual blocks prevents the model from achieving real-time performance. Future research will focus on optimizing the architecture for speed and extending the framework to handle sequential video data for improved temporal consistency.

Summary updated

BibTeX
@inproceedings{yaman2022alpha,
  author = {Dogucan Yaman and Hazim Kemal Ekenel and Alexander Waibel},
  title = {{Alpha Matte Generation from Single Input for Portrait Matting}},
  booktitle = {Workshops @ CVPR},
  year = {2022},
  doi = {10.1109/cvprw56347.2022.00085},
}
Figure