TencentARC / GFPGANv1

huggingface.co
Total runs: 0
24-hour runs: 0
7-day runs: 0
30-day runs: 0
Model's Last Updated: October 08 2022

Introduction of GFPGANv1

Model Details of GFPGANv1

GFPGAN (CVPR 2021)

Paper | Project Page English | 简体中文

GitHub: https://github.com/TencentARC/GFPGAN

GFPGAN is a blind face restoration algorithm towards real-world face images.

google colab logo Colab Demo

: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

Abstract

Blind face restoration usually relies on facial priors, such as facial geometry prior or reference prior, to restore realistic and faithful details. However, very low-quality inputs cannot offer accurate geometric prior while high-quality references are inaccessible, limiting the applicability in real-world scenarios. In this work, we propose GFP-GAN that leverages rich and diverse priors encapsulated in a pretrained face GAN for blind face restoration. This Generative Facial Prior (GFP) is incorporated into the face restoration process via novel channel-split spatial feature transform layers, which allow our method to achieve a good balance of realness and fidelity. Thanks to the powerful generative facial prior and delicate designs, our GFP-GAN could jointly restore facial details and enhance colors with just a single forward pass, while GAN inversion methods require expensive image-specific optimization at inference. Extensive experiments show that our method achieves superior performance to prior art on both synthetic and real-world datasets.

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


:wrench: Dependencies and Installation
Installation
  1. Clone repo

    git clone https://github.com/xinntao/GFPGAN.git
    cd GFPGAN
    
  2. Install dependent packages

    # Install basicsr - https://github.com/xinntao/BasicSR
    # We use BasicSR for both training and inference
    # Set BASICSR_EXT=True to compile the cuda extensions in the BasicSR - It may take several minutes to compile, please be patient
    BASICSR_EXT=True 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
    
:zap: Quick Inference

Download pre-trained models: GFPGANv1.pth

wget https://github.com/TencentARC/GFPGAN/releases/download/v0.1.0/GFPGANv1.pth -P experiments/pretrained_models
python inference_gfpgan_full.py --model_path experiments/pretrained_models/GFPGANv1.pth --test_path inputs/whole_imgs

# for aligned images
python inference_gfpgan_full.py --model_path experiments/pretrained_models/GFPGANv1.pth --test_path inputs/cropped_faces --aligned
:computer: Training

We provide complete training codes for GFPGAN.
You could improve it according to your own needs.

  1. Dataset preparation: FFHQ

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

    1. Pretrained 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 train_gfpgan_v1.yml accordingly.

  4. Training

python -m torch.distributed.launch --nproc_per_node=4 --master_port=22021 train.py -opt train_gfpgan_v1.yml --launcher pytorch

:scroll: License and Acknowledgement

GFPGAN is realeased under Apache License Version 2.0.

:e-mail: Contact

If you have any question, please email xintao.wang@outlook.com or xintaowang@tencent.com .

Runs of TencentARC GFPGANv1 on huggingface.co

0
Total runs
0
24-hour runs
0
3-day runs
0
7-day runs
0
30-day runs

More Information About GFPGANv1 huggingface.co Model

GFPGANv1 huggingface.co

GFPGANv1 huggingface.co is an AI model on huggingface.co that provides GFPGANv1's model effect (), which can be used instantly with this TencentARC GFPGANv1 model. huggingface.co supports a free trial of the GFPGANv1 model, and also provides paid use of the GFPGANv1. Support call GFPGANv1 model through api, including Node.js, Python, http.

TencentARC GFPGANv1 online free

GFPGANv1 huggingface.co is an online trial and call api platform, which integrates GFPGANv1's modeling effects, including api services, and provides a free online trial of GFPGANv1, you can try GFPGANv1 online for free by clicking the link below.

TencentARC GFPGANv1 online free url in huggingface.co:

https://huggingface.co/TencentARC/GFPGANv1

GFPGANv1 install

GFPGANv1 is an open source model from GitHub that offers a free installation service, and any user can find GFPGANv1 on GitHub to install. At the same time, huggingface.co provides the effect of GFPGANv1 install, users can directly use GFPGANv1 installed effect in huggingface.co for debugging and trial. It also supports api for free installation.

GFPGANv1 install url in huggingface.co:

https://huggingface.co/TencentARC/GFPGANv1

Url of GFPGANv1

Provider of GFPGANv1 huggingface.co

TencentARC
ORGANIZATIONS

Other API from TencentARC

huggingface.co

Create photos, paintings and avatars for anyone in any style within seconds.

Total runs: 35.2K
Run Growth: -43.4K
Growth Rate: -124.12%
Updated: July 22 2024
huggingface.co

Total runs: 122
Run Growth: -78
Growth Rate: -55.71%
Updated: December 16 2024
huggingface.co

Total runs: 114
Run Growth: 22
Growth Rate: 19.30%
Updated: November 29 2024
huggingface.co

Total runs: 19
Run Growth: 11
Growth Rate: 57.89%
Updated: December 10 2024
huggingface.co

Total runs: 5
Run Growth: -1
Growth Rate: -20.00%
Updated: December 30 2024
huggingface.co

Total runs: 5
Run Growth: -2
Growth Rate: -40.00%
Updated: December 30 2024
huggingface.co

Total runs: 4
Run Growth: -6
Growth Rate: -150.00%
Updated: December 30 2024
huggingface.co

Total runs: 0
Run Growth: 0
Growth Rate: 0.00%
Updated: June 29 2024
huggingface.co

Total runs: 0
Run Growth: 0
Growth Rate: 0.00%
Updated: August 20 2023
huggingface.co

Total runs: 0
Run Growth: 0
Growth Rate: 0.00%
Updated: December 16 2024
huggingface.co

Total runs: 0
Run Growth: 0
Growth Rate: 0.00%
Updated: December 20 2024
huggingface.co

Total runs: 0
Run Growth: 0
Growth Rate: 0.00%
Updated: August 28 2023
huggingface.co

Total runs: 0
Run Growth: 0
Growth Rate: 0.00%
Updated: December 17 2024
huggingface.co

Total runs: 0
Run Growth: 0
Growth Rate: 0.00%
Updated: August 13 2024
huggingface.co

Total runs: 0
Run Growth: 0
Growth Rate: 0.00%
Updated: April 11 2024
huggingface.co

Total runs: 0
Run Growth: 0
Growth Rate: 0.00%
Updated: January 20 2024