All models

mat_inpainting_512

A mask-aware transformer that fills large holes in images, combining attention with convolutions.

Diffusion and generative · 95 operations Checked

100%

Showing the top corner; full diagram not loaded yetShowing a small copy; full diagram not loaded yetLarge diagram, not loaded yet

Open SVG

Loading diagram (26 KB)

Open in a new tab

Click or tap a spot to read it up close. Scroll or drag inside the diagram to move through it. Zoom with + and − or Ctrl and scroll. Press 0 for the whole graph. Swipe inside the diagram to move through it. Use + and − to zoom.

At a glance

Parameters
57K
Operations
95
Framework
PyTorch
Recurrent
No
Published
CVPR (arXiv 2022)
Cited by
444 (as of 9 October 2026)
Authors
Wenbo Li, Zhe Lin, Kun Zhou and others
Checked
Passed: the trace was replayed operation by operation and matched the model's own output for this input.

Files

The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.

Details
Stable ID
m11965
Graph hash
516c17df54430cbc5b0b4cb3725d70698781dc3a5622500aef98f5cc024f62b2
Skeleton hash
f67f54808d29cd55f2cfd03349e8f11b9e60ca4511c5128a1cb1d243213c4a95
Architecture hash
8d2a15ac24a48c674fe7b286373f703f8f4c939a0be80d02cd10ce5bc3e3155f
Diagram SHA-256
8e26e8f75ce65663ac12e4d4c82f23cae456aec9222992dc3c8120f490a252eb
TorchLens version
2.35.3
Renderer
graphviz 2.43.0+pyvips 3.2.0+libvips 8.18.7+render-opts@06c1f0d3
Check
Forward pass replayed in PyTorch

How this diagram was made

menagerie.classics.mat_inpainting:build_mat_inpainting_512: build({})

What it is

MAT (Mask-Aware Transformer) is an image inpainting model: given an image with missing regions, it fills them with plausible content. It is aimed at large holes, and the paper describes it as a transformer-based inpainting system that processes high-resolution images directly, where earlier transformer methods inferred low-resolution predictions such as 32 × 32.

The architecture consists of a convolutional head, a transformer body, a convolutional tail and a style manipulation module. The head turns the masked image and its mask into feature maps at 1/8 of the input size, which serve as tokens. The body has five stages of transformer blocks whose attention, called multi-head contextual attention (MCA), computes non-local relations using only valid tokens, selected by a dynamic mask. That mask is initialized from the input mask and updated automatically as attention propagates. The transformer block is also changed to make training on large masks more stable: layer normalization is removed and residual learning is replaced by fusion learning with feature concatenation.

A Conv-U-Net then refines high-frequency details, and the style manipulation module modulates the weights of convolutions with a noise input so that the model can produce diverse completions of the same hole. The paper's experiments use the Places365-Standard and CelebA-HQ datasets at 512 × 512 resolution, with FID, P-IDS and U-IDS as metrics.

Key idea. MAT is a transformer-based model for large hole inpainting whose attention aggregates non-local information only from valid tokens, indicated by a dynamic mask.

  • mat
  • mask-aware transformer
  • mat inpainting
  • image inpainting
  • large hole inpainting
  • image completion
  • pluralistic inpainting
  • multi-head contextual attention

AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.

Cite the paper

@misc{li2022matmaskawaretransformerlarge,
      title={MAT: Mask-Aware Transformer for Large Hole Image Inpainting}, 
      author={Wenbo Li and Zhe Lin and Kun Zhou and Lu Qi and Yi Wang and Jiaya Jia},
      year={2022},
      eprint={2203.15270},
      archivePrefix={arXiv},
      primaryClass={cs.CV},
      url={https://arxiv.org/abs/2203.15270}, 
}