利用腾讯GFPGAN修复人脸
腾讯出的开源人脸修复
今天试了下,效果还不错,特地分享下
依赖和安装
Python >= 3.7
PyTorch >= 1.7
可选:NVIDIA GPU + CUDA
可选:Linux
步骤
1.安装Python
https://www.python.org/downloads/windows/
2.安装
PyTorch
可使用conda、pip 安装
3.
git clone https://github.com/TencentARC/GFPGAN.git
cd GFPGAN
4.
pip install basicsr
pip install facexlib
pip install -r requirements.txt
#安装gfpgan
python setup.py develop
#安装背景增强realesrgan模块 可选
pip install realesrgan
5.
下载预训练模型:GFPGANv1.3.pth
具体最新模型链接前往GitHub查看
下载好的文件放在***\GFPGAN\experiments\pretrained_models
6.
python inference_gfpgan.py -i inputs/whole_imgs -o results -v 1.3 -s 2
inputs/whole_imgs 为原始图片位置 生成文件夹为results
具体参数:
Usage: python inference_gfpgan.py -i inputs/whole_imgs -o results -v 1.3 -s 2 [options]... -h show this help -i input Input image or folder. Default: inputs/whole_imgs -o output Output folder. Default: results -v version GFPGAN model version. Option: 1 | 1.2 | 1.3. Default: 1.3 -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
这里贴一个腾讯处理的图片
提醒
这里有在线体验版
GFPGAN的 Colab演示;(原始纸模型的另一个Colab Demo )
在线演示:Huggingface(仅返回裁剪后的脸)
在线演示:Replicate.ai(可能需要登录,返回全图)
在线演示:Baseten.co(由 GPU 支持,返回整个图像)
2 文章永久网址:https://www.xhily.com/691.html
3 本网站的文章部分内容可能来源于网络,仅供大家学习与参考,如有侵权,请联系站长0000F进行删除处理。
4 本站一切资源不代表本站立场,并不代表本站赞同其观点和对其真实性负责。
5 本站一律禁止以任何方式发布或转载任何违法的相关信息,访客发现请向站长举报
6 本站资源大多存储在云盘,如发现链接失效,请联系我们我们会第一时间更新。
7 如无特别声明本文即为原创文章仅代表个人观点,版权归《无用笔记》所有,欢迎转载,转载请保留原文链接。
