-
Clone repo
git clone https://github.com/saba99/Real-world-Face-Restoration-GFPGAN.git cd Real-world-Face-Restoration-GFPGAN
-
Install dependent packages
# Install basicsr - https://github.com/xinntao/BasicSR # We use BasicSR for both training and inference 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 python setup.py 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
We take the v1.3 version for an example. More models can be found here.
Download pre-trained models: GFPGANv1.3.pth
wget https://github.com/TencentARC/GFPGAN/releases/download/v1.3.0/GFPGANv1.3.pth -P experiments/pretrained_models
Inference!
python inference_gfpgan.py -i inputs/whole_imgs -o results -v 1.3 -s 2
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. |
We provide the training codes for GFPGAN (used in our paper).
You could improve it according to your own needs.
Procedures
-
Dataset preparation: FFHQ
-
Download pre-trained models and other data. Put them in the
experiments/pretrained_models
folder. -
Modify the configuration file
options/train_gfpgan_v1.yml
accordingly. -
Training
python -m torch.distributed.launch --nproc_per_node=4 --master_port=22021 gfpgan/train.py -opt options/train_gfpgan_v1.yml --launcher pytorch