Skip to content

Algorithms

k4yt3x edited this page Feb 11, 2022 · 5 revisions

Currently, Video2X supports two waifu2x drivers: waifu2x-caffe and waifu2x-converter-cpp. This page will cover the differences between the two drivers and how to configure Video2X to use the two different drivers.

Automatic Downloading and Configuration

Video2X is capable of downloading and configuring both waifu2x-caffe and waifu2x-converter-cpp automatically using the video2x_setup.py setup script. You can simply execute the script, and it will download, decompress, and write the configuration file for you:

python video2x_setup.py

By default, it will download and configure all waifu2x-caffe, waifu2x-converter-cpp, waifu2x-ncnn-vulkan and Anime4K. If you would like the script to only download one of them, you can specify the driver like such:

python video2x_setup.py -d waifu2x_caffe
python video2x_setup.py -d waifu2x_converter

waifu2x-caffe

The waifu2x-caffe driver is a high-level Python wrapper around waifu2x-caffe. This driver is a waifu2x implementation based on Nvidia CUDA and Nvidia CUDNN. Therefore, it can only be used on computers with Nvidia GPUs. It has a convenient GUI user interface for enlarging images, but Video2X only uses its CUI, waifu2x-caffe-cui.exe.

Manual Downloading and Configuration

  1. Go to the release page of waifu2x-caffe, and download the zip file of the latest release (usually named waifu2x-caffe.zip).
  2. Decompress the zip file and place the decompressed files in any desired location.
  3. In the video2x.json configuration file, modify the waifu2x_caffe/waifu2x_caffe_path key's value to the waifu2x-caffe-cui.exe binary file's path:
"waifu2x_caffe": {
  ...
  "waifu2x_caffe_path":  "C:\\Users\\K4YT3X\\AppData\\Local\\video2x\\waifu2x-caffe\\waifu2-caffe-cui.exe",
  ...
},

waifu2x-converter-cpp

The most important difference between waifu2x-converter-cpp and waifu2x-caffe is that it supports the AMD platform, due to it's support for OpenCL and OpenCV. It also comes with native support for multi-threading, thus eliminating the need for a multi-threading implementation on the wrapper.

Manual Downloading and Configuration

  1. Go to the release page of waifu2x-converter-cpp, and download the latest release package. The name of the file you should download looks something like waifu2x-DeadSix27-vc15-cv401-win64_v523.7z.
  2. Decompress the 7z compressed file, and store it to any desired place. You might need to download 7zip for decompression.
  3. Change the waifu2x_converter/waifu2x_converter_path key's value to the parent folder of that contains the waifu2x-converter-cpp.exe file:
"waifu2x_converter": {
  ...
  "waifu2x_converter_path": "C:\\Users\\K4YT3X\\AppData\\Local\\video2x\\waifu2x-converter-cpp",
  ...
}

waifu2x-ncnn-vulkan

This build of Waifu2X uses the Vulkan API. According to WikiPedia, "compared to OpenGL and Direct3D 11, and like Direct3D 12 and Metal, Vulkan is intended to offer higher performance and more balanced CPU/GPU usage". To read more about Vulkan, click here.

Manual Downloading and Configuration

  1. Go to the release page of waifu2x-ncnn-vulkan, and download the latest release package. The name of the file you should download looks something like waifu2x-ncnn-vulkan-20190611.zip.
  2. Decompress the zip file, and store it to any desired place.
  3. Change the waifu2x_ncnn_vulkan/waifu2x_ncnn_vulkan_path key's value to the parent folder of that contains the waifu2x.exe file:
"waifu2x_ncnn_vulkan": {
  ...
  "waifu2x_ncnn_vulkan_path": "C:\\Users\\K4YT3X\\AppData\\Local\\video2x\\waifu2x-ncnn-vulkan\\waifu2x.exe",
  ...
}

anime4k

Anime4K is unlike any of the waifu2x drivers. It is a non-machine-learning based image scaling algorithm optimized for animation styled images.

Manual Downloading and Configuration

  1. Download Anime4K's cached pre-compiled JAR files or compile your own JAR files from source code.
  2. Decompress the zip file or compile your code and place the Anime4K files in any desired places.
  3. Change the anime4k/path key's value to path of the JAR file.
  4. Download and install JRE 12. This specific version of JRE is required due to how the JAR file is compiled. If you compiled your own copy of Anime4K, use the appropriate version of JRE JAR file. Change the anime4k/java_path key's value to the path to JRE's java.exe file path.
"anime4k": {
  ...
  "path": "C:\\Users\\K4YT3X\\AppData\\Local\\video2x\\anime4k\\Anime4K.jar",
  "java_path": "C:\Program Files\Java\jdk-12.0.2\bin\java.exe",
  ...
}
Clone this wiki locally