Abstract
Video matting is a critical task in computer vision that requires high-precision transparency estimation for foreground objects. Traditional Convolutional Neural Network (CNN) approaches often struggle with global context and long-range temporal consistency. We present VMFormer, the first end-to-end video matting framework built entirely on a Vision Transformer architecture. By leveraging learnable queries and a dual-track temporal modeling strategy, VMFormer outperforms existing CNN-based models in both accuracy and temporal stability while maintaining real-time inference speeds of approximately 109 FPS.
Introduction
Video matting involves estimating the alpha matte of foreground objects to enable seamless background replacement. This task is significantly more challenging than standard segmentation due to the need for pixel-level precision in semi-transparent regions such as hair, smoke, or motion blur.
Existing methods predominantly rely on CNNs, which face two primary limitations: locality bias and temporal complexity. CNNs process images in small local neighborhoods, making it difficult to capture global context, especially in cases of color obfuscation where the subject and background share similar appearances. Furthermore, ensuring temporal consistency usually requires computationally expensive 3D convolutions or complex recurrent structures that struggle with long-range dependencies.
Methods
VMFormer shifts the paradigm from local convolutions to a Transformer-based query system. The architecture is divided into two synergistic branches:
- Feature Modeling Branch: A MobileNetV3 backbone extracts initial features, which are then processed by a Transformer Encoder to build global spatial representations. To ensure smooth transitions between frames, the Short-range Feature-based Temporal Modeling (SFTM) module uses recurrent aggregation to pass information between successive frames.
- Query Modeling Branch: Inspired by detection transformers, VMFormer utilizes a set of learnable queries that interact with feature maps via cross-attention in a Transformer Decoder. To handle long-range consistency, the Long-range Query-based Temporal Modeling (LQTM) module is introduced. Because queries are computationally lighter than full feature maps, modeling temporal relationships here is both efficient and effective.
The final alpha matte is generated through a simple matrix multiplication between the refined queries and high-resolution feature maps.
Key Results
VMFormer was evaluated on high-quality benchmarks including VideoMatte240K and ImageMatte. The model sets a new state-of-the-art for trimap-free video matting:
- Accuracy: On the VideoMatte240K benchmark (512x288), VMFormer achieved a Mean Absolute Difference (MAD) of 4.91, significantly outperforming RVM (5.99) and MODNet (10.39).
- Temporal Consistency: The model demonstrated lower Connectivity (Conn) and Gradient (Grad) errors, indicating fewer flickering artifacts and smoother transitions over time.
- Qualitative Performance: As shown in comparative visualizations, VMFormer excels at preserving fine details and distinguishing foreground from background in complex scenes where previous models fail.
Conclusion
VMFormer demonstrates that Transformer-based architectures can effectively solve the challenges of video matting by prioritizing global context and efficient temporal modeling. While current training is limited by GPU memory constraints to 5-frame sequences, the LQTM module provides a robust foundation for long-range consistency. Future research will explore more efficient attention mechanisms to handle higher resolutions natively and potentially remove the need for a CNN backbone entirely.
Summary updated