All models

vqfr

Blind face restoration that swaps degraded latents for high-quality VQ codes, then warps them to fit the input.

Diffusion and generative · 41 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 (41 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
110.6K
Operations
41
Framework
PyTorch
Recurrent
No
Published
Lecture Notes in Computer Science (arXiv 2022)
Authors
Yuchao Gu, Xintao Wang, Liangbin Xie 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
m12219
Graph hash
c8025098b0e49f340be099d0d51daed4f0f7dbe37e25858454a461b56f1cba82
Skeleton hash
f71ec771a1fe8151c50b3856b319185421874e6f05277a5370a4f8f183e56106
Architecture hash
196fbdc592a51e5d30b26f6dd779a9f554a9bc6fa8254076579f7d1e5dc34b4c
Diagram SHA-256
375678ba4f25a808295aff2d293af243b2531d2b318422ae319dad820e6b579b
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.vqfr:build_vqfr: build({})

What it is

VQFR is a blind face restoration network, where the job is to recover a low-quality face whose degradations, such as noise, blur or down-sampling, are unknown. GAN-prior methods give decent overall quality at first glance but miss fine hair and delicate facial components. Instead VQFR borrows from dictionary-based methods: a vector-quantized codebook learned from high-quality faces serves as a feature bank for every facial region, not just a few components.

The pipeline is an encoder, a pretrained high-quality codebook and a parallel decoder. The codebook is first learned from high-quality faces only, with a VQGAN-style encoder-decoder. At restoration time each latent vector of the degraded face is replaced by its nearest code, which strips degradation because the codebook has almost no degradation-related codes. The crucial knob is the compression patch size f, how large an image patch one code stands for: a larger f gives better visual quality but worse fidelity, and the authors settle on f = 32 for 512 × 512 inputs. Even so, expression and identity can drift, and naively fusing input features into the decoder contaminates the clean details. Hence the parallel decoder: a texture decoder sees only the quantized codes, while the main decoder warps the texture features to match the degraded input. The warping is done by a texture warping module built on deformable convolution, with offsets predicted from the concatenated texture and input features. Training combines a pixel loss, a code alignment loss that pulls the degraded face's codes toward the clean face's codes, a perceptual loss and an adversarial loss. A PatchGAN local discriminator is added alongside the global one; with only the global discriminator, regular patterns appear on skin and hair.

The network has six resolution levels and quantizes at the coarsest, f = 32. The full model has 76.3M parameters and takes 0.36 s on a 512-square image on an A100. It is trained on the 70,000 high-quality faces of FFHQ. Evaluation follows GFP-GAN on synthetic CelebA-Test and the real-world LFW-Test, CelebChild and WebPhoto-Test. On CelebA-Test it posts the lowest LPIPS and the best FID and NIQE, a large improvement over GFP-GAN. The authors flag that extreme poses restore poorly because the codebook was built mostly from frontal faces. Extremely uninformative faces also fail, since, as the authors put it, VQFR does not build upon a generative model.

Key idea. VQFR uses a vector-quantized codebook of high-quality facial detail as a dictionary and a parallel texture-and-main decoder joined by deformable warping, improving restored facial detail while keeping fidelity.

  • VQFR
  • vector-quantized face restoration
  • blind face restoration
  • VQ codebook
  • facial detail dictionary
  • parallel decoder
  • texture warping module
  • deformable convolution
  • VQGAN
  • GFP-GAN
  • FFHQ
  • face restoration

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

Cite the paper

@misc{gu2022vqfrblindfacerestoration,
      title={VQFR: Blind Face Restoration with Vector-Quantized Dictionary and Parallel Decoder}, 
      author={Yuchao Gu and Xintao Wang and Liangbin Xie and Chao Dong and Gen Li and Ying Shan and Ming-Ming Cheng},
      year={2022},
      eprint={2205.06803},
      archivePrefix={arXiv},
      primaryClass={cs.CV},
      url={https://arxiv.org/abs/2205.06803}, 
}