CodeFormer: image and video facial restoration, old photo restoration, offers one-click deployment version

Trae

CodeFormer General Introduction

CodeFormer is a codebase for robust blind face repair, developed by a team of researchers at S-Lab, Nanyang Technological University and presented at NeurIPS 2022. The project leverages the Codebook Lookup Transformer technology and aims to enhance the restoration of faces in images, especially when dealing with low-quality or corrupted images.CodeFormer provides a wide range of features, including face restoration, colorization, and patching, for a variety of image processing needs. In addition, the program supports video input and offers easy-to-use online demos, pre-trained models, and detailed instructions for use.

Instructions for use must be read strictly, otherwise it will not work properly. Formally sold as old photo restoration business, you need a simple PS base, otherwise you can not achieve the same effect online.

 

CodeFormer:图像与视频面部复原,老照片修复,提供一键部署版

 

CodeFormer:图像与视频面部复原,老照片修复,提供一键部署版

CodeFormer Tries to Enhance Old Photos / Fix AI Portraits

 

CodeFormer:图像与视频面部复原,老照片修复,提供一键部署版

CodeFormer Face Repair

 

CodeFormer:图像与视频面部复原,老照片修复,提供一键部署版

CodeFormer Facial Color Enhancement and Restoration

 

CodeFormer:图像与视频面部复原,老照片修复,提供一键部署版

CodeFormer Face Repair

 

 

CodeFormer Feature List

  • face restoration: Enhance the clarity and detail of low-quality or corrupted face images with codebook lookup converter technology.
  • Image coloring: Add natural color to black and white or faded images.
  • image repair: Repair missing parts of an image to make it complete.
  • Video Processing: Supports repair and enhancement of faces in videos.
  • Online Demo: An online demo function is provided so that users can experience the restoration directly in their browsers.

 

 

CodeFormer Help

Installation process

  1. Cloning Codebase::
    git clone https://github.com/sczhou/CodeFormer
    cd CodeFormer
    

     

  2. Create and activate a virtual environment::
    conda create -n codeformer python=3.8 -y
    conda activate codeformer
    

     

  3. Installation of dependencies::
    pip install -r requirements.txt
    python basicsr/setup.py develop
    conda install -c conda-forge dlib
    

     

  4. Download pre-trained model::
    python scripts/download_pretrained_models.py facelib
    python scripts/download_pretrained_models.py dlib
    python scripts/download_pretrained_models.py CodeFormer
    

     

Usage Process

  1. Preparing test data: Place the test image into the inputs/TestWhole folder. If you need to test cropped and aligned face images, you can place them in the inputs/cropped_faces folder.
  2. Run the inference code::
    python inference_codeformer.py --input_path inputs/TestWhole --output_path results
    

    This command will process the inputs/TestWhole folder with all the images in it and save the results in the results folder.

Functional operation flow

  1. face restoration::
    • Place the image to be restored into the inputs/TestWhole Folder.
    • Run the inference code to generate the repaired image.
  2. Image coloring::
    • Place a black and white image into the inputs/TestWhole Folder.
    • utilization inference_colorization.py Script for coloring.
  3. image repair::
    • Place the image to be patched into the inputs/TestWhole Folder.
    • utilization inference_inpainting.py Scripts for patching.
  4. Video Processing::
    • Place the video file into the specified folder.
    • Run the inference code to process the faces in the video.

 

Facial restoration (cropping and alignment of the face)

# For cropped and aligned faces
python inference_codeformer.py -w 0.5 --has_aligned --input_path [input folder]

Overall Image Enhancement

# For whole image
# Add '---bg_upsampler realesrgan' to enhance the background regions with Real-ESRGAN
# Add '--face_upsample' to further upsample restored face with Real-ESRGAN
python inference_codeformer.py -w 0.7 --input_path [image folder/image path]

video enhancement

# For video clips
python inference_codeformer.py --bg_upsampler realesrgan --face_upsample -w 1.0 --input_path

 

The fidelity weight w is located in [0, 1]. In general, smaller w tends to produce higher quality results, while larger w produces higher fidelity results.

The results will be saved in the results folder.

 

CodeFormer One-Click Deployment Kit

CodeFormer colab运行

CodeFormer HuggingFace 运行

CodeFormer Windows版

CodeFormer WebUI 牛哥版 (密码niugee51)

© Copyright notes
AiPPT

Related posts

No comments

none
No comments...