• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

.github/H10-Feb-2021-386368

images/H03-May-2022-

models/H10-Feb-2021-2,0042,002

src/H03-May-2022-1,063,501920,381

.gitmodulesH A D10-Feb-2021179 76

LICENSEH A D10-Feb-20211 KiB2217

README.mdH A D10-Feb-20214.6 KiB14195

README.md

1# RealSR ncnn Vulkan
2
3![CI](https://github.com/nihui/realsr-ncnn-vulkan/workflows/CI/badge.svg)
4
5ncnn implementation of Real-World Super-Resolution via Kernel Estimation and Noise Injection super resolution.
6
7realsr-ncnn-vulkan uses [ncnn project](https://github.com/Tencent/ncnn) as the universal neural network inference framework.
8
9## [Download](https://github.com/nihui/realsr-ncnn-vulkan/releases)
10
11Download Windows/Linux/MacOS Executable for Intel/AMD/Nvidia GPU
12
13**https://github.com/nihui/realsr-ncnn-vulkan/releases**
14
15This package includes all the binaries and models required. It is portable, so no CUDA or Caffe runtime environment is needed :)
16
17## About RealSR
18
19Real-World Super-Resolution via Kernel Estimation and Noise Injection (CVPRW 2020)
20
21https://github.com/jixiaozhong/RealSR
22
23Xiaozhong Ji, Yun Cao, Ying Tai, Chengjie Wang, Jilin Li, and Feiyue Huang
24
25*Tencent YouTu Lab*
26
27Our solution is the **winner of CVPR NTIRE 2020 Challenge on Real-World Super-Resolution** in both tracks.
28
29https://arxiv.org/abs/2005.01996
30
31## Usages
32
33### Example Command
34
35```shell
36realsr-ncnn-vulkan.exe -i input.jpg -o output.png -s 4
37```
38
39### Full Usages
40
41```console
42Usage: realsr-ncnn-vulkan -i infile -o outfile [options]...
43
44  -h                   show this help
45  -v                   verbose output
46  -i input-path        input image path (jpg/png/webp) or directory
47  -o output-path       output image path (jpg/png/webp) or directory
48  -s scale             upscale ratio (4, default=4)
49  -t tile-size         tile size (>=32/0=auto, default=0) can be 0,0,0 for multi-gpu
50  -m model-path        realsr model path (default=models-DF2K_JPEG)
51  -g gpu-id            gpu device to use (default=0) can be 0,1,2 for multi-gpu
52  -j load:proc:save    thread count for load/proc/save (default=1:2:2) can be 1:2,2,2:2 for multi-gpu
53  -x                   enable tta mode
54  -f format            output image format (jpg/png/webp, default=ext/png)
55```
56
57- `input-path` and `output-path` accept either file path or directory path
58- `scale` = scale level, 4 = upscale 4x
59- `tile-size` = tile size, use smaller value to reduce GPU memory usage, default selects automatically
60- `load:proc:save` = thread count for the three stages (image decoding + waifu2x upscaling + 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.
61- `format` = the format of the image to be output, png is better supported, however webp generally yields smaller file sizes, both are losslessly encoded
62
63If you encounter crash or error, try to upgrade your GPU driver
64
65- Intel: https://downloadcenter.intel.com/product/80939/Graphics-Drivers
66- AMD: https://www.amd.com/en/support
67- NVIDIA: https://www.nvidia.com/Download/index.aspx
68
69## Build from Source
70
711. Download and setup the Vulkan SDK from https://vulkan.lunarg.com/
72  - For Linux distributions, you can either get the essential build requirements from package manager
73```shell
74dnf install vulkan-headers vulkan-loader-devel
75```
76```shell
77apt-get install libvulkan-dev
78```
79```shell
80pacman -S vulkan-headers vulkan-icd-loader
81```
82
832. Clone this project with all submodules
84
85```shell
86git clone https://github.com/nihui/realsr-ncnn-vulkan.git
87cd realsr-ncnn-vulkan
88git submodule update --init --recursive
89```
90
913. Build with CMake
92  - You can pass -DUSE_STATIC_MOLTENVK=ON option to avoid linking the vulkan loader library on MacOS
93
94```shell
95mkdir build
96cd build
97cmake ../src
98cmake --build . -j 4
99```
100
101## Sample Images
102
103### Original Image
104
105![origin](images/0.png)
106
107### Upscale 4x with ImageMagick Lanczo4 Filter
108
109```shell
110convert origin.jpg -resize 400% output.png
111```
112
113![browser](images/im.png)
114
115### Upscale 4x with srmd scale=4 noise=-1
116
117```shell
118srmd-ncnn-vulkan.exe -i origin.jpg -o 4x.png -s 4 -n -1
119```
120
121![waifu2x](images/srmd.png)
122
123### Upscale 4x with realsr model=DF2K scale=4 tta=1
124
125```shell
126realsr-ncnn-vulkan.exe -i origin.jpg -o output.png -s 4 -x -m models-DF2K
127```
128
129![realsr](images/2.png)
130
131## Original RealSR Project
132
133- https://github.com/jixiaozhong/RealSR
134
135## Other Open-Source Code Used
136
137- https://github.com/Tencent/ncnn for fast neural network inference on ALL PLATFORMS
138- https://github.com/webmproject/libwebp for encoding and decoding Webp images on ALL PLATFORMS
139- https://github.com/nothings/stb for decoding and encoding image on Linux / MacOS
140- https://github.com/tronkko/dirent for listing files in directory on Windows
141