abao365 / waifu2x-chainer

Chainer implementation of waifu2x and its model trainer

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

waifu2x-chainer

Chainer implementation of waifu2x [1] and its model trainer. Note that the training procedure of waifu2x-chainer may be slightly different from original waifu2x.

Summary

  • 2D character picture (Kagamine Rin) is licensed under CC BY-NC by piapro [2].

Requirements

  • Chainer
  • Cupy (for GPU support)
  • Pillow
  • Wand (for training)

Installation

Install Python packages

pip install chainer
pip install cupy
pip install pillow
pip install wand

Getting waifu2x-chainer

git clone https://github.com/tsurumeso/waifu2x-chainer.git

Testing

cd waifu2x-chainer
python waifu2x.py

Usage

Specifing an output file name with --output (-o) option, the file extension must be PNG.

--output path/to/image.png/or/directory

Noise reduction

python waifu2x.py --method noise --noise_level 1 --input path/to/image/or/directory --arch VGG7

python waifu2x.py -m noise -n 0 -i path/to/image/or/directory -a 0
python waifu2x.py -m noise -n 2 -i path/to/image/or/directory -a 0
python waifu2x.py -m noise -n 3 -i path/to/image/or/directory -a 0

2x upscaling

python waifu2x.py --method scale --input path/to/image/or/directory --arch VGG7

python waifu2x.py -m scale -i path/to/image/or/directory -a 0

Noise reduction + 2x upscaling

python waifu2x.py --method noise_scale --noise_level 1 --input path/to/image/or/directory --arch VGG7

python waifu2x.py -m noise_scale -n 0 -i path/to/image/or/directory -a 0
python waifu2x.py -m noise_scale -n 2 -i path/to/image/or/directory -a 0
python waifu2x.py -m noise_scale -n 3 -i path/to/image/or/directory -a 0

Train your own model

Please refer template script at appendix/linux or appendix/windows . In my case, 5000 JPEG images are used for pretraining and 1000 noise-free-PNG images for finetuning.

References

About

Chainer implementation of waifu2x and its model trainer

License:MIT License


Languages

Language:Python 92.4%Language:Shell 3.8%Language:Batchfile 3.7%