codeformer_vqgan
A Transformer that restores degraded face photos by predicting entries of a learned codebook.
Diffusion and generative · 96 operations Checked
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
- 83.6K
- Operations
- 96
- Framework
- PyTorch
- Recurrent
- No
- Published
- NeurIPS (arXiv 2022)
- Authors
- Shangchen Zhou, Kelvin C. K. Chan, Chongyi Li, Chen Change Loy
- Checked
- Passed: the trace was replayed operation by operation and matched the model's own output for this input.
Files
The file opened in a new tab. Use your browser's Save command there to keep it.
The diagram is a drawing of a TorchLens trace of the source code. It contains no code or weights.
Details
- Stable ID
- m11753
- Graph hash
- a0e3182696088d1acf0dc9c9ec3d6be07dbc2ef11ffc16e717c9e5cf8544da70
- Skeleton hash
- 721c43308b1d1694efcd94820833207640393a3fe66549d08afd877bd9f0c507
- Architecture hash
- 8efb22398a1d5229ab608866d779547ee07f065664a7f5322399e3abcebe55fd
- Diagram SHA-256
- d37b95a140fca409abe150189955b973887e69b8b6300c2a2e7f72a05d085ff3
- 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.codeformer_vqgan:build_codeformer_vqgan: build({}) What it is
CodeFormer is a Transformer-based network for blind face restoration: it reads the whole low-quality face and predicts a sequence of codes for it. The paper casts blind face restoration as a code prediction task in a small finite proxy space of a learned discrete codebook. That codebook is learned first, by having a vector-quantized autoencoder reconstruct high-quality faces.
Looking up codes by nearest-neighbor matching usually fails on low-quality faces, because their textures are corrupted. The authors therefore insert a Transformer module of nine self-attention blocks after the encoder to predict the code sequence. The predicted codes retrieve items from the learned codebook, and the fixed decoder turns them into the restored face. An optional controllable feature transformation module passes low-quality encoder features to the decoder, and a scalar weight w sets the balance between quality and fidelity.
The paper sets the codebook to 1024 items, which it finds sufficient for accurate face reconstruction. A 512 × 512 face image becomes a 16 × 16 code sequence. The paper also introduces WIDER-Test, a set of 970 severely degraded faces collected from the WIDER-Face dataset. The authors note that the method does poorly on side faces, which are few in the FFHQ training dataset.
Key idea. The paper shows that casting blind face restoration as code prediction over a learned discrete codebook reduces the uncertainty of the restoration mapping.
- CodeFormer
- codebook lookup transformer
- blind face restoration
- face restoration
- discrete codebook prior
- vector-quantized autoencoder
- code prediction
- face inpainting
AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.
Cite the paper
@misc{zhou2022robustblindfacerestoration,
title={Towards Robust Blind Face Restoration with Codebook Lookup Transformer},
author={Shangchen Zhou and Kelvin C. K. Chan and Chongyi Li and Chen Change Loy},
year={2022},
eprint={2206.11253},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/2206.11253},
}