pip install -r requirements.txtThe pretrained model weights, test_set and partial tranining set from FFHQ can be found on the BaiduYun.
We prepare some examples to show how to do inference.
python inference_face.py --config ./configs/model/cldm_twoS.yaml --input input_path --ckpt ./checkpoints/stage1.ckpt --output output_path --device cuda python inference_face.py --config ./configs/model/cldm_twoS_wD.yaml --input input_path --ckpt ./checkpoints/stage2.ckpt --output output_path --device cuda
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 -
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
-
Fill in the train and val configuration file with yout file list script: face*.yaml.
-
training stage I
HF_ENDPOINT=https://hf-mirror.com python train.py --config ./configs/train_stage1.yaml
-
training stage II
HF_ENDPOINT=https://hf-mirror.com python train.py --config ./configs/train_stage2.yaml
-
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
-
training stage III
HF_ENDPOINT=https://hf-mirror.com python train.py --config ./configs/train_stage3.yaml
This project is based on ControlNet, BasicSR, StableSR, DiffBIR, GFPGAN, DifFace. Thanks for their awesome work.