All models

TFill

A two-stage image completion model: a transformer infers the missing content, then a second network refines it.

Diffusion and generative · 3,258 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

This diagram has 3,258 operations (28 KB) and is drawn when you ask.

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
109.4M
Operations
3,258
Framework
PyTorch
Recurrent
No
Published
CVPR 2022
Cited by
119 (as of 26 October 2026)
Authors
Chuanxia Zheng, Tat-Jen Cham, Jianfei Cai, Dinh Phung
License
MIT
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
m20786
Graph hash
7415a12eeeeaea1c5cd3b07816e2d0db1c30ef1fe2f53fb60189e276a4ab701b
Skeleton hash
0ef9b39bae49ef8c40b1d8521eb7dec0bd4e5d3556f5331092654179eafb3d96
Architecture hash
7e1a50213924f2b6a39fe63bbc6bce95f7de687436607afa01e35b61ebbbe677
Diagram SHA-256
c1ed5e197381625f483b7acd5434f85cc8798cc1123d61aa1cfa35e6f144388c
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

What it is

TFill is an image completion model: given a masked image, it infers reasonable content for the missing regions and fills them with realistic appearance. The paper treats completion as a directionless sequence-to-sequence prediction task and uses a transformer encoder to model long-range dependence. Its argument is that earlier methods built on deep or large receptive field convolutions cannot escape the dominance of nearby interactions.

The model has two stages. The content inference network, TFill-Coarse, turns the image into tokens with a restrictive CNN whose receptive fields are small and do not overlap, so each token represents only the visible information in a local patch. A weighted self-attention layer then scales the attention scores by a weight that starts as the fraction of visible pixels in the patch. A CNN-based decoder predicts all tokens in one step instead of one by one. The appearance refinement network, TFill-Refined, is trained on high-resolution images and uses an attention-aware layer (AAL) to copy long-range information from both encoded and decoded features.

Because the position embedding has a fixed length and attention is costly, the coarse stage first downsamples images of arbitrary size to a fixed size. The paper evaluates TFill with arbitrary mask types on CelebAHQ, FFHQ, Places2 and ImageNet.

Key idea. TFill treats image completion as a directionless sequence-to-sequence task, using a restrictive CNN for token representation and a transformer encoder to model long-range visible context.

  • tfill
  • image completion
  • image inpainting
  • transformer inpainting
  • high-fidelity image completion
  • bridging global context interactions
  • object removal
  • large mask inpainting

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

Cite the paper

@misc{zheng2021bridgingglobalcontextinteractions,
      title={Bridging Global Context Interactions for High-Fidelity Image Completion}, 
      author={Chuanxia Zheng and Tat-Jen Cham and Jianfei Cai and Dinh Phung},
      year={2021},
      eprint={2104.00845},
      archivePrefix={arXiv},
      primaryClass={cs.CV},
      url={https://arxiv.org/abs/2104.00845}, 
}