图2:VQ-VAE将特征编码为离散特征 在DDPM中,我们从一个随机高斯噪声还原图像,那么能不能从VQ-VAE得到的离散特征中进行还原呢,LDM就是这么做的。 1.3 VQ-GAN VQ-GAN[5]是一个改良版的VQ-VAE,相对于VQ-VAE,它做了3点改进,如图3: 因为CNN的局部特性无法捕捉较远像素之间的依赖关系,因此VQ-GAN使用了Transforme...
vqvae.decode(latents).sample image = torch.clamp(image, -1.0, 1.0) image = image / 2 + 0.5 image = image.cpu().permute(0, 2, 3, 1).numpy() Stable Diffusion SD v1 架构 参考hugging face diffuser 的 SD pipeline 实现。以 stable-diffusion-v1-5 为例。 Text Encoder 采用CLIPText...
避免潜在空间具有任意的高方差,采用了2种不同的正则化: KL正则化:对学习到的潜在表示施加轻微的 KL 惩罚,使其趋向于标准正态分布(类似VAE) VQ正则化:在解码器中使用向量量化层 3.2:Latent Diffusion Models Diffusion Models 扩散模型:通过逐步对正态分布变量去噪,学习数据分布 p(x),对应学习固定长度为 T 的马...
解码器采用Spatial Transformer,以初始帧和离散化的Latent Action Tokens作为输入。 Latent Action Tokens通过VQ-VAE的方式进行量化处理。 Latent Planner负责预测这些离散的Latent Action Tokens,它与VLM 主干网络共享相同的 Transformer 结构,但使用了两套独立的FFN(前馈神经网络)和Q/K/V/O(查询、键、值、输出)投影矩...
The latent space encoded by pre-trained VQVAE is diffused into Gaussian noise and a Unet model was used to denoise the latent space concatenated with the condition latent variable encoded by the condition encoder. During sampling, we utilize the denoising diffusion implicit model (DDIM) ...
The same encoder and decoder architectures from the VQ-VAE paper are used and their implementations are from https://github.com/nadavbh12/VQ-VAE. The encoder is a stack of a downsampling convolution block (Conv2d – BatchNorm2d – GELU – Dropout) and a subsequent residual block (GELU –...
Doing so, we turn the publicly available, state- of-the-art text-to-image LDM Stable Diffusion into an ef- ficient and expressive text-to-video model with resolution up to 1280 × 2048. We show that the temporal layers trained in this way gener...
The first variant, KL-reg., imposes a slight KL-penalty to- wards a standard normal on the learned latent, similar to a VAE [45, 67], whereas VQ-reg. uses a vector quantization layer [93] within the decoder. This model can be interpreted as a VQGAN [23] ...
(2019). Generating diverse high-fidelity images with vq-vae-2. In: NeurIPS Rombach, R., Blattmann, A., Lorenz, D., et al. (2022). High-resolution image synthesis with latent diffusion models. In: CVPR, pp 10684–10695 Ronneberger, O., Fischer, P., & Brox, T. (2015). U-...
之后,MAGE 对其进行随机掩码,并使用基于 transformer 的 encoder-decoder 结构对掩码进行重构,重构后的语义符可以通过 VQGAN 解码器生成原始图像。通过在训练中使用不同的掩码率,MAGE 可以同时进行生成模型(接近 100% 掩码率)和表征学习(50%-80% 掩码率)的训练。如图 1 所示,MAGE 重建出的图像不仅具有与原始图像...