Skip to content

PA-GAN: Progressive Attention Generative Adversarial Network for Facial Attribute Editing

License

Notifications You must be signed in to change notification settings

LynnHo/PA-GAN-Tensorflow

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

        

PA-GAN: Progressive Attention Generative Adversarial Network for Facial Attribute Editing
Zhenliang He1,2, Meina Kan1,2, Jichao Zhang1,2,3, Shiguang Shan1,2
1Key Lab of Intelligent Information Processing, Institute of Computing Technology, CAS, China
2University of Chinese Academy of Sciences, China
3Peng Cheng Laboratory, China

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

      • 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

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}
}

About

PA-GAN: Progressive Attention Generative Adversarial Network for Facial Attribute Editing

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages