Skip to content

yui0/waifu2x-ocl

Repository files navigation

waifu2x-ocl

Fast waifu2x converter with GPU optimization. Using OpenCL.

Platform

  • Linux with OpenCL
  • macOS with OpenCL
  • Windows with OpenCL

Download

  • You can download this program from here.

How to build on macOS

$ make

How to build on Linux

$ make

How to build on Windows

  1. Installing OpenCL
  1. Including OpenCL in the Project
  • In the ‘Additional Include Directories’ field in ‘VC++ Directories’ add the following information depending on your graphics card.
  • nVidia: - “$(CUDA_INC_PATH)”
  • AMD: - “$(AMDAPPSDKROOT)\include”
  • Intel: - “C:\Intel\OpenCL\sdk\include”
  1. Linking OpenCL
  • Choose ‘Linker-> General’.
  • In the ‘Additional Dependencies’ field enter the following, again this is based on your card vendor.
    • nVidia: - “$(CUDA_LIB_PATH)”
    • AMD: - “$(AMDAPPSDKROOT)\lib\x86” (for 64 bit users you may need to change the x86 to x86_64)
    • Intel: - “C:\Intel\OpenCL\sdk\lib\x86” (for 64 bit users you may need to change the x86 to x64)
  • Still in the ‘Linker’ submenu, select ‘Input’.
  • In the ‘Additional Dependencies’ field click on the arrow that appears at the end of the field and choose Edit…
  • In the dialog that appears enter “OpenCL.lib”

How to use

$ ./waifu2x_ocl -h
Usage: ./waifu2x_ocl [options] file

Options:
-h                 Print this message
-m <model name>    waifu2x model name [noise2_model.json...]
-s <scale>         Magnification [1.0, 1.6, 2.0...]
-o <output name>   output file name [*.png, *.jpg]

$ ./waifu2x_ocl -s 1.0 nyanko.jpg
$ ./waifu2x_ocl -m vgg_7/art_y/noise3_model.json nyanko.jpg
$ ./waifu2x_ocl 001_200x.jpg
001_200x.jpg 200x199 3
wsize:287136
AMD Radeon HD 7800 Series (TAHITI / DRM 3.23.0 / 4.16.11-berry, LLVM 6.0.0) (platform 0, device 0)
Maximum memory allocation size is 2254046412 bytes
200 199 -> 416 414 *2.000000
0 0
159 0
0 157
159 157

Demo

Original

Original

Normal Resize by Gimp

Normal

Waifu2x Resize

  • ./waifu2x_ocl -s 2.0 -m noise3_model.json waifu_s.jpg -o waifu_d.png Waifu2x

References