:fire: 更新动漫视频的小模型 RealESRGAN AnimeVideo-v3. 更多信息在 [动漫视频模型介绍] 和 [比较] 中.
Real-ESRGAN 的目标是开发出实用的图像/视频修复算法。
我们在 ESRGAN 的基础上使用纯合成的数据来进行训练,以使其能被应用于实际的图片修复的场景(顾名思义:Real-ESRGAN)。
:art: Real-ESRGAN 需要,也很欢迎你的贡献,如新功能、模型、bug修复、建议、维护等等。详情可以查看CONTRIBUTING.md,所有的贡献者都会被列在此处。
:milky_way: 感谢大家提供了很好的反馈。这些反馈会逐步更新在 这个文档。
:question: 常见的问题可以在FAQ.md中找到答案。(好吧,现在还是空白的=-=||)
如果 Real-ESRGAN 对你有帮助,可以给本项目一个 Star :star: ,或者推荐给你的朋友们,谢谢!:blush:
其他推荐的项目:
:arrow_forward: GFPGAN: 实用的人脸复原算法
:arrow_forward: BasicSR: 开源的图像和视频工具箱
:arrow_forward: facexlib: 提供与人脸相关的工具箱
:arrow_forward: HandyView: 基于PyQt5的图片查看器,方便查看以及比较
[论文] [项目主页] [YouTube 视频] [B站视频] [Poster] [PPT]
Xintao Wang, Liangbin Xie, Chao Dong, Ying Shan
Tencent ARC Lab; Shenzhen Institutes of Advanced Technology, Chinese Academy of Sciences
我们提供了一套训练好的模型(RealESRGAN_x4plus.pth),可以进行4倍的超分辨率。
现在的 Real-ESRGAN 还是有几率失败的,因为现实生活的降质过程比较复杂。
而且,本项目对人脸以及文字之类的效果还不是太好,但是我们会持续进行优化的。
Real-ESRGAN 将会被长期支持,我会在空闲的时间中持续维护更新。
这些是未来计划的几个新功能:
如果你有好主意或需求,欢迎在 issue 或 discussion 中提出。
如果你有一些 Real-ESRGAN 中有问题的照片,你也可以在 issue 或者 discussion 中发出来。我会留意(但是不一定能解决:stuck_out_tongue:)。如果有必要的话,我还会专门开一页来记录那些有待解决的图像。
你可以下载支持Intel/AMD/Nvidia显卡的绿色版exe文件: Windows版 / Linux版 / macOS版。
绿色版指的是这些exe你可以直接运行(放U盘里拷走都没问题),因为里面已经有所需的文件和模型了。它不需要 CUDA 或者 PyTorch运行环境。
你可以通过下面这个命令来运行(Windows版本的例子,更多信息请查看对应版本的README.md):
./realesrgan-ncnn-vulkan.exe -i 输入图像.jpg -o 输出图像.png -n 模型名字
我们提供了五种模型:
你可以通过-n
参数来使用其他模型,例如./realesrgan-ncnn-vulkan.exe -i 二次元图片.jpg -o 二刺螈图片.png -n realesrgan-x4plus-anime
注意:可执行文件并没有支持 python 脚本 inference_realesrgan.py
中所有的功能,比如 outscale
选项) .
Usage: realesrgan-ncnn-vulkan.exe -i infile -o outfile [options]...
-h show this help
-i input-path input image path (jpg/png/webp) or directory
-o output-path output image path (jpg/png/webp) or directory
-s scale upscale ratio (can be 2, 3, 4. default=4)
-t tile-size tile size (>=32/0=auto, default=0) can be 0,0,0 for multi-gpu
-m model-path folder path to the pre-trained models. default=models
-n model-name model name (default=realesr-animevideov3, can be realesr-animevideov3 | realesrgan-x4plus | realesrgan-x4plus-anime | realesrnet-x4plus)
-g gpu-id gpu device to use (default=auto) can be 0,1,2 for multi-gpu
-j load:proc:save thread count for load/proc/save (default=1:2:2) can be 1:2,2,2:2 for multi-gpu
-x enable tta mode"
-f format output image format (jpg/png/webp, default=ext/png)
-v verbose output
由于这些exe文件会把图像分成几个板块,然后来分别进行处理,再合成导出,输出的图像可能会有一点割裂感(而且可能跟PyTorch的输出不太一样)
把项目克隆到本地
git clone https://github.com/xinntao/Real-ESRGAN.git
cd Real-ESRGAN
安装各种依赖
# 安装 basicsr - https://github.com/xinntao/BasicSR
# 我们使用BasicSR来训练以及推断
pip install basicsr
# facexlib和gfpgan是用来增强人脸的
pip install facexlib
pip install gfpgan
pip install -r requirements.txt
python setup.py develop
下载我们训练好的模型: RealESRGAN_x4plus.pth
wget https://github.com/xinntao/Real-ESRGAN/releases/download/v0.1.0/RealESRGAN_x4plus.pth -P weights
推断!
python inference_realesrgan.py -n RealESRGAN_x4plus -i inputs --face_enhance
结果在results
文件夹
训练好的模型: RealESRGAN_x4plus_anime_6B
有关waifu2x的更多信息和对比在anime_model.md中。
# 下载模型
wget https://github.com/xinntao/Real-ESRGAN/releases/download/v0.2.2.4/RealESRGAN_x4plus_anime_6B.pth -P weights
# 推断
python inference_realesrgan.py -n RealESRGAN_x4plus_anime_6B -i inputs
结果在results
文件夹
虽然你使用了 X4 模型,但是你可以 输出任意尺寸比例的图片,只要实用了 outscale
参数. 程序会进一步对模型的输出图像进行缩放。
Usage: python inference_realesrgan.py -n RealESRGAN_x4plus -i infile -o outfile [options]...
A common command: python inference_realesrgan.py -n RealESRGAN_x4plus -i infile --outscale 3.5 --face_enhance
-h show this help
-i --input Input image or folder. Default: inputs
-o --output Output folder. Default: results
-n --model_name Model name. Default: RealESRGAN_x4plus
-s, --outscale The final upsampling scale of the image. Default: 4
--suffix Suffix of the restored image. Default: out
-t, --tile Tile size, 0 for no tile during testing. Default: 0
--face_enhance Whether to use GFPGAN to enhance face. Default: False
--fp32 Whether to use half precision during inference. Default: False
--ext Image extension. Options: auto | jpg | png, auto means using the same extension as inputs. Default: auto
这里有一份详细的指南:Training.md.
@Article{wang2021realesrgan,
title={Real-ESRGAN: Training Real-World Blind Super-Resolution with Pure Synthetic Data},
author={Xintao Wang and Liangbin Xie and Chao Dong and Ying Shan},
journal={arXiv:2107.10833},
year={2021}
}
如果你有任何问题,请通过 xintao.wang@outlook.com
或 xintaowang@tencent.com
联系我们。
感谢所有的贡献者大大们~