Reproduction of the Park et al. Swapping Autoencoder for Deep Image Manipulation 2020 Paper
Re-implementers: Callum Newlands, Jacob Scott, Muhammed Qaid | University of Southampton [ECS]
This project aimed to re-implement the Swapping Autoencoder model architecture, as well as training the model on (a downscaled version of) the LSUN Church dataset, and then assessing the reconstruction and image manipulation abilities of the trained model.
The full re-implementation report is available here
- Anaconda
- The required packages for the conda environment are specified in the
spec_file.txtandenvironment.ymlfiles.
- The required packages for the conda environment are specified in the
- CUDA-enabled GPU (can be ran on CPU will just be much slower)
- LSUN Church dataset (Avaiable from https://github.com/fyu/lsun)
- Needs to be downloaded and unzipped and the
dir_pathparameter indata_loading.pyneeds updated. E.g.:dir_path="../data/lsun/church_outdoor_train_lmdb"
- Needs to be downloaded and unzipped and the
The project is designed to run inside a conda environment (see Prerequisites). Once you have created the environment run python training.py <start_iteration> to train the model.
(For reference, full training took 5 days on 4 Nvidia RTX 8000 GPU cards with 48GB RAM).
Alternatively a model run.slurm file has been provided for running on the ecsall partition of the IRIDIS 5 Compute Cluster.
(This file will require significant modifications to run elsewhere).
The pretrained model (optimiser.pt) is too large for GitHub (370MB), for a copy of this please contact the re-implementing authors.
/stylegan2_pytorchLocal copy of https://github.com/rosinality/stylegan2-pytorch/taesung_data_loadingLocal copy of the data loading code from https://github.com/taesungp/swapping-autoencoder-pytorchdata_loading.pyThe code to load the downloaded LSUN Church dataset in the required formatdecoder.pyThe decoder moduleencoder.pyThe encoder (generator) moduleexperiments.pyThe code to generate the report results and figurespatch_discriminator.pyThe patch discriminator moduleswapping_autoencoder.pyThe combined swapping autoencoder model and loss functionstraining.pyThe main application entry point: initialises, loads, trains, and saves the model


