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 --noise_level parameter(1 or ) to specify noise reduction level:

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

Upscaling & Noise Reduction

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

Tip: If you are finding a batch operation interface, you can have a look at this waifu2x wrapper script

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 .

waifu2x source

Fetch waifu2x source code from GitHub:

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.
  • The command that was used to train for waifu2x's pretraind models is available at appendix/train_upconv_7_art.sh, appendix/train_upconv_7_photo.sh. Maybe it is helpful.

Data Preparation

Genrating a file list.

find /path/to/image/dir -name "*.png" > data/image_list.txt

Converting training data:

Train a Noise Reduction(level1) model

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 .

Train a 2x and noise reduction fusion model

th train.lua -model upconv_7 -model_dir models/my_model -method noise_scale -scale 2 -noise_level 1 -test images/miku_small.png
# usage
th waifu2x.lua -model_dir models/my_model -m noise_scale -scale 2 -noise_level 1 -i images/miku_small.png -o output.png

You can check the performance of model with .

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

Docker

See waifu2x#docker.

gollark: I can do the "website" ""thing"" for you.
gollark: <@!341618941317349376> use outsourcing.
gollark: Initiate emergency teeth ejection.
gollark: You can use such tooling, and should, and yet many projects which really shouldn't still have problematic and very apioidal memory bugs which cause bad things.
gollark: Deploying countermeme:

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.