Spatial Attention Generative Adversarial Network
Tensorflow implementation of Generative Adversarial Network with Spatial Attention for Face Attribute Editing
Preparation
-
Prerequisites
- Tensorflow (r1.4 - r1.12 should work fine)
- Python 3.x with matplotlib, numpy and scipy
-
Dataset
- CelebA dataset (Find more details from the project page)
- Images should be placed in DATAROOT/img_align_celeba/*.jpg
- Attribute labels should be placed in DATAROOT/list_attr_celeba.txt
- If google drive is unreachable, you can get the data from Baidu Cloud
- We follow the settings of AttGAN, kindly refer to AttGAN for more dataset preparation details
- CelebA dataset (Find more details from the project page)
Usage
Train a model with a target attribute
python train.py --experiment_name 128_Bangs --atts Bangs --dataroot ./data/Datasets/CelebA/Img
Generate images from trained models
python test.py --experiment-name 128_Bangs --gpu
NOTE:
- You should give the path of the data by adding
--dataroot DATAROOT
; - You can specify which GPU to use by adding
--gpu GPU
, e.g.,--gpu 0
; - You can specify which image(s) to test by adding
--img num
(e.g.,--img 182638
,--img 200000 200001 200002
), where the number should be no larger than 202599 and is suggested to be no smaller than 182638 as our test set starts at 182638.png.
Acknowledgement
The code is built upon STGAN and AttGAN, thanks for their excellent work!