Home

Awesome

RealSR ncnn Vulkan

CI

ncnn implementation of Real-World Super-Resolution via Kernel Estimation and Noise Injection super resolution.

realsr-ncnn-vulkan uses ncnn project as the universal neural network inference framework.

Download

Download Windows/Linux/MacOS Executable for Intel/AMD/Nvidia GPU

https://github.com/nihui/realsr-ncnn-vulkan/releases

This package includes all the binaries and models required. It is portable, so no CUDA or Caffe runtime environment is needed :)

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 Command

realsr-ncnn-vulkan.exe -i input.jpg -o output.png -s 4

Full Usages

Usage: realsr-ncnn-vulkan -i infile -o outfile [options]...

  -h                   show this help
  -v                   verbose output
  -i input-path        input image path (jpg/png/webp) or directory
  -o output-path       output image path (png/webp) or directory
  -s scale             upscale ratio (4, default=4)
  -t tile-size         tile size (>=32/0=auto, default=0)
  -m model-path        realsr model path (default=models-DF2K_JPEG)
  -g gpu-id            gpu device to use (default=0)
  -j load:proc:save    thread count for load/proc/save (default=1:2:2)
  -x                   enable tta mode
  -f format            output image format (png/webp, default=ext/png)

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

Build from Source

  1. Download and setup the Vulkan SDK from https://vulkan.lunarg.com/
dnf install vulkan-headers vulkan-loader-devel
apt-get install libvulkan-dev
pacman -S vulkan-headers vulkan-icd-loader
  1. Clone this project with all submodules
git clone https://github.com/nihui/realsr-ncnn-vulkan.git
cd realsr-ncnn-vulkan
git submodule update --init --recursive
  1. Build with CMake
mkdir build
cd build
cmake ../src
cmake --build . -j 4

Sample Images

Original Image

origin

Upscale 4x with ImageMagick Lanczo4 Filter

convert origin.jpg -resize 400% output.png

browser

Upscale 4x with srmd scale=4 noise=-1

srmd-ncnn-vulkan.exe -i origin.jpg -o 4x.png -s 4 -n -1

waifu2x

Upscale 4x with realsr model=DF2K scale=4 tta=1

realsr-ncnn-vulkan.exe -i origin.jpg -o output.png -s 4 -x -m models-DF2K

realsr

Original RealSR Project

Other Open-Source Code Used