Skip to main content
QUICK REVIEW

[Paper Review] MatteFormer: Transformer-Based Image Matting via Prior-Tokens

GyuTae Park, SungJoon Son|arXiv (Cornell University)|Mar 29, 2022
Image Enhancement TechniquesComputer Science6 citations
TL;DR

This paper proposes MatteFormer, a transformer-based image matting model that enhances performance by introducing prior-tokens—global representations of trimap regions (foreground, background, unknown)—which are integrated into the self-attention mechanism via a novel PAST block. The method achieves state-of-the-art results on Composition-1k and Distinctions-646 with a 23.80 SAD and 4.03 MSE on Composition-1k, significantly outperforming prior methods.

ABSTRACT

In this paper, we propose a transformer-based image matting model called MatteFormer, which takes full advantage of trimap information in the transformer block. Our method first introduces a prior-token which is a global representation of each trimap region (e.g. foreground, background and unknown). These prior-tokens are used as global priors and participate in the self-attention mechanism of each block. Each stage of the encoder is composed of PAST (Prior-Attentive Swin Transformer) block, which is based on the Swin Transformer block, but differs in a couple of aspects: 1) It has PA-WSA (Prior-Attentive Window Self-Attention) layer, performing self-attention not only with spatial-tokens but also with prior-tokens. 2) It has prior-memory which saves prior-tokens accumulatively from the previous blocks and transfers them to the next block. We evaluate our MatteFormer on the commonly used image matting datasets: Composition-1k and Distinctions-646. Experiment results show that our proposed method achieves state-of-the-art performance with a large margin. Our codes are available at https://github.com/webtoon/matteformer.

Motivation & Objective

  • To develop a transformer-based architecture for image matting that effectively leverages user-provided trimaps as global context.
  • To address the limitations of standard transformers in capturing global context for image matting by introducing prior-tokens derived from trimap regions.
  • To design a modified Swin Transformer block (PAST) that integrates prior-tokens into self-attention for improved feature representation.
  • To evaluate the effectiveness of prior-tokens, prior-memory, and the overall architecture on standard image matting benchmarks.

Proposed method

  • The method introduces prior-tokens as global context embeddings for each trimap region: foreground, background, and unknown, derived from the trimap input.
  • A new block called PAST (Prior-Attentive Swin Transformer) is proposed, which extends the Swin Transformer by adding PA-WSA (Prior-Attentive Window Self-Attention) that attends to both spatial-tokens and prior-tokens.
  • The prior-memory mechanism accumulates and carries forward prior-tokens from previous encoder blocks to subsequent blocks, enabling hierarchical global context integration.
  • The model uses a simple encoder-decoder architecture with skip connections, where trimap information is used to generate prior-tokens at each PAST block.
  • The method avoids using ASPP (Atrous Spatial Pyramid Pooling), as it is found to be redundant due to the inherent global receptive field of the transformer-based encoder.
  • The self-attention mechanism in PA-WSA computes attention over a concatenated set of spatial-tokens and prior-tokens, allowing local features to attend to global region-level priors.

Experimental results

Research questions

  • RQ1Can prior-tokens derived from trimap regions improve the performance of transformer-based image matting models?
  • RQ2How does integrating global prior information into the self-attention mechanism affect feature representation in image matting?
  • RQ3Does the prior-memory mechanism enhance the model’s ability to maintain and propagate global context across encoder stages?
  • RQ4Is ASPP beneficial in a transformer-based image matting model with inherently large receptive fields?
  • RQ5How does the proposed PAST block compare to standard Swin Transformer blocks in terms of attention dynamics and performance?

Key findings

  • MatteFormer achieves a state-of-the-art SAD of 23.80 and MSE of 4.03 on the Composition-1k dataset, significantly outperforming previous methods.
  • The ablation study shows that adding prior-tokens (especially unknown-region prior-tokens) reduces SAD by up to 2.63 points compared to the baseline without prior-tokens.
  • The prior-memory mechanism contributes to performance gains, with the full MatteFormer model achieving 23.80 SAD, compared to 24.19 SAD without prior-memory.
  • The model without ASPP outperforms the version with ASPP, indicating that ASPP is redundant in the transformer-based encoder due to its large inherent receptive field.
  • Visualization of attention maps confirms that prior-tokens, especially the unknown-region prior-token, are heavily attended to across multiple attention heads, indicating their informative role.
  • The model maintains a relatively low parameter count (44.8M) and FLOPs (57.2G), showing efficiency despite strong performance gains.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.