:rocket: Thanks for your interest in our work. You may also want to check our new updates on the tiny models for anime images and videos in Real-ESRGAN :blush:
GFPGAN aims at developing a 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.
:question: Frequently Asked Questions can be found in FAQ.md.
:white_check_mark: Add V1.4 model, which produces slightly more details and better identity than V1.3.
:white_check_mark: Add V1.3 model, which produces more natural restoration results, and better results on very low-quality / high-quality inputs. See more in Model zoo, Comparisons.md
:white_check_mark: Support enhancing non-face regions (background) with Real-ESRGAN.
: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.
If GFPGAN is helpful in your photos/projects, please help to :star: this repo or recommend it to your friends. Thanks:blush:
Other recommended projects:
:arrow_forward: Real-ESRGAN: A practical algorithm for general image restoration
:arrow_forward: BasicSR: An open-source image and video restoration toolbox
:arrow_forward: facexlib: A collection that provides useful face-relation functions
:arrow_forward: HandyView: A PyQt5-based image viewer that is handy for view and comparison
:book: GFP-GAN: Towards Real-World Blind Face Restoration with Generative Facial Prior
We now provide a clean version of GFPGAN, which does not require customized CUDA extensions.
If you 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
# If you want to enhance the background (non-face) regions with Real-ESRGAN,
# you also need to install the realesrgan package
pip install realesrgan
:zap: Quick Inference
We take the v1.3 version for an example. More models can be found here.
Usage: python inference_gfpgan.py -i inputs/whole_imgs -o results -v 1.3 -s 2 [options]...
-h show this help
-i input Input image or folder. Default: inputs/whole_imgs
-o output Output folder. Default: results
-v version GFPGAN model version. Option: 1 | 1.2 | 1.3. Default: 1.3
-s upscale The final upsampling scale of the image. Default: 2
-bg_upsampler background upsampler. Default: realesrgan
-bg_tile Tile size for background sampler, 0 for no tile during testing. Default: 400
-suffix Suffix of the restored faces
-only_center_face Only restore the center face
-aligned Input are aligned faces
-ext Image extension. Options: auto | jpg | png, auto means using the same extension as inputs. Default: auto
If you want to use the original model in our paper, please see PaperModel.md for installation and inference.
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.
Works well with
Use together with gfpgan: extensions, drivers, servers and companion tools.
torchPythie’s Index: 89Tensors and Dynamic neural networks in Python with strong GPU acceleration59.1M downloads/mo
basicsrPythie’s Index: 11Open Source Image and Video Super-Resolution Toolbox285.2K downloads/mo
realesrganPythie’s Index: 11Real-ESRGAN aims at developing Practical Algorithms for General Image Restoration272.8K downloads/mo
facexlibPythie’s Index: 16Basic face library585.1K downloads/mo