nadavbh12 / VQ-VAE

Minimalist implementation of VQ-VAE in Pytorch
BSD 3-Clause "New" or "Revised" License
499 stars 85 forks source link
deep-learning deep-neural-networks mnist pytorch vae vq-vae

CVAE and VQ-VAE

This is an implementation of the VQ-VAE (Vector Quantized Variational Autoencoder) and Convolutional Varational Autoencoder. from Neural Discrete representation learning for compressing MNIST and Cifar10. The code is based upon pytorch/examples/vae.

pip install -r requirements.txt
python main.py

requirements

Usage

# For example
python3 main.py --dataset=cifar10 --model=vqvae --data-dir=~/.datasets --epochs=3

Results

All images are taken from the test set. Top row is the original image. Bottom row is the reconstruction.

k - number of elements in the dictionary. d - dimension of elements in the dictionary (number of channels in bottleneck).

mnist

CIFAR10

imagenet

TODO:

Acknowledgement

tf-vaevae for a good reference.