Skip to main content

A Python FFI of nihui/realsr-ncnn-vulkan achieved with SWIG

Project description

RealSR ncnn Vulkan Python

Introduction

realsr-ncnn-vulkan is nihui's ncnn implementation of Real-World Super-Resolution via Kernel Estimation and Noise Injection super resolution.

realsr-ncnn-vulkan-python wraps realsr-ncnn-vulkan project by SWIG to make it easier to integrate realsr-ncnn-vulkan with existing python projects.

Downloads

Linux/Windos/Mac X86_64 build releases are available now.

However, for Linux distro with GLIBC < 2.29 (like Ubuntu 18.04), the ubuntu-1804 pre-built should be used.

Build

First, you have to install python, python development package (Python native development libs in Visual Studio), vulkan SDK and SWIG on your platform. And then:

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

I used Visual Studio 2019 and msvc v142 to build this project for Windows.

Install visual studio and open the project directory, and build. Job done.

The only problem on Windows is that, you cannot use CMake for Windows to generate the Visual Studio solution file and build it. This will make the lib crash on loading.

The only way is use Visual Studio to open the project as directory, and build it from Visual Studio.

About RealSR

Real-World Super-Resolution via Kernel Estimation and Noise Injection (CVPRW 2020)

https://github.com/jixiaozhong/RealSR

Xiaozhong Ji, Yun Cao, Ying Tai, Chengjie Wang, Jilin Li, and Feiyue Huang

Tencent YouTu Lab

Our solution is the winner of CVPR NTIRE 2020 Challenge on Real-World Super-Resolution in both tracks.

https://arxiv.org/abs/2005.01996

Usages

Example Program

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")

If you encounter crash or error, try to upgrade your GPU driver

Original RealSR NCNN Vulkan Project

Original RealSR Project

Other Open-Source Code Used

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

realsr-ncnn-vulkan-python-1.0.6.tar.gz (83.2 MB view details)

Uploaded Source

File details

Details for the file realsr-ncnn-vulkan-python-1.0.6.tar.gz.

File metadata

  • Download URL: realsr-ncnn-vulkan-python-1.0.6.tar.gz
  • Upload date:
  • Size: 83.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.1 pkginfo/1.8.3 requests/2.28.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.5

File hashes

Hashes for realsr-ncnn-vulkan-python-1.0.6.tar.gz
Algorithm Hash digest
SHA256 2b0427c561e90867eae9a12551100a05a46eb8b0c3f3bea1b9821923669a350a
MD5 c35035991dcb1cf8f193e91940fbc7bb
BLAKE2b-256 751703e75d9498a43e9770a3043cc8b587e868bf6d4f2a60fda3305ffac8b2b5

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page