Skip to content

A repository for the inferences of face restoration methods

Notifications You must be signed in to change notification settings

yeruiqian/Face_Restoration

Repository files navigation

A repository for the inference of face restoration

A list of face restoration papers and codes, can see in this repository .

Update

TODO

  • Add torch2onnx script
  • Add more face restoration method

inference results


Installation

  1. Clone repo

    git clone https://github.com/yeruiqian/Face_Restoration.git
    cd Face_Restoration
  2. Install dependent packages

    # Install basicsr - https://github.com/xinntao/BasicSR
    pip install basicsr
    
    # Install facexlib - https://github.com/xinntao/facexlib
    pip install facexlib
    
    # you also can refer to my own environment 'requirements_self.txt'
    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

Download weights

download the weights and put them in experiments/pretrained_models

'https://github.com/TencentARC/GFPGAN/releases/download/v1.3.0/GFPGANv1.3.pth'
'https://github.com/sczhou/CodeFormer/releases/download/v0.1.0/codeformer.pth'
'https://public-vigen-video.oss-cn-shanghai.aliyuncs.com/robin/models/GPEN-BFR-512.pth'

Inference

python inference.py -i inputs/cropped_faces -o results/GPEN -v GPEN -s 1
python inference.py -i inputs/cropped_faces -o results/GFPGAN1.4 -v GFPGANv1.4 -s 1
python inference.py -i inputs/cropped_faces -o results/CodeFormer -v CodeFormer -s 1
Usage: python inference_gfpgan.py -i inputs/whole_imgs -o results -v 1.3 -s 2 [options]...

  -h                   show this help
  -i input             Input image or folder. Default: inputs/cropped_faces
  -o output            Output folder. Default: results
  -v version           Different model. Option: GFPGANv1.4,GPEN,CodeFormer. Default: GFPGANv1.4
  -s upscale           The final upsampling scale of the image. Default: 2
  -bg_upsampler        background upsampler. Default: realesrgan
  -bg_tile             Tile size for background sampler, 0 for no tile during testing. Default: 400
  -suffix              Suffix of the restored faces
  -only_center_face    Only restore the center face
  -aligned             Input are aligned faces
  -ext                 Image extension. Options: auto | jpg | png, auto means using the same extension as inputs. Default: auto

Acknowledgement

This project is based on BasicSR. Codes are brought from GFPGANCodeFromerGPEN. Thanks for their awesome works.

About

A repository for the inferences of face restoration methods

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages