Abstract
Natural image matting is an important problem in computer vision and graphics. It is an ill-posed problem when only an input image is available without any external information. While the recent deep learning approaches have shown promising results, they only estimate the alpha matte. This paper presents a context-aware natural image matting method for simultaneous foreground and alpha matte estimation. Our method employs two encoder networks to extract essential information for matting. Particularly, we use a matting encoder to learn local features and a context encoder to obtain more global context information. We concatenate the outputs from these two encoders and feed them into decoder networks to simultaneously estimate the foreground and alpha matte. To train this whole deep neural network, we employ both the standard Laplacian loss and the feature loss: the former helps to achieve high numerical performance while the latter leads to more perceptually plausible results. We also report several data augmentation strategies that greatly improve the network's generalization performance. Our qualitative and quantitative experiments show that our method enables high-quality matting for a single natural image.
Introduction
Image matting is the process of precisely extracting a foreground object from an image by estimating an "alpha matte" (a per-pixel opacity map). Even with a user-provided "trimap"—a rough outline of the foreground, background, and unknown regions—it is a highly ill-posed problem because the true foreground and background colors in the blended regions are unknown.
While recent deep learning approaches have made significant strides in estimating high-quality alpha mattes, they typically stop there. They output the alpha map but do not estimate the actual foreground image colors, leaving a critical gap for downstream tasks like image compositing. This paper tackles the complete problem: simultaneously estimating both the alpha matte and the foreground image from a single natural image and its trimap.
Methodology
The authors propose a fully convolutional network with a unique two-encoder-two-decoder architecture, inspired by traditional hybrid matting methods that combine local propagation with global sampling.
Dual Encoders and Decoders
- Dual Encoders: A matting encoder (a modified Xception 65) captures fine, local structural details like individual strands of hair. A parallel context encoder captures broader global context to help the network disambiguate visually similar foreground and background regions.
- Dual Decoders: The features from both encoders are concatenated and fed into two separate decoders: one dedicated to generating the alpha map and one for the foreground image.
Training and Augmentation
The network is trained using a combination of a Laplacian loss for numerical accuracy and a feature/perceptual loss (using a pre-trained VGG16) to ensure the composited results look visually plausible.
To prevent the network from relying on hidden artifacts in synthetically composited training images—a phenomenon the authors call "synthetic bias"—they introduce specialized augmentations like Re-JPEGing and Gaussian blurring. These techniques destroy artificial clues like mismatched noise profiles, forcing the network to learn actual image semantics and drastically improving real-world generalization.
Experimental Results
The proposed method was evaluated on the Composition-1k dataset and a real-world matting dataset.
Quantitative Performance
- Alpha Estimation: On the Composition-1k test set, the model achieved a Sum of Absolute Differences (SAD) of 35.8, significantly outperforming previous state-of-the-art methods like Deep Matting (SAD: 50.4).
- Foreground Estimation: The model significantly outperformed traditional methods in foreground color recovery, achieving a SAD of 61.72 compared to Global Matting's 220.39.
User Study
In a blind study with 42 participants evaluating 31 real-world images, the proposed method was preferred over Deep Matting 77.67% of the time. It notably eliminated the "color bleeding" problem where background colors contaminate the extracted foreground.
Discussion and Conclusion
While the method achieves high-quality results, it still relies on a user-provided trimap to define general foreground/background areas. Furthermore, there is a persistent trade-off: optimizing for the best perceptual quality (using feature loss) can slightly degrade standard numerical metrics like SAD and MSE. Future work may involve moving toward fully automatic, trimap-free matting using similar context-aware architectures to further balance perceptual and numerical performance.
Summary updated