GFPGAN is one of Ai GAN (Generative Adversarial Network) models for face restoration. It can improve the resolution from old photos or fix Ai generated faces. This tutorial gives you a step by step on how to use the 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.
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.