
vqgan_vqmodel_autoencoder
Diffusion and generative464 ops72.1M params
A convolutional autoencoder that turns an image into discrete codebook entries and reconstructs it.
Diffusion and generative · 464 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.
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.
About this model's family
VQGAN is a convolutional model that learns a codebook of visual parts, so that a transformer can then model how those parts compose into an image. The paper describes it as a variant of VQVAE that adds a discriminator and a perceptual loss to keep good perceptual quality at a higher compression rate.
It consists of a convolutional encoder and decoder that together represent an image with codes from a learned, discrete codebook. The quantization step is not differentiable, so a straight-through gradient estimator copies the gradients from the decoder to the encoder. A single attention layer at the lowest resolution aggregates context from the whole image. In training, the L2 reconstruction loss is replaced by a perceptual loss, and a patch-based discriminator learns to tell real images from reconstructed ones.
In the paper, a transformer is then trained on top of this autoencoder to predict the sequence of codebook indices one index at a time, which is how images are generated. The paper presents what it calls the first results on semantically-guided synthesis of megapixel images with transformers. For its class-conditional ImageNet model on 256 × 256 images, the paper uses a VQGAN with dim Z = 16384 and f = 16.
Key idea. The paper built VQGAN, a convolutional VQVAE variant trained with a discriminator and perceptual loss, whose learned codebook lets a transformer model high-resolution images.
AI-written summary, based on the paper and checked automatically against it; not reviewed by a person. Corrections welcome.
@misc{esser2021tamingtransformershighresolutionimage,
title={Taming Transformers for High-Resolution Image Synthesis},
author={Patrick Esser and Robin Rombach and Björn Ommer},
year={2021},
eprint={2012.09841},
archivePrefix={arXiv},
primaryClass={cs.CV},
url={https://arxiv.org/abs/2012.09841},
}