VMFormer: End-to-End Video Matting with Transformer

Jiachen Li, Vidit Goel, Marianna Ohanyan, Shant Navasardyan, Yunchao Wei, Humphrey Shi · OpenReview

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:

  1. 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.
  2. 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 detailed architecture of VMFormer, highlighting the Feature Modeling and Query Modeling branches along with the SFTM and LQTM modules.

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.
Qualitative comparison between VMFormer and existing state-of-the-art models (MODNet and RVM). VMFormer demonstrates superior detail preservation and temporal consistency.

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

Abstract

Video matting aims to predict the alpha mattes for each frame from a given input video sequence. Recent solutions to video matting have been dominated by deep convolutional neural networks (CNN) for the past few years, which have become the de-facto standard for both academia and industry. However, they have inbuilt inductive bias of locality and do not capture global characteristics of an image due to the CNN-based architectures. They also lack long-range temporal modeling considering computational costs when dealing with feature maps of multiple frames. In this paper, we propose VMFormer: a transformer-based end-to-end method for video matting. It makes predictions on alpha mattes of each frame from learnable queries given a video input sequence. Specifically, it leverages self-attention layers to build global integration of feature sequences with short-range temporal modeling on successive frames. We further apply queries to learn global representations through cross-attention in the transformer decoder with long-range temporal modeling upon all queries. In the prediction stage, both queries and corresponding feature maps are used to make the final prediction of alpha matte. Experiments show that VMFormer outperforms previous CNN-based video matting methods on the composited benchmarks. To our best knowledge, it is the first end-to-end video matting solution built upon a full vision transformer with predictions on the learnable queries. The project is open-sourced at https://chrisjuniorli.github.io/project/VMFormer/
BibTeX
@inproceedings{li2024vmformer,
  author = {Jiachen Li and Vidit Goel and Marianna Ohanyan and Shant Navasardyan and Yunchao Wei and Humphrey Shi},
  title = {{VMFormer: End-to-End Video Matting with Transformer}},
  booktitle = {IEEE/CVF Winter Conference on Applications of Computer Vision},
  year = {2024},
  url = {https://openreview.net/forum?id=tmgt5Ndksg},
}
Figure