All Projects → nihui → cain-ncnn-vulkan

nihui / cain-ncnn-vulkan

Licence: MIT license
CAIN, Channel Attention Is All You Need for Video Frame Interpolation implemented with ncnn library

Programming Languages

c
50402 projects - #5 most used programming language
C++
36643 projects - #6 most used programming language
CMake
9771 projects

Projects that are alternatives of or similar to cain-ncnn-vulkan

Waifu2x Extension Gui
Video, Image and GIF upscale/enlarge(Super-Resolution) and Video frame interpolation. Achieved with Waifu2x, Real-ESRGAN, SRMD, RealSR, Anime4K, RIFE, CAIN, DAIN, and ACNet.
Stars: ✭ 5,463 (+6327.06%)
Mutual labels:  vulkan, ncnn, video-interpolation
ncnn-android-squeezenet
The squeezenet image classification android example
Stars: ✭ 100 (+17.65%)
Mutual labels:  vulkan, ncnn
daisykit
Daisykit is an easy AI toolkit for software engineers to integrate pretrained AI models and pipelines into their projects. - with NCNN, OpenCV, Python wrappers
Stars: ✭ 22 (-74.12%)
Mutual labels:  vulkan, ncnn
Ncnn
ncnn is a high-performance neural network inference framework optimized for the mobile platform
Stars: ✭ 13,376 (+15636.47%)
Mutual labels:  vulkan, ncnn
Video2x
A lossless video/GIF/image upscaler achieved with waifu2x, Anime4K, SRMD and RealSR. Started in Hack the Valley 2, 2018.
Stars: ✭ 3,760 (+4323.53%)
Mutual labels:  vulkan, ncnn
ncnn-android-benchmark
ncnn android benchmark app
Stars: ✭ 78 (-8.24%)
Mutual labels:  vulkan, ncnn
ffcnn
ffcnn is a cnn neural network inference framework, written in 600 lines C language.
Stars: ✭ 50 (-41.18%)
Mutual labels:  ncnn
reaper
Tiny C++ Engine
Stars: ✭ 21 (-75.29%)
Mutual labels:  vulkan
scop vulkan
A 3D model viewer written C++20 and Vulkan
Stars: ✭ 133 (+56.47%)
Mutual labels:  vulkan
MaixPy3
MaixPy for Linux Python3, let's play with edge AI easier!
Stars: ✭ 125 (+47.06%)
Mutual labels:  ncnn
ClothingTransfer-NCNN
CT-Net, OpenPose, LIP_JPPNet, DensePose running with ncnn⚡服装迁移/虚拟试穿⚡ClothingTransfer/Virtual-Try-On⚡
Stars: ✭ 166 (+95.29%)
Mutual labels:  ncnn
Nabla
OpenGL/OpenGL ES/Vulkan/CUDA/OptiX Modular Rendering Framework for PC/Linux/Android
Stars: ✭ 235 (+176.47%)
Mutual labels:  vulkan
rendering-fw
Rendering framework with rasterizers & path tracers implemented using Vulkan, OptiX & OpenGL
Stars: ✭ 81 (-4.71%)
Mutual labels:  vulkan
glfwJS
The N-API bindings for GLFW
Stars: ✭ 49 (-42.35%)
Mutual labels:  vulkan
sph vulkan
SPH simulation in Vulkan compute shader.
Stars: ✭ 29 (-65.88%)
Mutual labels:  vulkan
YOLOX
YOLOX is a high-performance anchor-free YOLO, exceeding yolov3~v5 with MegEngine, ONNX, TensorRT, ncnn, and OpenVINO supported. Documentation: https://yolox.readthedocs.io/
Stars: ✭ 6,570 (+7629.41%)
Mutual labels:  ncnn
luajit-glfw
GLFW bindings for LuaJIT
Stars: ✭ 51 (-40%)
Mutual labels:  vulkan
Camera2GLPreview
Android camera preview application using Camera2 API and OpenGL ES/Vulkan
Stars: ✭ 140 (+64.71%)
Mutual labels:  vulkan
Wasabi
Wasabi Vulkan Game Engine
Stars: ✭ 34 (-60%)
Mutual labels:  vulkan
Jin-Engine-2.1
No description or website provided.
Stars: ✭ 63 (-25.88%)
Mutual labels:  vulkan

CAIN ncnn Vulkan

CI

ncnn implementation of CAIN, Channel Attention Is All You Need for Video Frame Interpolation.

cain-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/cain-ncnn-vulkan/releases

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

About CAIN

CAIN (Channel Attention Is All You Need for Video Frame Interpolation) (AAAI 2020)

https://github.com/myungsub/CAIN

Myungsub Choi, Heewon Kim, Bohyung Han, Ning Xu, Kyoung Mu Lee

2nd place in [AIM 2019 ICCV Workshop] - Video Temporal Super-Resolution Challenge

Project | Paper-AAAI (Download the paper [here] in case the AAAI link is broken) | Poster

Usages

Input two frame images, output one interpolated frame image.

Example Command

./cain-ncnn-vulkan -0 0.jpg -1 1.jpg -o 01.jpg
./cain-ncnn-vulkan -i input_frames/ -o output_frames/

Video Interpolation with FFmpeg

mkdir input_frames
mkdir output_frames

# find the source fps and format with ffprobe, for example 24fps, AAC
ffprobe input.mp4

# extract audio
ffmpeg -i input.mp4 -vn -acodec copy audio.m4a

# decode all frames
ffmpeg -i input.mp4 input_frames/frame_%06d.png

# interpolate 2x frame count
./cain-ncnn-vulkan -i input_frames -o output_frames

# encode interpolated frames in 48fps with audio
ffmpeg -framerate 48 -i output_frames/%06d.png -i audio.m4a -c:a copy -crf 20 -c:v libx264 -pix_fmt yuv420p output.mp4

Full Usages

Usage: cain-ncnn-vulkan -0 infile -1 infile1 -o outfile [options]...
       cain-ncnn-vulkan -i indir -o outdir [options]...

  -h                   show this help
  -v                   verbose output
  -0 input0-path       input image0 path (jpg/png/webp)
  -1 input1-path       input image1 path (jpg/png/webp)
  -i input-path        input image directory (jpg/png/webp)
  -o output-path       output image path (jpg/png/webp) or directory
  -m model-path        cain model path (default=cain)
  -g gpu-id            gpu device to use (default=auto) can be 0,1,2 for multi-gpu
  -j load:proc:save    thread count for load/proc/save (default=1:2:2) can be 1:2,2,2:2 for multi-gpu
  -f pattern-format    output image filename pattern format (%08d.jpg/png/webp, default=ext/%08d.png)
  • input0-path, input1-path and output-path accept file path
  • input-path and output-path accept file directory
  • load:proc:save = thread count for the three stages (image decoding + cain 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.
  • 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

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

Build from Source

  1. Download and setup the Vulkan SDK from https://vulkan.lunarg.com/
  • For Linux distributions, you can either get the essential build requirements from package manager
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/cain-ncnn-vulkan.git
cd cain-ncnn-vulkan
git submodule update --init --recursive
  1. Build with CMake
  • You can pass -DUSE_STATIC_MOLTENVK=ON option to avoid linking the vulkan loader library on MacOS
mkdir build
cd build
cmake ../src
cmake --build . -j 4

TODO

  • test-time sptial augmentation aka TTA-s
  • test-time temporal augmentation aka TTA-t

Sample Images

Original Image

origin0 origin1

Interpolate with cain

cain-ncnn-vulkan.exe -0 0.png -1 1.png -o out.png

cain

Original CAIN Project

Other Open-Source Code Used

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].