This repository contains Pytorch implementation for the Max-Sliced StarGAN proposed in my project Multi-Domain Image-to-Image Translation using StarGAN with Max Sliced Wasserstein Distance.
The Max-Sliced StarGAN combines StarGAN and Max-Sliced Wasserstein distance together to improve the training stability and reduce sample complexity of the orginal StarGAN.
Sample images generated by the Max-Sliced StarGAN are shown here.
- Python 3.5+
- PyTorch 0.4.0+
- TensorFlow 1.3+ (optional for tensorboard)
Note: the current version only supports training on the CelebA dataset.
git clone https://github.com/Ziyu0/max-sliced-stargan.git
cd max-sliced-stargan
bash download.sh celeba
Run
python main.py --help
to see all the configurable hyper-parameters.
cd scripts
bash train_celeba_original.sh
cd scripts
bash train_celeba_max_sliced.sh
In script train_celeba_max_sliced.sh
, --use_max_sw_loss
is set to True
to enable the max-sliced Wasserstein distance.
Please refer to the report for the introduction to the baseline models
- Training the Sliced StarGAN
In script
cd scripts bash train_celeba_sliced.sh
train_celeba_sliced.sh
,--use_sw_loss
is set toTrue
to enable the sliced Wasserstein distance. - Training the Sliced StarGAN with feature transformation
In the script
cd scripts bash train_celeba_sliced_feat_trans.sh
train_celeba_sliced_feat_trans.sh
, both--use_sw_loss
and--use_d_feature
are set toTrue
so that we can compute the sliced Wasserstein distance based on the feature transformation.
cd scripts
bash test_celeba_general.sh
cd scripts
bash test_celeba_small.sh
To generate loss plots for multiple training processes, run
cd scripts
bash create_plots.sh
Here is a sample plot:
The following figure is the facial attribute transfer results for the original StarGAN and the Max-Sliced StarGAN. Four sets of generated images are shown from the top left to the bottom right sections. For each section, the first column shows the input image, and the next three columns show the single attribute transfer results.
- Provide supports for training on other datasets, such as the RaFD dataset.
- Further improve the performance of the Max-Sliced StarGAN.