Skip to content

FaceRestoration using GFPGAN to enhance image like realize, old img etc.

Notifications You must be signed in to change notification settings

KaiKenju/FaceRestoration_GFPGAN

Repository files navigation

logo

🌎 English | Vietnamese

πŸ“– GFP-GAN: Towards Real-World Blind Face Restoration with Generative Facial Prior

[Paper]   [Project Page]   [Demo]
Xintao Wang, Yu Li, Honglun Zhang, Ying Shan
Applied Research Center (ARC), Tencent PCG



Related Projects:

  • Vietnamese_OCR_documents: is used to convert text from images or scanned documents into digital format, allowing automatic processing and analysis of text data. This technology is very useful in extracting information from Vietnamese documents, making information searching and management easier and more efficient.

πŸ”§ Dependencies

  • Python >= 3.7 (Recommend to use Anaconda or Miniconda, Default: Miniconda)
  • PyTorch >= 1.7
  • Option: NVIDIA GPU + CUDA

πŸ› οΈ Installation

  • Clone this project:
git clone https://github.com/KaiKenju/FaceRestoration_GFPGAN.git
  • Initial enviromment with Miniconda (Default: python 3.10):
conda create -n <env_name> python=3.10
  • Activate conda
conda activate <env_name> 
cd FaceRestoration_GFPGAN
  • Run the commands:
pip install -r GFPGAN/requirements.txt
  • After install requirements, you need to run the fix_torchvision.py to avoid the problem of basicsr module after install.
python fix_torchvision.py

⚑ Quick Inference

Dowload pre-trained models : GFPGANv1.4.pth and put them following path model/GFPGANv1.4.pth

python main.py -i old_images_ori --output_dir my_result --upscale 2 --version 1.4
Usage: python main.py -i old_images_ori --output_dir my_result --upscale 2 --version 1.4 

  -h                   show this help
  -i input             Input image or folder. Default: old_images_ori
  --output_dir output            Output folder. Default: my_results
  -v version           GFPGAN model version. Option: 1 | 1.2 | 1.3. Default: 1.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

Tips

The first time you run the model and use CPU, it can be more time to load data, so to reduce time you can put weight file following path:

  1. Download pre-trained models and other data. Put them in the GFPGAN/gfpgan/weights folder.
    1. Detection_Resnet50
    2. Parsing_Parsenet
  2. Also in the GFPGAN/weights folder.
    1. GFPGANv1.4.pth

About

FaceRestoration using GFPGAN to enhance image like realize, old img etc.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published