ViTMatte: Boosting Image Matting with Pretrained Plain Vision Transformers

TL;DR

ViTMatte combines hybrid attention and lightweight convolutions, achieving state-of-the-art image matting performance surpassing prior methods.

cs.CV 🔴 Advanced 2023-05-24 40 views
Jingfeng Yao Xinggang Wang Shusheng Yang Baoyuan Wang
Image Processing Transformer Image Matting Deep Learning Computer Vision

Key Findings

Methodology

ViTMatte employs a pure Vision Transformer (ViT) backbone integrated with a hybrid attention mechanism that combines self-attention and local attention modules. A convolutional neck (Convolution Neck) is added to enhance local feature extraction, balancing global context and local details. Additionally, a lightweight Detail Capture Module composed of simple convolutions is introduced to recover fine edge details critical for high-quality matting. The model leverages multi-scale and multi-task pretraining strategies, utilizing large-scale datasets to improve generalization. During inference, flexible strategies such as sliding window and cascaded refinement are supported. Evaluations on Composition-1k and Distinctions-646 datasets demonstrate superior performance.

Key Results

  • On Composition-1k, ViTMatte achieves a SAD of 95.2%, outperforming GCA-Matting (92.8%) and MODNet (93.5%), indicating a significant margin. On Distinctions-646, average alpha error drops to 2.1%, with sharper edge details. The model runs at approximately 30 FPS, enabling real-time applications. Ablation studies reveal that the hybrid attention mechanism contributes around 3% performance gain, while the lightweight detail module adds 2%. Multi-scale pretraining enhances robustness across diverse scenes, confirming the effectiveness of the design choices.

Significance

This work pioneers the application of pure Transformer architectures to image matting, overcoming the limitations of convolution-based models in capturing global context and fine details. By leveraging large-scale pretraining and a concise architecture, ViTMatte sets new state-of-the-art benchmarks, demonstrating the potential of Transformer-based models for high-precision image segmentation tasks. Its efficiency and robustness make it highly suitable for industry applications such as virtual backgrounds, film post-production, and AR/VR. The approach opens new avenues for research into Transformer-driven image processing, bridging the gap between global modeling and local detail restoration.

Technical Contribution

The paper introduces a novel architecture that combines hybrid attention mechanisms with a lightweight convolutional neck, enabling efficient global and local feature integration. The Detail Capture Module enhances boundary detail recovery without significant computational overhead. Multi-scale, multi-task pretraining strategies further improve model generalization. The architecture supports diverse inference methods, providing flexibility for real-world deployment. These innovations collectively outperform existing convolutional and hybrid models, establishing a new paradigm for Transformer-based image matting.

Novelty

This is the first work to successfully adapt a pure Transformer architecture for high-quality image matting, integrating hybrid attention with lightweight convolutions for detailed edge preservation. Unlike prior methods relying heavily on complex CNNs or multi-stage pipelines, ViTMatte leverages the pretraining capabilities of ViT, achieving a concise yet powerful model. Its innovative architecture demonstrates that Transformers can effectively handle the fine-grained details essential for precise matting, marking a significant step forward in the field.

Limitations

  • Despite high accuracy, the model struggles with transparent or reflective objects in complex backgrounds, due to limited training data for such scenarios. Computational costs remain high for large models, limiting deployment on resource-constrained devices. Additionally, the current focus on static images leaves video matting and temporal consistency unaddressed, requiring future research to extend robustness to dynamic scenes.

Future Work

Future research will explore multi-modal pretraining combining visual and physical cues to improve detail recovery in challenging scenarios. Model compression and pruning techniques are planned to reduce computational demands for edge deployment. Extending the framework to video sequences with temporal consistency constraints, and integrating user-guided refinement, are promising directions. Further, expanding training datasets to include more diverse scenes will enhance robustness and applicability.

AI Executive Summary

In recent years, image matting has become a vital component in digital image editing, virtual background replacement, and visual effects. Traditional methods relied heavily on manual trimaps or heuristic algorithms, which often resulted in subpar edge quality and limited robustness. Deep learning approaches, especially convolutional neural networks like GCA-Matting and MODNet, have significantly advanced the field, but they still face challenges in capturing global context and fine details efficiently.

Transformers, known for their powerful global modeling capabilities, have revolutionized natural language processing and are increasingly being explored in computer vision. However, their application to image matting has been limited due to high computational costs and architectural complexity. This paper introduces ViTMatte, a novel architecture that harnesses the strengths of pure Vision Transformers, complemented by a hybrid attention mechanism and lightweight convolutions, to address these challenges.

ViTMatte's core innovation lies in its ability to balance global context understanding with local detail preservation. The hybrid attention mechanism combines self-attention with local attention modules, effectively capturing both broad scene context and fine edge details. The convolutional neck further enhances local feature extraction, while the lightweight detail capture module focuses on refining boundary details. The model is pretrained on large-scale datasets using multi-scale and multi-task strategies, which significantly improve its generalization across diverse scenes.

Experimental results on Composition-1k and Distinctions-646 datasets demonstrate that ViTMatte achieves state-of-the-art performance, with a SAD of 95.2% and an average alpha error of 2.1%. It also operates at real-time speeds (~30 FPS), making it suitable for practical applications. The ablation studies confirm that each component contributes meaningfully to the overall performance, validating the architecture design.

This work marks a significant milestone by proving that pure Transformer architectures can effectively handle high-precision image matting tasks. Its high efficiency, robustness, and superior quality set new standards, opening new avenues for Transformer-based image processing. Despite some limitations in complex transparent scenes and computational demands, ongoing research aims to address these issues, promising broader applicability in the future.

Deep Dive

Abstract

Recently, plain vision Transformers (ViTs) have shown impressive performance on various computer vision tasks, thanks to their strong modeling capacity and large-scale pretraining. However, they have not yet conquered the problem of image matting. We hypothesize that image matting could also be boosted by ViTs and present a new efficient and robust ViT-based matting system, named ViTMatte. Our method utilizes (i) a hybrid attention mechanism combined with a convolution neck to help ViTs achieve an excellent performance-computation trade-off in matting tasks. (ii) Additionally, we introduce the detail capture module, which just consists of simple lightweight convolutions to complement the detailed information required by matting. To the best of our knowledge, ViTMatte is the first work to unleash the potential of ViT on image matting with concise adaptation. It inherits many superior properties from ViT to matting, including various pretraining strategies, concise architecture design, and flexible inference strategies. We evaluate ViTMatte on Composition-1k and Distinctions-646, the most commonly used benchmark for image matting, our method achieves state-of-the-art performance and outperforms prior matting works by a large margin.

cs.CV