Representation Learning of Image Data with VAE. Alexander Piehler, Moritz Wagner
This Github Repository is developed by Moritz Wagner and Alexander Piehler in collaboration with Adidas. This project stresses the suitability of Variational Autoencoders for representation learning of image data. The main goal was to establish a codebase that allows for reproducing and tracking experiments via mlflow. The world of Variational Autoencoders is quite large and therefore, we restricted ourselves to the ones we believed that would perform best. To further benchmark, we also included PCA and Autoencoders. The following models were considered:
├── VAE
├── beta-VAE
├── InfoVAE
├── GaussMixVAE
├── DIP-VAE
├── PCA
├── Autoencoder
For each model, we found some valid hyperparameter configurations that can be considered in the folder configs/
.
This framework is structured as follows:
├── configs
├── data
├── experiments
├── library
├── playground
Contains the config files for each model depending on the chosen data set.
In this folder, you find all relevant python scripts to download and preprocess the data for running the models.
Contains the scripts for running all relevant experiments. To run them in the right order, follow these steps:
To run them first change into the directory accordingly: cd experiments
python seed_running.py
python latent_experiment.py
python epochs_experiment.py
python kld_weight_experiment.py
python latent_experiment.py
python tune_models.py
python run_best_configurations.py
python deep_dive.py
This is the package for this repository, it stores all functions and (model) classes that are used. The package contains different modules
├── models2
├── architectures.py
├── eval_helpers.py
├── evaluator.py
├── postprocessing.py
├── utils.py
├── visualizer.py
└── viz_helpers.py
Contains only some playground files which are absolutely not important to consider.
- package
library
enables pip installation and symling creation - fork the repository and execute
pip install -e .
from the parent tree. - packaging allows also for updating the packages in the scripts via
importlib.reload()
You can setup Representation-Learning as follows: Note, all commands must be run from parent level of the repository.
- Install miniconda
- Create a conda environmnet for python 3.7 (
conda create -n <env name> python=3.7
) - Clone this repository
- Install the required packages via
pip install -r requirements.txt
- Install the local package
library
as described above. - Download the data by moving to data folder
cd data
and executingpython get_<dataset>_data.py
- Run code from
run.py --config/config_file.yaml
In case that hyperparameters want to be adjusted, you can do so by respectively adjusting the parameters set in the config
files.
Note, however, the parameter configurations listed we found worked best for the respective problem.
If you want to run your own experiments, it is advisable to additionally specify the run_name
and the experiment_name
.
This is required for mlflow
to log adequately.
An exemplary command could be as follows:
python run.py --configs/MNIST/vae.yaml --run_name mnist_vae --experiment_name mnist_vae