All models

zits_inpainting

Inpainting that first sketches edges and lines with a transformer, then paints textures with Fourier convolutions.

Diffusion and generative · 125 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 (20 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
865.1K
Operations
125
Framework
PyTorch
Recurrent
No
Published
CVPR (arXiv 2022)
Cited by
212 (as of 9 October 2026)
Authors
Qiaole Dong, Chenjie Cao, Yanwei Fu
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
m12258
Graph hash
fe75bb3ce22d96b78b1317fd01c4e055259f27d8cc39c4e0a096b18441f7444a
Skeleton hash
3be33544697df2dc52ec801d05b9696f6ac9e5884bb00863fa075edd253fca28
Architecture hash
465f79c06859a667531092e3b3233e9eab5122d763d2b8696caea453f348e321
Diagram SHA-256
c67d5df684beb184d82e7347a90f815c127fc9ffbc0b59bca17dcb64acc7106e
TorchLens version
2.36.0
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.zits_inpainting:build_zits_inpainting: build({})

What it is

ZITS, the ZeroRA based Incremental Transformer Structure inpainting framework, tackles a familiar failure of image inpainting: convolutional models produce plausible textures but lose the big structural lines of a scene. Its answer is an additional structure restorer that helps the inpainting model incrementally. A transformer restores holistic image structures in a fixed low-resolution sketch space, a grayscale space of edges and lines that is easy to upsample to larger sizes without losing structural information.

The system has four named parts: Masking Positional Encoding (MPE), the Transformer Structure Restorer (TSR), Fourier CNN Texture Restoration (FTR) and a Structure Feature Encoder (SFE). The TSR takes the masked image, canny edges, lines and the binary mask, and alternates axial attention blocks with standard attention blocks to balance performance and efficiency. The FTR is the inpainting backbone adopted from LaMa, an autoencoder whose key module is the Fast Fourier Convolution layer, with a local branch of ordinary convolutions and a global branch that convolves after a fast Fourier transform. Recovered edges and lines are encoded by gated convolutions in the SFE and added into the FTR through zero-initialized trainable residual weights, the ZeroRA trick, so that at the start of finetuning the output equals the pretrained model's and training stays stable.

The MPE addresses a problem the authors say no previous inpainting work had discussed explicitly: the absence of positional information inside masked regions. It encodes, for every masked pixel, a masking distance and a set of masking directions toward the nearest unmasked pixel, and both are added to the first layer of the FTR. The structure branch can be bolted onto an already trained inpainting model, and the paper reports gains over LaMa with only 50k finetuning steps.

Key idea. ZITS adds a transformer that restores edges and lines in a low-resolution sketch space to a pretrained Fourier-convolution inpainting network, fusing the structure incrementally through zero-initialized residual additions and a masking positional encoding for large irregular masks.

  • zits
  • zits inpainting
  • incremental transformer structure
  • image inpainting
  • masking positional encoding
  • transformer structure restorer
  • fourier cnn texture restoration
  • lama
  • sketch tensor space
  • edges and lines

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

Cite the paper

@misc{dong2022incrementaltransformerstructureenhanced,
      title={Incremental Transformer Structure Enhanced Image Inpainting with Masking Positional Encoding}, 
      author={Qiaole Dong and Chenjie Cao and Yanwei Fu},
      year={2022},
      eprint={2203.00867},
      archivePrefix={arXiv},
      primaryClass={cs.CV},
      url={https://arxiv.org/abs/2203.00867}, 
}