Skip to content

qianx77/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 .

Year
Pub
Abbreviation
Release
2021 CVPR GFPGAN
2021 CVPR GPEN
2022 NeurIPS CodeFormer
2022 CVPR RestoreFormer
2022 ECCV VQFR
2023 TPAMI RestoreFormer++

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://pan.baidu.com/s/1Dt0YElo1aKyPiZE0By1mGA 提取码: jvbt 

Inference

Method including GPEN、GFPGAN1.4、CodeFormer、RestoreFormer、RestoreFormer++、VQFRv2:

python inference.py -i inputs/cropped_faces -o results/out -v [method] -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,RestoreFormer,RestoreFormer++,VQFRv2:. 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 GFPGANCodeFromerGPENRestoreFormer++VQFR. 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