Code for the Adversarially Learned Inference paper.
From the repo's root directory,
$ cd papers
$ latexmk --pdf adverarially_learned_inference
Clone the repository, then install with
$ pip install -e ALI
Set up your ~/.fuelrc
file:
$ echo "data_path: \"<MY_DATA_PATH>\"" > ~/.fuelrc
Go to <MY_DATA_PATH>
:
$ cd <MY_DATA_PATH>
Download the CIFAR-10 dataset:
$ fuel-download cifar10
$ fuel-convert cifar10
$ fuel-download cifar10 --clear
Download the SVHN format 2 dataset:
$ fuel-download svhn 2
$ fuel-convert svhn 2
$ fuel-download svhn 2 --clear
Download the CelebA dataset:
$ fuel-download celeba 64
$ fuel-convert celeba 64
$ fuel-download celeba 64 --clear
Make sure you're in the repo's root directory.
$ THEANORC=theanorc python experiments/ali_cifar10.py
$ THEANORC=theanorc python experiments/ali_svhn.py
$ THEANORC=theanorc python experiments/ali_celeba.py
$ THEANORC=theanorc python experiments/ali_mixture.py
$ THEANORC=theanorc python experiments/gan_mixture.py
$ THEANORC=theanorc scripts/sample [main_loop.tar]
e.g.
$ THEANORC=theanorc scripts/sample ali_cifar10.tar
$ THEANORC=theanorc scripts/interpolate [which_dataset] [main_loop.tar]
e.g.
$ THEANORC=theanorc scripts/interpolate celeba ali_celeba.tar
$ THEANORC=theanorc scripts/reconstruct [which_dataset] [main_loop.tar]
e.g.
$ THEANORC=theanorc scripts/reconstruct cifar10 ali_cifar10.tar
First, preprocess the SVHN dataset with the learned ALI features:
$ THEANORC=theanorc scripts/preprocess_representations [main_loop.tar] [save_path.hdf5]
e.g.
$ THEANORC=theanorc scripts/preprocess_representations ali_svhn.tar ali_svhn_preprocessed.hdf5
Then, launch the semi-supervised script:
$ python experiments/semi_supervised_svhn.py ali_svhn.tar [save_path.hdf5]
e.g.
$ python experiments/semi_supervised_svhn.py ali_svhn_preprocessed.hdf5
[...]
Validation error rate = ... +- ...
Test error rate = ... +- ...
$ THEANORC=theanorc scripts/generate_mixture_plots [ali_main_loop.tar] [gan_main_loop.tar]
e.g.
$ THEANORC=theanorc scripts/generate_mixture_plots ali_mixture.tar gan_mixture.tar