Skip to content

Commit b41571e

Browse files
committed
update LICENSE and README.md
1 parent 98d67b5 commit b41571e

File tree

2 files changed

+37
-111
lines changed

2 files changed

+37
-111
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2020 nihui
3+
Copyright (c) 2021 ArchieMeng
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 36 additions & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,37 @@
1-
# RIFE ncnn Vulkan
1+
# RIFE ncnn Vulkan Python
22

3-
![CI](https://github.com/nihui/rife-ncnn-vulkan/workflows/CI/badge.svg)
3+
## Introduction
4+
[rife-ncnn-vulkan](https://github.com/nihui/rife-ncnn-vulkan) is nihui's ncnn implementation of Real-World Super-Resolution via Kernel Estimation and Noise Injection super resolution.
45

5-
ncnn implementation of RIFE, Real-Time Intermediate Flow Estimation for Video Frame Interpolation.
6+
rife-ncnn-vulkan-python wraps [rife-ncnn-vulkan project](https://github.com/nihui/rife-ncnn-vulkan) by SWIG to make it easier to integrate rife-ncnn-vulkan with existing python projects.
67

7-
rife-ncnn-vulkan uses [ncnn project](https://github.com/Tencent/ncnn) as the universal neural network inference framework.
8+
## Downloads
89

9-
## [Download](https://github.com/nihui/rife-ncnn-vulkan/releases)
10+
Linux/Windos/Mac X86_64 build releases are available now. However, for Linux you may need to compile it yourself if you
11+
are using python version other than 3.8 . (The compiled python C extension library is bound to python version now)
1012

11-
Download Windows/Linux/MacOS Executable for Intel/AMD/Nvidia GPU
13+
## Build
1214

13-
**https://github.com/nihui/rife-ncnn-vulkan/releases**
15+
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:
1416

15-
This package includes all the binaries and models required. It is portable, so no CUDA or PyTorch runtime environment is needed :)
17+
### Linux
18+
```shell
19+
git clone https://github.com/ArchieMeng/rife-ncnn-vulkan-python.git
20+
cd rife-ncnn-vulkan-python
21+
git submodule update --init --recursive
22+
cmake -B build src
23+
cd build
24+
make
25+
```
26+
27+
### Windows
28+
I used Visual Studio 2019 and msvc v142 to build this project for Windows.
29+
30+
Install visual studio and open the project directory, and build. Job done.
31+
32+
The only problem on Windows is that, you cannot use [CMake for Windows](https://cmake.org/download/) to generate the Visual Studio solution file and build it. This will make the lib crash on loading.
33+
34+
The only way is [use Visual Studio to open the project as directory](https://www.microfocus.com/documentation/visual-cobol/vc50/VS2019/GUID-BE1C48AA-DB22-4F38-9644-E9B48658EF36.html), and build it from Visual Studio.
1635

1736
## About RIFE
1837

@@ -25,112 +44,26 @@ Huang, Zhewei and Zhang, Tianyuan and Heng, Wen and Shi, Boxin and Zhou, Shuchan
2544
https://rife-vfi.github.io
2645

2746
https://arxiv.org/abs/2011.06294
28-
2947
## Usages
3048

31-
Input two frame images, output one interpolated frame image.
32-
33-
### Example Commands
34-
35-
```shell
36-
./rife-ncnn-vulkan -0 0.jpg -1 1.jpg -o 01.jpg
37-
./rife-ncnn-vulkan -i input_frames/ -o output_frames/
38-
```
39-
40-
Example below runs on CPU, Discrete GPU, and Integrated GPU all at the same time. Uses 2 threads for image decoding, 4 threads for one CPU worker, 4 threads for another CPU worker, 2 threads for discrete GPU, 1 thread for integrated GPU, and 4 threads for image encoding.
41-
```shell
42-
./rife-ncnn-vulkan -i input_frames/ -o output_frames/ -g -1,-1,0,1 -j 2:4,4,2,1:4
43-
```
44-
45-
### Video Interpolation with FFmpeg
46-
47-
```shell
48-
mkdir input_frames
49-
mkdir output_frames
50-
51-
# find the source fps and format with ffprobe, for example 24fps, AAC
52-
ffprobe input.mp4
49+
### Example Program
5350

54-
# extract audio
55-
ffmpeg -i input.mp4 -vn -acodec copy audio.m4a
51+
```Python
52+
from PIL import Image
53+
from rife_ncnn_vulkan import RIFE
5654

57-
# decode all frames
58-
ffmpeg -i input.mp4 input_frames/frame_%08d.png
59-
60-
# interpolate 2x frame count
61-
./rife-ncnn-vulkan -i input_frames -o output_frames
62-
63-
# encode interpolated frames in 48fps with audio
64-
ffmpeg -framerate 48 -i output_frames/%08d.png -i audio.m4a -c:a copy -crf 20 -c:v libx264 -pix_fmt yuv420p output.mp4
65-
```
66-
67-
### Full Usages
68-
69-
```console
70-
Usage: rife-ncnn-vulkan -0 infile -1 infile1 -o outfile [options]...
71-
rife-ncnn-vulkan -i indir -o outdir [options]...
72-
73-
-h show this help
74-
-v verbose output
75-
-0 input0-path input image0 path (jpg/png/webp)
76-
-1 input1-path input image1 path (jpg/png/webp)
77-
-i input-path input image directory (jpg/png/webp)
78-
-o output-path output image path (jpg/png/webp) or directory
79-
-m model-path rife model path (default=rife-HD)
80-
-g gpu-id gpu device to use (-1=cpu, default=auto) can be 0,1,2 for multi-gpu
81-
-j load:proc:save thread count for load/proc/save (default=1:2:2) can be 1:2,2,2:2 for multi-gpu
82-
-x enable tta mode
83-
-u enable UHD mode
84-
-f pattern-format output image filename pattern format (%08d.jpg/png/webp, default=ext/%08d.png)
55+
im0, im1 = Image.open("0.png"), Image.open("1.png")
56+
rife = RIFE(0)
57+
im = rife.process(im0, im1)
58+
im.save("interframe.png")
8559
```
8660

87-
- `input0-path`, `input1-path` and `output-path` accept file path
88-
- `input-path` and `output-path` accept file directory
89-
- `load:proc:save` = thread count for the three stages (image decoding + rife interpolation + image encoding), using larger values may increase GPU usage and consume more GPU memory. You can tune this configuration with "4:4:4" for many small-size images, and "2:2:2" for large-size images. The default setting usually works fine for most situations. If you find that your GPU is hungry, try increasing thread count to achieve faster processing.
90-
- `pattern-format` = the filename pattern and format of the image to be output, png is better supported, however webp generally yields smaller file sizes, both are losslessly encoded
91-
9261
If you encounter a crash or error, try upgrading your GPU driver:
9362

9463
- Intel: https://downloadcenter.intel.com/product/80939/Graphics-Drivers
9564
- AMD: https://www.amd.com/en/support
9665
- NVIDIA: https://www.nvidia.com/Download/index.aspx
9766

98-
## Build from Source
99-
100-
1. Download and setup the Vulkan SDK from https://vulkan.lunarg.com/
101-
- For Linux distributions, you can either get the essential build requirements from package manager
102-
```shell
103-
dnf install vulkan-headers vulkan-loader-devel
104-
```
105-
```shell
106-
apt-get install libvulkan-dev
107-
```
108-
```shell
109-
pacman -S vulkan-headers vulkan-icd-loader
110-
```
111-
112-
2. Clone this project with all submodules
113-
114-
```shell
115-
git clone https://github.com/nihui/rife-ncnn-vulkan.git
116-
cd rife-ncnn-vulkan
117-
git submodule update --init --recursive
118-
```
119-
120-
3. Build with CMake
121-
- You can pass -DUSE_STATIC_MOLTENVK=ON option to avoid linking the vulkan loader library on MacOS
122-
123-
```shell
124-
mkdir build
125-
cd build
126-
cmake ../src
127-
cmake --build . -j 4
128-
```
129-
130-
### TODO
131-
132-
* test-time temporal augmentation aka TTA-t
133-
13467
### Model
13568

13669
| model | upstream version |
@@ -152,18 +85,10 @@ cmake --build . -j 4
15285

15386
### Interpolate with rife rife-anime model
15487

155-
```shell
156-
rife-ncnn-vulkan.exe -m models/rife-anime -0 0.png -1 1.png -o out.png
157-
```
158-
15988
![rife](images/out.png)
16089

16190
### Interpolate with rife rife-anime model + TTA-s
16291

163-
```shell
164-
rife-ncnn-vulkan.exe -m models/rife-anime -x -0 0.png -1 1.png -o out.png
165-
```
166-
16792
![rife](images/outx.png)
16893

16994
## Original RIFE Project
@@ -176,3 +101,4 @@ rife-ncnn-vulkan.exe -m models/rife-anime -x -0 0.png -1 1.png -o out.png
176101
- https://github.com/webmproject/libwebp for encoding and decoding Webp images on ALL PLATFORMS
177102
- https://github.com/nothings/stb for decoding and encoding image on Linux / MacOS
178103
- https://github.com/tronkko/dirent for listing files in directory on Windows
104+
- https://github.com/nihui/rife-ncnn-vulkan the original rife-ncnn-vulkan project

0 commit comments

Comments
 (0)