Awesome
<p align="center"> <img src="./pics/256.jpg" width="100%"> </p> <p align="center"> <img src="./pics/overview.jpg" width="50%"> <img src="./pics/mask.jpg" width="45%"> </p> <hr style="height:1px" /><p align="center"> PA-GAN </p>
TensorFlow implementation of PA-GAN: Progressive Attention Generative Adversarial Network for Facial Attribute Editing
<p align="center"> <img src="./pics/schema.jpg" width="100%" /> </p>Usage
-
Environment
-
Python 3.6
-
TensorFlow 1.13+, TensorFlow Graphics
-
OpenCV, scikit-image, tqdm, oyaml
-
we recommend Anaconda or Miniconda, then you can create the PA-GAN environment with commands below
conda create -n PA-GAN python=3.6 source activate PA-GAN conda install opencv scikit-image tqdm tensorflow-gpu=1.13 conda install -c conda-forge oyaml pip install tensorflow-graphics-gpu --no-deps
-
NOTICE: if you create a new conda environment, remember to activate it before any other command
source activate PA-GAN
-
-
Data Preparation
-
CelebA-unaligned (10.2GB, higher quality than the aligned data)
-
download the dataset
-
img_celeba.7z (move to ./data/img_celeba/img_celeba.7z): Google Drive or Baidu Netdisk (password rp0s)
-
annotations.zip (move to ./data/img_celeba/annotations.zip): Google Drive
-
-
unzip and process the data
7z x ./data/img_celeba/img_celeba.7z/img_celeba.7z.001 -o./data/img_celeba/ unzip ./data/img_celeba/annotations.zip -d ./data/img_celeba/ python ./scripts/align.py
-
-
-
Run PA-GAN
-
training
CUDA_VISIBLE_DEVICES=0 \ python train.py \ --experiment_name PA-GAN_128
-
testing
-
single attribute editing (inversion)
CUDA_VISIBLE_DEVICES=0 \ python test.py \ --experiment_name PA-GAN_128
-
multiple attribute editing (inversion) example
CUDA_VISIBLE_DEVICES=0 \ python test_multi.py \ --test_att_names Bushy_Eyebrows Mustache \ --experiment_name PA-GAN_128
-
-
loss visualization
CUDA_VISIBLE_DEVICES='' \ tensorboard \ --logdir ./output/default/summaries \ --port 6006
-
-
Using Trained Weights
-
alternative trained weights (move to ./output/*.zip)
-
PA-GAN_128.zip (953.9MB)
- including G, D, and the state of the optimizer
-
PA-GAN_128_generator_only.zip (151.5MB)
- G only
-
PA-GAN_256_generator_only.zip (70.8MB)
-
-
unzip the file (PA-GAN_128.zip for example)
unzip ./output/PA-GAN_128.zip -d ./output/
-
testing (see above)
-
Citation
If you find PA-GAN useful in your research work, please consider citing:
@article{he2020pagan,
title={PA-GAN: Progressive Attention Generative Adversarial Network for Facial Attribute Editing},
author={He, Zhenliang and Kan, Meina and Zhang, Jichao and Shan, Shiguang},
journal={arXiv preprint arXiv:2007.05892},
year={2020}
}