implementation based on http://arxiv.org/abs/1703.05192
"Learning to Discover Cross-Domain Relations with Generative Adversarial Networks" Taeksoo Kim, Moonsu Cha, Hyunsoo Kim, Jung Kwon Lee, and Jiwon Kim
- TensorFlow 1.1.0 or greater (?)
- opencv (for
image_translate.py
) - numpy
- pandas
$ mkdir datasets/celebA
$ mv ${YOUR_DOWNLOAD_DIR}/img_align_celeba.zip datasets/celebA
$ mv ${YOUR_DOWNLOAD_DIR}/list_attr_celeba.txt datasets/celebA
$ cd datasets/celebA
$ unzip img_align_celeba.zip
- Set the "TRAIN_DIR" (where to save checkpoint) to path you want
- Set the hyper-parameters
ROOT_DIR=$HOME/projects
# Where the training (fine-tuned) checkpoint and logs will be saved to.
TRAIN_DIR=$ROOT_DIR/discoGAN.tensorflow.slim/exp1
CUDA_VISIBLE_DEVICES=0 \
python train.py \
--train_dir=${TRAIN_DIR} \
--batch_size=256 \
--initial_learning_rate=0.0002 \
--max_steps=80000 \
--save_steps=4000 \
--adam_beta1=0.5 \
--style_A='Male' \
#--style_A='Blond_Hair' \
#--style_B='Black_Hair' \
#--constraint='Male' \
#--constraint_type='1' \
$ ./train.sh
- You can use tensorboard for monitoring loss and generated images
$ tensorboard --logdir exp1
ROOT_DIR=$HOME/projects
# Where the training (fine-tuned) checkpoint and logs will be saved to.
TRAIN_DIR=$ROOT_DIR/discoGAN.tensorflow.slim/exp1
BATCH_SIZE=$1
CUDA_VISIBLE_DEVICES=0 \
python image_translate.py \
--checkpoint_path=${TRAIN_DIR} \
--is_all_checkpoints=True \
--checkpoint_step=-1 \
--batch_size=$BATCH_SIZE \
--style_A='Male' \
#--style_A='Blond_Hair' \
#--style_B='Black_Hair' \
#--constraint='Male' \
#--constraint_type='1' \
$ ./image_translate.sh batch_size (the number of images you want)
Il Gu Yi