感谢您对我们的工作的兴趣。您可能还想检查我们在Real-Esrgan中有关动漫图像和视频的小型模型的新更新吗?
GFPGAN旨在开发一种实用算法,用于现实世界的面部修复。
它利用封装在经过验证的面孔(例如stylegan2)中的丰富而多样的先验来进行盲人脸部修复。
❓常见问题可以在常见问题中找到。
更新
如果GFPGAN在您的照片/项目中有所帮助,请帮助此存储库或向您的朋友推荐。谢谢?其他推荐项目:
[纸] [项目页] [演示]
Xintao Wang,Yu Li,Honglun Zhang,Ying Shan
应用研究中心(ARC),腾讯PCG
现在,我们提供了GFPGAN的干净版本,该版本不需要定制的CUDA扩展。
如果您想在我们的论文中使用原始型号,请参阅papermodel.md进行安装。
克隆回购
git clone https://github.com/TencentARC/GFPGAN.git
cd GFPGAN安装因软件包
# Install basicsr - https://github.com/xinntao/BasicSR
# We use BasicSR for both training and inference
pip install basicsr
# Install 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 setup.py develop
# If you want to enhance the background (non-face) regions with Real-ESRGAN,
# you also need to install the realesrgan package
pip install realesrgan我们以v1.3版本为例。可以在这里找到更多型号。
下载预训练的模型:gfpganv1.3.pth
wget https://github.com/TencentARC/GFPGAN/releases/download/v1.3.0/GFPGANv1.3.pth -P experiments/pretrained_models推理!
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如果您想在我们的论文中使用原始型号,请参阅papermodel.md进行安装和推理。
| 版本 | 模型名称 | 描述 |
|---|---|---|
| v1.3 | gfpganv1.3.pth | 基于v1.2;更自然的恢复结果;在非常低质量 /高质量的输入方面更好的结果。 |
| v1.2 | gfpgancleanv1-noce-c2.pth | 没有着色;不需要CUDA扩展。接受了更多数据进行预处理培训。 |
| V1 | gfpganv1.pth | 纸质模型,带有着色。 |
比较是比较。
请注意,v1.3并不总是比v1.2好。您可能需要根据您的目的和输入选择不同的模型。
| 版本 | 优势 | 弱点 |
|---|---|---|
| v1.3 | ✓自然产出 ✓非常低质量的输入结果 ✓处理相对较高的输入 ✓可以重复(两次)修复 | ✗不是很清晰 ✗身份有轻微的改变 |
| v1.2 | ✓锐利的输出 ✓带有美容妆 | ✗有些输出不自然 |
您可以在此处找到更多模型(例如歧视器) :[Google Drive]或[Tencent Cloud腾讯微云]
我们提供GFPGAN的培训代码(在我们的论文中使用)。
您可以根据自己的需求改进它。
尖端
程序
(您可以尝试一个简单的版本( options/train_gfpgan_v1_simple.yml ),不需要面部分量地标。)
数据集准备:FFHQ
下载预训练的模型和其他数据。将它们放入experiments/pretrained_models文件夹中。
相应地修改配置文件options/train_gfpgan_v1.yml 。
训练
python -m torch.distributed.launch -nproc_per_node = 4 -master_port = 22021 gfpgan/train.py -opt options/train_gfpgan_v1.yml -launcher pytorch
GFPGAN由Apache许可证2.0版发布。
@InProceedings{wang2021gfpgan,
author = {Xintao Wang and Yu Li and Honglun Zhang and Ying Shan},
title = {Towards Real-World Blind Face Restoration with Generative Facial Prior},
booktitle={The IEEE Conference on Computer Vision and Pattern Recognition (CVPR)},
year = {2021}
}
如果您有任何疑问,请发送电子邮件[email protected]或[email protected] 。