Abstract Image matting is a fundamental computer vision problem with numerous applications. Traditional algorithms often struggle when foreground and background colors are similar or when textures are highly complex, primarily due to a reliance on low-level features and a lack of high-level context. This paper introduces a novel deep learning-based algorithm to address these challenges. The proposed model consists of two parts: a deep convolutional encoder-decoder network that predicts an initial alpha matte from an image and a trimap, followed by a small refinement network that sharpens edges and improves alpha accuracy. To support this approach, we created a large-scale image matting dataset with 49,300 training and 1,000 testing images. Experimental results on benchmarks and real-world images demonstrate that our algorithm significantly outperforms previous state-of-the-art methods.
Introduction: The Challenge of Image Matting
Image matting involves the precise extraction of a foreground object from an image, particularly in semi-transparent regions like hair, fur, or glass. Mathematically, this is an ill-posed problem. For every pixel, we observe a color $C$, which is a linear combination of foreground color $F$ and background color $B$, weighted by an opacity value $\alpha$:
$$C = \alpha F + (1 - \alpha)B$$
With only three known values (the RGB channels of $C$), we must solve for seven unknowns ($F$, $B$, and $\alpha$). Historically, algorithms relied on low-level color heuristics, assuming that foreground and background colors were distinct. These methods fail in complex scenarios—such as a blonde person against a yellow wall—leading to "smearing" or "chunky" artifacts. Furthermore, progress was hindered by a lack of data; the standard benchmark at the time contained only 27 training images.
Proposed Method: A Two-Stage Deep Network
The authors propose the first end-to-end deep learning approach to image matting, moving beyond traditional color-based heuristics.
1. Matting Encoder-Decoder Stage
The first stage is a "heavy lifter" network that takes a 4-channel input: the RGB image and a user-provided "trimap" (indicating known foreground, known background, and unknown regions). The encoder, based on VGG-16, extracts high-level semantic features, while the decoder predicts the initial alpha matte. To ensure the network follows physical principles, the authors introduced two novel loss functions: alpha-prediction loss (direct difference) and compositional loss (measuring the difference between the original image and one recomposed using the predicted alpha).
2. Matting Refinement Stage
Because encoder-decoder architectures can produce slightly blurry results due to downsampling, a second, smaller fully convolutional network (FCN) is employed. This stage takes the original image and the first stage's prediction to "sharpen" edges and fine-tune the alpha values.
Data: Scaling Up for Deep Learning
The lack of data was a major hurdle. To solve this, the authors created a massive dataset using a compositing approach. They manually matted 493 unique foreground objects (e.g., hair, lace, smoke) and composited them onto 100 different backgrounds from the MS COCO and Pascal VOC datasets. This resulted in 49,300 training images, a massive leap from previous benchmarks.
Key Insights and Results
By using a deep network, the model learns the structure of objects like hair or fur. It understands the "context" of what a strand of hair looks like against a blurry background, rather than just looking at pixel colors.
The results were transformative:
- Benchmark Dominance: The method ranked 1st on the alphamatting.com benchmark across all major metrics (SAD, MSE, Gradient, and Connectivity).
- Quantitative Gains: On the new Composition-1k dataset, the proposed method achieved a Sum of Absolute Differences (SAD) of 50.4, compared to 113.9 for the best previous non-deep learning method—a more than 50% improvement.
- Real-World Generalization: Despite being trained on synthetic composites, the model generalizes exceptionally well to real photos, as seen in high-quality composites.
Conclusion and Future Work
While this work represents a significant leap forward, it still relies on a "trimap" input. While more robust to imperfect trimaps than previous methods, it is not yet fully automatic. Future work could involve matching lighting and noise during the compositing process to further improve training data quality, or developing methods that eliminate the need for a trimap entirely.
Summary updated