- Tensorflow implement of StarGAN: Unified Generative Adversarial Networks for Multi-Domain Image-to-Image Translation.[Paper]
- Borrowed code and ideas from yunjey's StarGAN: https://github.com/yunjey/StarGAN.
First ensure that you have installed the following required packages:
- TensorFlow1.4.0 (instructions). Maybe other version is ok.
- Opencv (instructions). Here is opencv-2.4.9.
See requirements.txt for details.
- In this implementation of the StarGAN, we use CelebA dataset.
- Run the download.sh to download the dataset, you can put it in the datasets folder. The CelebA dataset which you downloaded inculdes CelebA crop images and attribute labels.
- CelebA attribute labels can be seen in list_attr_celeba.txt, there are 40 attributes totally. It is a binary attribute, 1 represent the image has this attribute, -1 represent the image has not this attribute. You can see the README.md of CelebA dataset for detial.
- Run the following script to train the model, in the process of training, will save the training images every 500 steps. See the model/stargan.py for details.
sh train.sh
You can change the arguments in train.sh depend on your machine config.
- Run the following script to test the trained model. The test.sh will transform the datasets.
sh test.sh
The script will load the trained StarGAN model to generate the transformed images. You could change the arguments in test.sh depend on your machine config.
- Pretrained model: [download].
- In the process of training, you will see the loss change greatly, and the generated results is also not good. I guess the loss function is not well, so, we can try other loss function. If you have other ideas about my project, please contact me.