Skip to content

ACodeSubmissionTool/PoseRFR

Repository files navigation

The devil is in the details: Delving into large-pose blind face restoration

⚔️Installation

pip install -r requirements.txt

🧬Pretrained Models And Datasets

The pretrained model weights, test_set and partial tranining set from FFHQ can be found on the BaiduYun.

⚔️Inference

We prepare some examples to show how to do inference.

: Stage I Inference

python inference_face.py  --config ./configs/model/cldm_twoS.yaml  --input input_path --ckpt ./checkpoints/stage1.ckpt --output output_path --device cuda 

: Stage II Inference

python inference_face.py  --config ./configs/model/cldm_twoS_wD.yaml  --input input_path --ckpt ./checkpoints/stage2.ckpt --output output_path   --device cuda 

: Stage III Inference

python inference_face.py  --config ./configs/model/cldm_twoS_AFR.yaml  --use_afr --input input_path  --ckpt ./checkpoints/stage2.ckpt --output output_path   --device cuda 

🌠Train

  1. Generate file list of training set and validation set, a file list looks like:

    /path/to/image_1
    /path/to/image_2
    /path/to/image_3

    We prepare a script for you to generate the file list: make_file_list.

    python make_file_list.py --img_folder ./data_folder --save_path ./test.list 
    
  2. Fill in the train and val configuration file with yout file list script: face*.yaml.

  3. training stage I

    HF_ENDPOINT=https://hf-mirror.com python train.py --config ./configs/train_stage1.yaml
  4. training stage II

    HF_ENDPOINT=https://hf-mirror.com python train.py --config ./configs/train_stage2.yaml
  5. generate latent code to reduce computation cost:

    python inference_face.py  --config ./configs/model/cldm_twoS_wD.yaml --generate_latent  --ckpt ./checkpoints/stage2.ckpt --output ./results/test_generate  --device cuda 

    This code will generate the latent code to ' ./results/test_generate ', please use make_file_list to generate file list and replace the path in stage3*.yaml

  6. training stage III

    HF_ENDPOINT=https://hf-mirror.com python train.py --config ./configs/train_stage3.yaml

Acknowledgement

This project is based on ControlNet, BasicSR, StableSR, DiffBIR, GFPGAN, DifFace. Thanks for their awesome work.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages