GFPGAN aims at developing Practical Algorithms for Real-world Face Restoration
Project description
GFPGAN (CVPR 2021)
- Colab Demo for GFPGAN ; (Another Colab Demo for the original paper model)
- We provide a clean version of GFPGAN, which can run without CUDA extensions. So that it can run in Windows or on CPU mode.
GFPGAN aims at developing Practical Algorithm for Real-world Face Restoration.
It leverages rich and diverse priors encapsulated in a pretrained face GAN (e.g., StyleGAN2) for blind face restoration.
:triangular_flag_on_post: Updates
- :white_check_mark: We provide a clean version of GFPGAN, which does not require CUDA extensions.
- :white_check_mark: We provide an updated model without colorizing faces.
:book: GFP-GAN: Towards Real-World Blind Face Restoration with Generative Facial Prior
[Paper] [Project Page] [Demo]
Xintao Wang, Yu Li, Honglun Zhang, Ying Shan
Applied Research Center (ARC), Tencent PCG
:wrench: Dependencies and Installation
- Python >= 3.7 (Recommend to use Anaconda or Miniconda)
- PyTorch >= 1.7
- Option: NVIDIA GPU + CUDA
- Option: Linux (We have not tested on Windows)
Installation
We now provide a clean version of GFPGAN, which does not require customized CUDA extensions.
If you want want to use the original model in our paper, please see PaperModel.md for installation.
-
Clone repo
git clone https://github.com/TencentARC/GFPGAN.git cd GFPGAN
-
Install dependent packages
# Install basicsr - https://github.com/xinntao/BasicSR # We use BasicSR for both training and inference pip install basicsr # Install facexlib - https://github.com/xinntao/facexlib # We use face detection and face restoration helper in the facexlib package pip install facexlib pip install -r requirements.txt python setup.py develop
:zap: Quick Inference
Download pre-trained models: GFPGANCleanv1-NoCE-C2.pth
wget https://github.com/TencentARC/GFPGAN/releases/download/v0.2.0/GFPGANCleanv1-NoCE-C2.pth -P experiments/pretrained_models
Inference!
python inference_gfpgan.py --upscale_factor 2 --test_path inputs/whole_imgs --save_root results
:european_castle: Model Zoo
- GFPGANCleanv1-NoCE-C2.pth: No colorization; no CUDA extensions are required. It is still in training. Trained with more data with pre-processing.
- GFPGANv1.pth: The paper model, with colorization.
:computer: Training
We provide the training codes for GFPGAN (used in our paper).
You could improve it according to your own needs.
Tips
- More high quality faces can improve the restoration quality.
- You may need to perform some pre-processing, such as beauty makeup.
Procedures
(You can try a simple version ( options/train_gfpgan_v1_simple.yml
) that does not require face component landmarks.)
-
Dataset preparation: FFHQ
-
Download pre-trained models and other data. Put them in the
experiments/pretrained_models
folder. -
Modify the configuration file
options/train_gfpgan_v1.yml
accordingly. -
Training
python -m torch.distributed.launch --nproc_per_node=4 --master_port=22021 gfpgan/train.py -opt options/train_gfpgan_v1.yml --launcher pytorch
:scroll: License and Acknowledgement
GFPGAN is released under Apache License Version 2.0.
BibTeX
@InProceedings{wang2021gfpgan,
author = {Xintao Wang and Yu Li and Honglun Zhang and Ying Shan},
title = {Towards Real-World Blind Face Restoration with Generative Facial Prior},
booktitle={The IEEE Conference on Computer Vision and Pattern Recognition (CVPR)},
year = {2021}
}
:e-mail: Contact
If you have any question, please email xintao.wang@outlook.com
or xintaowang@tencent.com
.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
File details
Details for the file gfpgan-0.2.1.tar.gz
.
File metadata
- Download URL: gfpgan-0.2.1.tar.gz
- Upload date:
- Size: 35.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.3 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 58c007adf0c25cb90f4be34a4b02dc1dd8639b0f3adfbfa13a5ad9307c23ae7b |
|
MD5 | 1420945a52af932d694c209375df9d68 |
|
BLAKE2b-256 | 665f2460cd8e5c9943e02897ab5747235d8bfe21ffa3c96be701092566168fca |