Converted from pytorch implementation https://github.com/clovaai/stargan-v2
git clone https://github.com/clovaai/stargan-v2.git
cd stargan-v2/
Install the dependencies:
conda create -n stargan-v2 python=3.6.7
conda activate stargan-v2
git clone https://github.com/zzz2010/paddle_torch
cd paddle_torch; pip install .
pip install paddlepaddle-gpu==1.8.4.post97
conda install x264=='1!152.20180717' ffmpeg=4.0.2 -c conda-forge
pip install opencv-python==4.1.2.30 ffmpeg-python==0.2.0 scikit-image==0.16.2
pip install pillow==7.0.0 scipy==1.2.1 tqdm==4.43.0 munch==2.5.0
Dataset Download:
bash download.sh afhq-dataset
bash download.sh celeba-hq-dataset
Pretrained model files:
https://aistudio.baidu.com/aistudio/datasetdetail/51623
Check out this notebook project in aistudio : https://aistudio.baidu.com/aistudio/projectdetail/722873
To evaluate StarGAN v2 using Fréchet Inception Distance (FID) and Learned Perceptual Image Patch Similarity (LPIPS), run the following commands:
# celeba-hq
python main.py --mode eval --num_domains 2 --w_hpf 1 \
--resume_iter 100000 \
--train_img_dir data/celeba_hq/train \
--val_img_dir data/celeba_hq/val \
--checkpoint_dir expr/checkpoints/celeba_hq \
--eval_dir expr/eval/celeba_hq
# afhq
python main.py --mode eval --num_domains 3 --w_hpf 0 \
--resume_iter 100000 \
--train_img_dir data/afhq/train \
--val_img_dir data/afhq/val \
--checkpoint_dir expr/checkpoints/afhq \
--eval_dir expr/eval/afhq
## Training networks
To train StarGAN v2 from scratch, run the following commands. Generated images and network checkpoints will be stored in the `expr/samples` and `expr/checkpoints` directories, respectively. Training takes about three days on a single Tesla V100 GPU. Please see [here](https://github.com/clovaai/stargan-v2/blob/master/main.py#L86-L179) for training arguments and a description of them.
```bash
# celeba-hq
python main.py --mode train --num_domains 2 --w_hpf 1 \
--lambda_reg 1 --lambda_sty 1 --lambda_ds 1 --lambda_cyc 1 \
--train_img_dir data/celeba_hq/train \
--val_img_dir data/celeba_hq/val
# afhq
python main.py --mode train --num_domains 3 --w_hpf 0 \
--lambda_reg 1 --lambda_sty 1 --lambda_ds 2 --lambda_cyc 1 \
--train_img_dir data/afhq/train \
--val_img_dir data/afhq/val
StarGAN v2: Diverse Image Synthesis for Multiple Domains
Yunjey Choi*, Youngjung Uh*, Jaejun Yoo*, Jung-Woo Ha
In CVPR 2020. (* indicates equal contribution)
Paper: https://arxiv.org/abs/1912.01865
Video: https://youtu.be/0EVh5Ki4dIY
Abstract: A good image-to-image translation model should learn a mapping between different visual domains while satisfying the following properties: 1) diversity of generated images and 2) scalability over multiple domains. Existing methods address either of the issues, having limited diversity or multiple models for all domains. We propose StarGAN v2, a single framework that tackles both and shows significantly improved results over the baselines. Experiments on CelebA-HQ and a new animal faces dataset (AFHQ) validate our superiority in terms of visual quality, diversity, and scalability. To better assess image-to-image translation models, we release AFHQ, high-quality animal faces with large inter- and intra-domain variations. The code, pre-trained models, and dataset are available at clovaai/stargan-v2.
@inproceedings{choi2020starganv2,
title={StarGAN v2: Diverse Image Synthesis for Multiple Domains},
author={Yunjey Choi and Youngjung Uh and Jaejun Yoo and Jung-Woo Ha},
booktitle={Proceedings of the IEEE Conference on Computer Vision and Pattern Recognition},
year={2020}
}