Abstract
Image matting is a fundamental task in computer vision that requires precise estimation of foreground opacity. Traditional methods rely heavily on manual trimaps, which are labor-intensive to produce. This paper presents HAttMatting (Hierarchical Attention Matting Network), an end-to-end framework designed to generate high-quality alpha mattes from a single RGB image without the need for manual intervention. By leveraging a dual-attention mechanism, the model effectively balances high-level semantic information with low-level texture details.
Introduction
The estimation of the alpha matte ($\alpha$) for a given image is an ill-posed problem, as it involves solving for seven unknowns (foreground and background RGB plus alpha) from only three known values per pixel. While trimap-based methods have dominated the field, their reliance on user-provided guidance limits their scalability. Automatic matting methods often fail to distinguish between foreground and background in complex scenes or lose fine-grained details like hair and fur.
The HAttMatting Framework
HAttMatting addresses these challenges through a hierarchical approach using a ResNeXt-101 backbone. The architecture is defined by two primary modules designed to "clean" and "combine" features across different scales:
Pyramidal Features Distillation (PFD)
High-level features provide the "what" of an image—identifying the object's semantic profile. However, standard semantic features often contain noise irrelevant to the matting task. The PFD module employs channel-wise attention to distill these features, selecting only the semantic attributes necessary for accurate alpha estimation.
Appearance Cues Filtration (ACF)
Low-level features capture the "where"—the intricate textures of edges and fine structures. These layers, however, are prone to background clutter. The ACF module uses spatial attention to filter out background noise, ensuring that only textures belonging to the foreground are preserved.
Training and Datasets
The model is trained using a hybrid loss function consisting of Mean Squared Error (MSE) for pixel accuracy, Structural Similarity (SSIM) for structural integrity, and an Adversarial Loss (PatchGAN) to enhance the realism of fine details.
To improve robustness, the authors introduced the Distinctions-646 dataset, which contains 646 unique foreground alpha mattes and approximately 60,000 training images. This dataset provides the diversity needed for the model to generalize across various real-world objects without requiring a trimap.
Key Results
HAttMatting establishes a new state-of-the-art for trimap-free image matting. Quantitatively, it achieves a Sum of Absolute Differences (SAD) of 44.01 and an MSE of 0.007 on the Adobe Composition-1k benchmark, significantly outperforming previous automatic methods like Late Fusion and SSS.
Qualitatively, the model excels at capturing sophisticated structures. As shown in the figure above, the network accurately extracts individual strands of fur and the delicate seeds of a dandelion, tasks that typically pose significant challenges for automatic matting algorithms. This efficiency makes it highly suitable for user-friendly applications like mobile photo editing.
Conclusion
HAttMatting demonstrates that high-quality, trimap-free matting is achievable by intelligently aggregating hierarchical features. While the model currently faces challenges with motion-blurred inputs—where the ACF module struggles to find clear textures—its ability to produce sharp, detailed mattes from single RGB images marks a significant step forward for practical applications in image editing and compositing.
Summary updated