AI面部修复项目:GFP-GAN

GitHub项目页: https://github.com/TencentARC/GFPGAN

Hugging Face试玩传送门: https://huggingface.co/spaces/akhaliq/GFPGAN

安装anaconda

下载解压GFPGAN-0.2.0.zip文件

安装dependent 包

安装 basicsr - https://github.com/xinntao/BasicSR

# We use BasicSR for both training and inference

pip install basicsr

安装 facexlib - https://github.com/xinntao/facexlib

# We use face detection and face restoration helper in the facexlib package

pip install facexlib

pip install -r requirements.txt 图片推理转换

python inference_gfpgan_full.py --upscale_factor 2 --test_path inputs/whole_imgs --save_root results

已训练模型https://github.com/TencentARC/GFPGAN/releases/download/v0.2.0/GFPGANCleanv1-NoCE-C2.pth 下载拷贝到 experiments/pretrained_models目录

相关参数配置

parser.add_argument(--upscale_factor, type=int, default=2) parser.add_argument(--arch, type=str, default=clean) parser.add_argument(--channel, type=int, default=2) parser.add_argument(--model_path, type=str, default=experiments/pretrained_models/GFPGANCleanv1-NoCE-C2.pth) parser.add_argument(--test_path, type=str, default=inputs/whole_imgs) parser.add_argument(--suffix, type=str, default=None, help=Suffix of the restored faces) parser.add_argument(--only_center_face, action=store_true) parser.add_argument(--aligned, action=store_true) parser.add_argument(--paste_back, action=store_false) parser.add_argument(--save_root, type=str, default=results)

经验分享 程序员 微信小程序 职场和发展