利用腾讯GFPGAN修复人脸

腾讯出的开源人脸修复

来源:Github

今天试了下,效果还不错,特地分享下

依赖和安装

Python >= 3.7 

PyTorch >= 1.7

可选:NVIDIA GPU + CUDA

可选:Linux

步骤

1.安装Python

https://www.python.org/downloads/windows/

2.安装

PyTorch

https://pytorch.org/

可使用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 支持,返回整个图像)

本文链接:https://www.xhily.com/691.html
版权声明:本博客所有文章除特别声明外,均采用 CC BY 4.0 CN协议 许可协议。转载请注明出处!
THE END
分享
二维码
打赏
海报
利用腾讯GFPGAN修复人脸
腾讯出的开源人脸修复 GFPGAN 来源:Github ……
<<上一篇
下一篇>>
文章目录
关闭
目 录