A collection of variational autoencoder models, e.g. VAE, CVAE, InfoVAE, MMDVAE in Tensorflow.
- Command 1:
python train.py vae_name train
- Command 2:
python train.py vae_name generate
- Command 3:
python train.py vae_name generate path/to/image
Note: Generated samples will be stored in images/{vae_model}/
directory during training.
The following papers are just examples on how to use the implemented variational autoencoders.
We did not mean to implement what have been described in each paper.
- VAE: Vanilla Variational AutoEncoder
- CVAE: Conditional Variational AutoEncoder
- Learning Structured Output Representation using Deep Conditional Generative Models, 2016
- An Uncertain Future: Forecasting from Static Images using Variational Autoencoders, 2016
- InfoVAE: Information Variational Autoencoder
- MMDVAE: Maximum-Mean Discrepancy Variational AutoEncoder
Model | Loss Function |
---|---|
VAE | |
CVAE | |
InfoVAE | |
MMDVAE |
The following results can be reproduced with command:
python train.py vae_name train
Note: 1st and 3rd rows represent the ground truth whereas the 2nd and 4th rows are the generated ones.
Name | Epoch 1 | Epoch 15 | Epoch 30 |
---|---|---|---|
VAE | |||
CVAE |
Name | Epoch 1 | Epoch 2 | Epoch 3 |
---|---|---|---|
InfoVAE | |||
MMDVAE |
- Install miniconda https://docs.conda.io/en/latest/miniconda.html
- Create an environment
conda create --name autoencoder
- Activate the environment
source activate autoencoder
- Install [Tensorflow]
conda install -c conda-forge tensorflow
- Install [Opencv]
conda install -c conda-forge opencv
- Install [sklearn]
conda install -c anaconda scikit-learn
- Install [matplotlib]
conda install -c conda-forge matplotlib
If you wanna try new dataset, please make sure you make it in the following way:
- Dataset_main_directory If you wanna try new dataset, please make sure you make it in the following way:
- Dataset_main_directory
- train_data
- category_1: (image1, image2, ...)
- category_2: (image1, image2, ...)
- ...
- test_data
- category_1: (image1, image2, ...)
- category_2: (image1, image2, ...)
- ...
- train_data
The loader.py
file will automatically upload all images and their labels (category_i folders)
This implementation has been based on the work of the great following repositories: