Waifu2x

This article covers installing, using and training waifu2x, image super-resolution for anime-style art using deep convolutional neural networks.

Installation

To directly use waifu2x, install waifu2x-gitAUR package. There are other alternates for using waifu2x, just search waifu2x in AUR.

Tip: If you have an NVIDIA GPU, you can install cuda to significantly speed up the conversion process.

Usage

waifu2x is avaliable with command waifu2x. For detailed options, run waifu2x --help

Upscaling

Use --scale_ratio parameter to specify scale ratio you want. And -i with input file name, -o with output file name:

waifu2x --scale_ratio 2 -i my_waifu.png -o 2x_my_waifu.png

Noise Reduction

Use parameter(1 or 2) to specify noise reduction level:

waifu2x --noise_level 1 -i my_waifu.png -o lucid_my_waifu.png

And you can use to specify number of threads launching at same time, benifit for multi-core CPU :

Upscaling & Noise Reduction

--scale_ratio and can be combined, so you can:

Training

To train custom models, an NVIDIA graphical card is required because waifu2x uses CUDA for computing. Then you need to prepare below develop dependencies and waifu2x source.

Dependencies

Install:

It is recommended to install below optional cuDNN library and bindings package. With them you can enable cuDNN backend for training, which have a significant speed up.

You need to manually download a cudnn binary pack from NVIDIA cuDNN site during installing .

  • (optional)
  • (optional):

waifu2x source

Fetch waifu2x source code from GitHub:

git clone --depth 1 https://github.com/nagadomi/waifu2x.git

Enter source directory. Now you can test waifu2x command line tool:

Noise Reduction + 2x Upscaling

For more, see waifu2x#command-line-tools.

Train your own models

Note: If you have installed cuDNN library, you can use cuDNN kernel with -backend cudnn option. And, you can convert trained cudnn model to cunn model with tools/rebuild.lua.

Data Preparation

Genrating a file list.

Converting training data:

Train a Noise Reduction(level1) model

mkdir models/my_model
th train.lua -model_dir models/my_model -method noise -noise_level 1 -test images/miku_noisy.png
# usage
th waifu2x.lua -model_dir models/my_model -m noise -noise_level 1 -i images/miku_noisy.png -o output.png

You can check the performance of model with .

Train a Noise Reduction(level2) model

You can check the performance of model with .

Train a 2x UpScaling model

You can check the performance of model with models/my_model/scale2.0x_best.png.

Train a 2x and noise reduction fusion model

You can check the performance of model with .

For latest information, see waifu2x#train-your-own-model.

Docker

See waifu2x#docker.

See also

This article is issued from Archlinux. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.