TransMatting: Enhancing Transparent Objects Matting with Transformers

Huanqia Cai, Fanglei Xue, Lele Xu, Lili GuoECCV 2022

Abstract

Image matting for transparent objects presents a unique challenge due to the lack of solid foreground information. Traditional CNN-based methods often fail because of their limited receptive fields. We present TransMatting, a Transformer-based architecture that utilizes a Tri-token Guided Transformer Block (TGTB) to capture global dependencies. Combined with a new high-resolution dataset, Transparent-460, TransMatting achieves state-of-the-art performance in extracting complex transparent foregrounds.

Introduction: The Challenge of Transparency

Image matting aims to estimate the alpha matte ($\alpha$) to separate foreground ($F$) from background ($B$) in an image ($I$), following the equation $I = \alpha F + (1-\alpha)B$. While standard matting techniques perform well on solid objects using trimaps, they struggle with transparent objects like glass or smoke.

Transparent objects often lack "known foreground" regions in a trimap. Convolutional Neural Networks (CNNs) are hindered by their local receptive fields, making it difficult to correlate distant known pixels with unknown transparent areas. As image resolution increases, this locality problem intensifies, leaving models unable to grasp the global context necessary for accurate matting.

Methodology

TransMatting addresses these limitations by integrating the local feature extraction of CNNs with the global modeling capabilities of Vision Transformers (ViT).

The TransMatting architecture combines a CNN local extractor with a series of Tri-token Guided Transformer Blocks (TGTB) and a Multi-scale Global-guided Fusion (MGF) decoder.

Tri-token Guided Transformer Block (TGTB)

Rather than simply concatenating the trimap as an additional input channel, TransMatting introduces tri-tokens. The trimap is represented as three learnable tokens corresponding to foreground, background, and unknown regions. These tokens are integrated directly into the Transformer's self-attention mechanism, allowing the model to learn complex relationships between different trimap regions and image features more effectively.

Multi-scale Global-guided Fusion (MGF)

The decoder utilizes the MGF module to fuse low-level appearance features (texture) with high-level semantic features (shape). By employing a "non-background mask," the module filters out background noise, ensuring that only relevant foreground information is propagated.

Hybrid Encoder

The architecture uses the initial stages of a ResNet-34 as a CNN Local Extractor for fine details, followed by a stack of TGTB modules to model long-range dependencies across the entire image.

Datasets and the Transparent-460 Benchmark

The model was evaluated on standard benchmarks including Composition-1k, Distinction-646, and AIM-500. However, recognizing a deficiency in high-quality data for purely transparent objects, the authors introduced Transparent-460. This dataset contains 460 high-resolution images (averaging $3820 \times 3766$) of objects like water drops and glassware, specifically targeting "Transparent Totally" (TT) cases where the foreground is almost entirely unknown.

Key Results

TransMatting consistently outperforms existing state-of-the-art methods such as IndexNet, GCAMatting, and MGMatting.

Quantitative results showing TransMatting's superior performance in MSE and SAD metrics, particularly for 'Transparent Totally' (TT) objects.

On the Composition-1k dataset, TransMatting achieved a Mean Squared Error (MSE) of 4.58 and a Sum of Absolute Differences (SAD) of 24.96. On the challenging Transparent-460 dataset, it reached an MSE of 4.02, significantly outperforming IndexNet (112.53). Qualitative analysis confirms that TransMatting excels at capturing fine, misty edges and subtle internal textures that other models typically blur.

Discussion and Conclusion

The success of TransMatting highlights that global connectivity is essential for matting transparent objects. By treating trimap regions as learnable tokens, the model harmonizes multi-modal data more effectively than simple stacking.

While TransMatting sets a new benchmark, it faces challenges regarding computational overhead due to the Transformer architecture. Future work may involve developing "trimap-free" versions or optimizing the model for real-time performance on high-resolution images. Additionally, the difficulty of manual labeling for transparent objects remains a bottleneck for scaling training data.

Summary updated

BibTeX
@inproceedings{cai2022transmatting,
  author = {Huanqia Cai and Fanglei Xue and Lele Xu and Lili Guo},
  title = {{TransMatting: Enhancing Transparent Objects Matting with Transformers}},
  booktitle = {European Conference on Computer Vision},
  year = {2022},
  doi = {10.1007/978-3-031-19818-2\_15},
}
Figure