GFPGAN aims at developing Practical Algorithms for Real-world Face Restoration.
Alternatives To Gfpgan
Project NameStarsDownloadsRepos Using ThisPackages Using ThisMost Recent CommitTotal ReleasesLatest ReleaseOpen IssuesLicenseLanguage
Transformers102,489649116 hours ago91June 21, 2022739apache-2.0Python
🤗 Transformers: State-of-the-art Machine Learning for Pytorch, TensorFlow, and JAX.
Stable Diffusion Webui80,024
6 hours ago1,916agpl-3.0Python
Stable Diffusion web UI
Pytorch67,4221466 hours ago23August 10, 202212,124otherPython
Tensors and Dynamic neural networks in Python with strong GPU acceleration
Real Time Voice Cloning41,693
a month ago129otherPython
Clone a voice in 5 seconds to generate arbitrary speech in real-time
12 hours ago35May 21, 2022311agpl-3.0Python
YOLOv5 🚀 in PyTorch > ONNX > CoreML > TFLite
Made With Ml33,193
a month ago5May 15, 201911mitJupyter Notebook
Learn how to responsibly develop, deploy and maintain production machine learning applications.
Mockingbird28,5432a month ago9February 28, 2022411otherPython
🚀AI拟声: 5秒内克隆您的声音并生成任意语音内容 Clone a voice in 5 seconds to generate arbitrary speech in real-time
Gfpgan27,65112 months ago11February 15, 2022209otherPython
GFPGAN aims at developing Practical Algorithms for Real-world Face Restoration.
Pytorch Tutorial26,129
2 months ago85mitPython
PyTorch Tutorial for Deep Learning Researchers
Ray25,845801996 hours ago76June 09, 20222,891apache-2.0Python
Ray is a unified framework for scaling AI and Python applications. Ray consists of a core distributed runtime and a toolkit of libraries (Ray AIR) for accelerating ML workloads.
Alternatives To Gfpgan
Select To Compare

Alternative Project Comparisons

download PyPI Open issue Closed issue LICENSE python lint Publish-pip

  1. 💥 Updated online demo: Replicate. Here is the backup.
  2. 💥 Updated online demo: Huggingface Gradio
  3. Colab Demo for GFPGAN google colab logo; (Another Colab Demo for the original paper model)

🚀 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 😊

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.

❓ Frequently Asked Questions can be found in

🚩 Updates

  • ✅ Add RestoreFormer inference codes.
  • ✅ Add V1.4 model, which produces slightly more details and better identity than V1.3.
  • ✅ 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,
  • ✅ Integrated to Huggingface Spaces with Gradio. See Gradio Web Demo.
  • ✅ Support enhancing non-face regions (background) with Real-ESRGAN.
  • ✅ We provide a clean version of GFPGAN, which does not require CUDA extensions.
  • ✅ We provide an updated model without colorizing faces.

If GFPGAN is helpful in your photos/projects, please help to ⭐️ this repo or recommend it to your friends. Thanks😊 Other recommended projects:
▶️ Real-ESRGAN: A practical algorithm for general image restoration
▶️ BasicSR: An open-source image and video restoration toolbox
▶️ facexlib: A collection that provides useful face-relation functions
▶️ HandyView: A PyQt5-based image viewer that is handy for view and comparison

📖 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

🔧 Dependencies and Installation


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 for installation.

  1. Clone repo

    git clone
    cd GFPGAN
  2. Install dependent packages

    # Install basicsr -
    # We use BasicSR for both training and inference
    pip install basicsr
    # Install facexlib -
    # We use face detection and face restoration helper in the facexlib package
    pip install facexlib
    pip install -r requirements.txt
    python 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

⚡️ Quick Inference

We take the v1.3 version for an example. More models can be found here.

Download pre-trained models: GFPGANv1.3.pth

wget -P experiments/pretrained_models


python -i inputs/whole_imgs -o results -v 1.3 -s 2
Usage: python -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 for installation and inference.

🏰 Model Zoo

Version Model Name Description
V1.3 GFPGANv1.3.pth Based on V1.2; more natural restoration results; better results on very low-quality / high-quality inputs.
V1.2 GFPGANCleanv1-NoCE-C2.pth No colorization; no CUDA extensions are required. Trained with more data with pre-processing.
V1 GFPGANv1.pth The paper model, with colorization.

The comparisons are in

Note that V1.3 is not always better than V1.2. You may need to select different models based on your purpose and inputs.

Version Strengths Weaknesses
V1.3 ✓ natural outputs
✓better results on very low-quality inputs
✓ work on relatively high-quality inputs
✓ can have repeated (twice) restorations
✗ not very sharp
✗ have a slight change on identity
V1.2 ✓ sharper output
✓ with beauty makeup
✗ some outputs are unnatural

You can find more models (such as the discriminators) here: [Google Drive], OR [Tencent Cloud 腾讯微云]

💻 Training

We provide the training codes for GFPGAN (used in our paper).
You could improve it according to your own needs.


  1. More high quality faces can improve the restoration quality.
  2. You may need to perform some pre-processing, such as beauty makeup.


(You can try a simple version ( options/train_gfpgan_v1_simple.yml) that does not require face component landmarks.)

  1. Dataset preparation: FFHQ

  2. Download pre-trained models and other data. Put them in the experiments/pretrained_models folder.

    1. Pre-trained StyleGAN2 model: StyleGAN2_512_Cmul1_FFHQ_B12G4_scratch_800k.pth
    2. Component locations of FFHQ: FFHQ_eye_mouth_landmarks_512.pth
    3. A simple ArcFace model: arcface_resnet18.pth
  3. Modify the configuration file options/train_gfpgan_v1.yml accordingly.

  4. Training

python -m torch.distributed.launch --nproc_per_node=4 --master_port=22021 gfpgan/ -opt options/train_gfpgan_v1.yml --launcher pytorch

📜 License and Acknowledgement

GFPGAN is released under Apache License Version 2.0.


    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}

📧 Contact

If you have any question, please email [email protected] or [email protected].

Popular Deep Learning Projects
Popular Pytorch Projects
Popular Machine Learning Categories
Related Searches

Get A Weekly Email With Trending Projects For These Categories
No Spam. Unsubscribe easily at any time.
Deep Learning
Super Resolution