face restoration with GFPGAN

What is GFPGAN?

GFPGAN is one of Ai GAN (Generative Adversarial Network) models for face restoration. It can fix Ai generated faces and improve the resolution of blurry face photos.

How to run face restoration using GFPGAN GitHub code?

1. First download the code from GFPGAN GitHub repository. Open a dos prompt, in the directory where you want to install, type the command:
>git clone https://github.com/TencentARC/GFPGAN.git
2. Download GFPGANv1.3.pth or GFPGANv1.4.pth. Put them under “GFPGAN\experiments\pretrained_models” directory.
3. You need to configure a virtual environment to run the code. If you haven’t installed Anaconda3, go to install Anaconda3.
4. Setup a conda environment of GFPGAN by using the instruction. If you run into problems when you setup, you can download a ready-for-use gfpgan_env at Gumroad (compatible with CUDA 11.8). Unzip it and put it at your anaconda3 installation under “envs” directory.
5. Now put an image file with a face you want to restore at “GFPGAN\inputs\upload” directory.
6. Open an Anaconda Prompt. Run command:
>conda activate gfpgan_env
7. Still in the Anaconda prompt, go to the directory “GFPGAN” and run command:
>python setup.py develop
>python inference_gfpgan.py -i inputs/upload -o results -v 1.3 -s 2 –bg_upsampler realesrgan
8. When it finishes, the new restored image is saved at “results” directory.


Enhance Resolution using Real-ESRGAN