Skip to main content

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

Project description

RIFE ncnn Vulkan Python

CI

Introduction

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

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

Downloads

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

For PyPI supports, we are working on it, and hope will publish it on PyPI in the future.

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, there are two ways to build it:

  • Use setuptools to build and install into python package directly. (Currently in developing)
  • Use CMake directly (The old way)

Use setuptools

python setup.py install

Use CMake

Linux

git clone https://github.com/ArchieMeng/rife-ncnn-vulkan-python.git
cd rife-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 GUI to generate the Visual Studio solution file and build it. This will make the lib crash on loading.

One way is using Visual Studio to open the project as directory, and build it from Visual Studio. And another way is build it from powershell just like what is written in the release.yml

About RIFE

RIFE (Real-Time Intermediate Flow Estimation for Video Frame Interpolation)

https://github.com/hzwer/arXiv2020-RIFE

Huang, Zhewei and Zhang, Tianyuan and Heng, Wen and Shi, Boxin and Zhou, Shuchang

https://rife-vfi.github.io

https://arxiv.org/abs/2011.06294

Usages

Example Program

from rife_ncnn_vulkan_python import Rife
from PIL import Image

with Image.open("input0.png") as image0:
    with Image.open("input1.png") as image1:
      rife = Rife(gpuid=0)
      image = rife.process(image0, image1)
      image.save("output.png")

If you encounter a crash or error, try upgrading your GPU driver:

Model

model upstream version
rife 1.2
rife-HD 1.5
rife-UHD 1.6
rife-anime 1.8
rife-v2 2.0
rife-v2.3 2.3
rife-v2.4 2.4
rife-v3.0 3.0
rife-v3.1 3.1

Original RIFE 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

rife-ncnn-vulkan-python-1.0.3.tar.gz (19.2 MB view details)

Uploaded Source

File details

Details for the file rife-ncnn-vulkan-python-1.0.3.tar.gz.

File metadata

  • Download URL: rife-ncnn-vulkan-python-1.0.3.tar.gz
  • Upload date:
  • Size: 19.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.8.1 pkginfo/1.8.2 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.10.2

File hashes

Hashes for rife-ncnn-vulkan-python-1.0.3.tar.gz
Algorithm Hash digest
SHA256 a14bd851c081790ff9e0c9c9b39c769bbb5d8647de7b15df7558ee74c1d0cc78
MD5 188af0afd77f49a512a386b4ae881ae9
BLAKE2b-256 001a201316ce9c03b3e092bd3da36f82a9271d677866309fcfe225fb85549a00

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