使用SWIG实现的Python FFI nihui/realsr-ncnn-vulkan
项目描述
RealSR ncnn Vulkan Python
简介
realsr-ncnn-vulkan是nihui基于ncnn实现的Real-World Super-Resolution通过核估计和噪声注入的超分辨率。
realsr-ncnn-vulkan-python通过SWIG封装了realsr-ncnn-vulkan项目,使其更容易将realsr-ncnn-vulkan与现有Python项目集成。
下载
现在提供了Linux/Windos/Mac X86_64构建版本。
然而,对于GLIBC < 2.29的Linux发行版(如Ubuntu 18.04),应使用ubuntu-1804预构建版本。
构建
首先,您必须在您的平台上安装python、python开发包(Visual Studio中的Python原生开发库)、vulkan SDK和SWIG。然后
Linux
git clone https://github.com/ArchieMeng/realsr-ncnn-vulkan-python.git
cd realsr-ncnn-vulkan-python
git submodule update --init --recursive
cmake -B build src
cd build
make
Windows
我使用Visual Studio 2019和msvc v142为Windows构建了这个项目。
安装Visual Studio并打开项目目录,然后构建。任务完成。
Windows上唯一的问题是,您不能使用Windows版CMake来生成Visual Studio解决方案文件并进行构建。这会导致库在加载时崩溃。
唯一的方法是使用Visual Studio以目录方式打开项目,并从Visual Studio中构建它。
关于RealSR
通过核估计和噪声注入实现真实世界超分辨率(CVPRW 2020)
https://github.com/jixiaozhong/RealSR
贾晓中,曹云,台颖,王成杰,李吉林,黄飞岳
腾讯优图实验室
我们的解决方案在CVPR NTIRE 2020真实世界超分辨率挑战赛的两个赛道上均获得了冠军。
https://arxiv.org/abs/2005.01996
用法
示例程序
from PIL import Image
from realsr_ncnn_vulkan import RealSR
# if installed from pypi or binary wheels,
# from realsr_ncnn_vulkan_python import RealSR
im = Image.open("0.png")
upscaler = RealSR(0, scale=4)
out_im = upscaler.process(im)
out_im.save("temp.png")
如果您遇到崩溃或错误,请尝试升级您的GPU驱动程序
- Intel: https://downloadcenter.intel.com/product/80939/Graphics-Drivers
- AMD: https://www.amd.com/en/support
- NVIDIA: https://www.nvidia.com/Download/index.aspx
Original RealSR NCNN Vulkan Project
Original RealSR Project
Other Open-Source Code Used
- https://github.com/Tencent/ncnn for fast neural network inference on ALL PLATFORMS
- https://github.com/webmproject/libwebp for encoding and decoding Webp images on ALL PLATFORMS
- https://github.com/nothings/stb for decoding and encoding image on Linux / MacOS
- https://github.com/tronkko/dirent for listing files in directory on Windows
Project details
Hashes for realsr-ncnn-vulkan-python-1.0.6.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2b0427c561e90867eae9a12551100a05a46eb8b0c3f3bea1b9821923669a350a |
|
MD5 | c35035991dcb1cf8f193e91940fbc7bb |
|
BLAKE2b-256 | 751703e75d9498a43e9770a3043cc8b587e868bf6d4f2a60fda3305ffac8b2b5 |