GFP-GAN容器构建说明

一、介绍

  • GFP-GAN是腾讯在人像复原、超分等方面的佳作 ,其基于 FFHQ 上训练,由 70000 张高质量图像组成。在训练过程中,将所有图像的大小调整为5122。
  • GFP-GAN 是在合成数据上训练的,这些合成数据近似于真实的低质量图像,并在推理过程中推广到真实世界的图像,可用于真实世界面部高清修复。

更多详细信息见Github仓库

二、容器构建说明

GFP-GAN并未自带web交互页面,因此,克隆项目后,安装项目所需环境后,在运行前后需要自行在文件夹中放入和获取相关图片。

1. 依赖关系和安装

#克隆仓库

git clone https://github.com/TencentARC/GFPGAN.git
cd GFPGAN

#安装依赖

apt-get update
apt-get install -y libgl1 git libglib2.0-0 pyyaml -i https://pypi.tuna.tsinghua.edu.cn/simple

依次安装以下包

pip install basicsr
pip install facexlib
pip install -r requirements.txt

运行代码:

python setup.py develop

下载模型v1.3版本:

wget https://github.com/TencentARC/GFPGAN/releases/download/v1.3.0/GFPGANv1.3.pth -P experiments/pretrained_models

模型v1.2版本为(可自行选择下载,放置在experiments/pretrained_models中):

https://github.com/TencentARC/GFPGAN/releases/download/v0.2.0/GFPGANCleanv1-NoCE-C2.pth

2. 进行推理

python inference_gfpgan.py -i inputs/whole_imgs -o results -v 1.3 -s 2

推理相关注释:

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
相关推荐
池央5 分钟前
AI性能极致体验:通过阿里云平台高效调用满血版DeepSeek-R1模型
人工智能·阿里云·云计算
我们的五年6 分钟前
DeepSeek 和 ChatGPT 在特定任务中的表现:逻辑推理与创意生成
人工智能·chatgpt·ai作画·deepseek
Yan-英杰7 分钟前
百度搜索和文心智能体接入DeepSeek满血版——AI搜索的新纪元
图像处理·人工智能·python·深度学习·deepseek
Fuweizn9 分钟前
富唯智能可重构柔性装配产线:以智能协同赋能制造业升级
人工智能·智能机器人·复合机器人
taoqick2 小时前
对PosWiseFFN的改进: MoE、PKM、UltraMem
人工智能·pytorch·深度学习
suibian52352 小时前
AI时代:前端开发的职业发展路径拓宽
前端·人工智能
预测模型的开发与应用研究3 小时前
数据分析的AI+流程(个人经验)
人工智能·数据挖掘·数据分析
源大模型3 小时前
OS-Genesis:基于逆向任务合成的 GUI 代理轨迹自动化生成
人工智能·gpt·智能体
PowerBI学谦5 小时前
Python in Excel高级分析:一键RFM分析
大数据·人工智能·pandas
运维开发王义杰5 小时前
AI: Unsloth + Llama 3 微调实践,基于Colab
人工智能·llama