Face Restoration refers to the restoration of a high-definition face image from a low-quality face image. In reality, face restoration is a very challenging task, because the degradation process is complex and different. The Tencent ARC team has opened source a set of face repair algorithms that make use of the rich and diverse prior factors encapsulated in pre-trained facial Gans (such as StyleGAN2) for blind face repair.
GFPGAN uses pre-trained models to compare and repair face images, and it can process facial details and face colors, including hair color, facial outline, and clarity. Here is the result:
functional framework:
install and use:
- Clone warehouse
git clone https://github.com/TencentARC/GFPGAN.gitcd GFPGAN
- Installation dependency
# install basicsr - https://github.com/xinntao/BasicSR# We use BasicSR for training and reasoning pip install basicsr# installfacexlib - https://github.com/xinntao/facexlib# We use face detection and face repair assistants in the facexlib package pip install facexlibpip install -r requirements.txtpython setup.py develop# If you want to enhance background (non-face) areas with Real-ESRGAN,#You will also need to install the realesrgan packagepip install realesrgan
- Download the pre-training model
wget https://github.com/TencentARC/GFPGAN/releases/download/v0.2.0/GFPGANCleanv1-NoCE-C2.pth -P Experiments/pretrained_models