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.
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 --jobs
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:
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:
- torch7-nn-gitAUR
- torch7-cunn-gitAUR
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 cudnn.
- (optional)cudnn
- (optional)torch7-cudnn-gitAUR:
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
- 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 withtools/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.
Converting training data:
th convert_data.lua
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
You can check the performance of model with models/my_model/noise1_scale2.0x_best.png
.
For latest information, see waifu2x#train-your-own-model.
Docker
See waifu2x#docker.