We only provide test codes at this time.
Progressive Semantic-Aware Style Transformation for Blind Face Restoration
Chaofeng Chen, Xiaoming Li, Lingbo Yang, Xianhui Lin, Lei Zhang, Kwan-Yee K. Wong
- Ubuntu 18.04
- CUDA 10.1
- Python 3.7, install required packages by
pip3 install -r requirements.txt
- Clone this repository
git clone https://github.com/chaofengc/PSFR-GAN.git cd PSFR-GAN
Download the pretrained models from the following link and put them to ./pretrain_models
- GoogleDrive
- BaiduNetDisk, extract code:
4uip
Run the following script to enhance face(s) in single input
python test_enhance_single_unalign.py --test_img_path ./test_dir/Solvay_conference_1927.jpg --results_dir solvay_test --test_upscale 1
This script do the following things:
- Crop and align all the faces from input image, stored at
solvay_test/LQ_faces
- Parse these faces and then enhance them, results stored at
solvay_test/ParseMaps
andsolvay_test/HQ
- Paste then enhanced faces back to the original image
solvay_test/hq_final.jpg
- You may use
--test_upscale
to upscale the final output.
To test multiple images, we first crop out all the faces and align them use the following script.
python align_and_crop_dir.py --src_dir test_dir --results_dir test_align_results
For images (e.g. multiface_test.jpg
) contain multiple faces, the aligned faces will be stored as multiface_test_{face_index}.jpg
And then parse the aligned faces and enhance them with
python test_enhance_dir_align.py --dataroot test_align_results --results_dir test_enhance_results
Results will be saved to three folders respectively: lq
, parse
, hq
.
Note: This is used to test a large amounts of data, so we do not paste the faces back.
@InProceedings{ChenPSFRGAN,
author = {Chen, Chaofeng and Li, Xiaoming and Lin, Xianhui and Lingbo, Yang and Zhang, Lei and Wong, KKY},
title = {Progressive Semantic-Aware Style Transformation for Blind Face Restoration},
year = {2020}
}
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.
This work is inspired by SPADE, and closed related to DFDNet and HiFaceGAN. Our codes largely benefit from CycleGAN.