10-03-2018, 07:51 AM
Even better image upscaling with Waifu2x
<div style="margin: 5px 5% 10px 5%;"><img src="http://www.sickgaming.net/blog/wp-content/uploads/2018/10/even-better-image-upscaling-with-waifu2x.png" width="1386" height="942" title="" alt="" /></div><div><p>You may have already seen the article here in the Magazine about <a href="https://fedoramagazine.org/upscale-bitmap-images-better-results/">upscaling bitmap images with better quality</a>. That article covered a few utilities to achieve good results, but there’s always room for enhancement. Meet Waifu2x, a sophisticated tool that uses deep convolutional neural networks, or machine learning for short. Therefore it benefits from trained model data sets. Read on to see how well it performs to upscale your images, and how to get the same benefits even without an Nvidia card.<span id="more-22522"></span></p>
<p>Here are some examples. First, a character that will be familiar to Fedora fans:</p>
<div id="attachment_22680" style="width: 1396px" class="wp-caption aligncenter"><img class="wp-image-22680 size-full" src="http://www.sickgaming.net/blog/wp-content/uploads/2018/10/even-better-image-upscaling-with-waifu2x.png" alt="" width="1386" height="942" /></p>
<p class="wp-caption-text">Making the Beefy Miracle hot dog four times larger keeps it nearly perfect!</p>
</div>
<p>Here’s another example:</p>
<div id="attachment_22679" style="width: 1150px" class="wp-caption aligncenter"><img class="wp-image-22679 size-full" src="http://www.sickgaming.net/blog/wp-content/uploads/2018/10/even-better-image-upscaling-with-waifu2x-1.png" alt="" width="1140" height="632" /></p>
<p class="wp-caption-text">Upscaling a drawing from an old book delivers really outstanding results.</p>
</div>
<p>Because Waifu2x performs the calculations using Nvidia CUDA computing platform, it requires an Nvidia graphics card. This article, however, covers a more portable version called <strong>Waifu2x-converter-cpp</strong> that runs everywhere.</p>
<p>Waifu2x-converter-cpp doesn’t require a dedicated Nvidia GPU. Instead, it leverages the OpenCV and OpenCL libraries. Although the overall performance is slower compared to the original code, it’s portable and more people are able to use it. And of course it runs on Fedora!</p>
<p>Follow the directions below to give it a spin.</p>
<h2>Installing Waifu2x-converter-cpp in Fedora</h2>
<p>To build the application from source, first install build dependencies:</p>
<pre>sudo dnf install -y gcc-c++ cmake opencv-devel opencl-utils-devel</pre>
<p>Then grab the source code, build it and install the files:</p>
<pre>git clone https://github.com/DeadSix27/waifu2x-converter-cpp.git cd waifu2x-converter-cpp/build cmake -DLIB_SUFFIX=64 ../ make sudo make install</pre>
<p>Tell the dynamic library linker to index the directory with locally installed libraries:</p>
<pre>sudo ldconfig /usr/local/lib64</pre>
<p>Now everything is ready for upscaling. The example command for processing an image is as follows:</p>
<pre>waifu2x-converter-cpp --scale_ratio 2 -i /path/to/input_file -o /path/to/output_file</pre>
<p>Don’t miss this very helpful command for extras, such as switching OpenCL on/off, playing with noise level, and so on:</p>
<pre>waifu2x-converter-cpp --help</pre>
<h2>Using a graphical front-end for Waifu2x</h2>
<p>Another step forward is to install Qtwaifu2x, a graphical tool that lets you escape Fedora terminal and process images with comfort and convenience.</p>
<div id="attachment_22681" style="width: 697px" class="wp-caption aligncenter"><img class="wp-image-22681 size-full" src="http://www.sickgaming.net/blog/wp-content/uploads/2018/10/even-better-image-upscaling-with-waifu2x-2.png" alt="" width="687" height="637" /></p>
<p class="wp-caption-text">Practically all you have to do is hit <em>Browse</em> and <em>Start</em> to launch the upscaling task.</p>
</div>
<h3>Installing Qtwaifu2x in Fedora</h3>
<p>First, install the main build dependency:</p>
<pre>sudo dnf install -y qt5-qtbase-devel</pre>
<p>Then get the code and build it:</p>
<pre>git clone https://github.com/cmdrkotori/qtwaifu2x.git cd qtwaifu2x qmake-qt5 && make</pre>
<p>To run the application from the current directory:</p>
<pre>./qtwaifu2x</pre>
<p>The main window has quite a few options, but it’s usually enough to provide the input file and hit the <em>Start</em> button.</p>
<p>Brew yourself a cup of tea and come back in a while to enjoy the perfectly upscaled image!</p>
</div>
<div style="margin: 5px 5% 10px 5%;"><img src="http://www.sickgaming.net/blog/wp-content/uploads/2018/10/even-better-image-upscaling-with-waifu2x.png" width="1386" height="942" title="" alt="" /></div><div><p>You may have already seen the article here in the Magazine about <a href="https://fedoramagazine.org/upscale-bitmap-images-better-results/">upscaling bitmap images with better quality</a>. That article covered a few utilities to achieve good results, but there’s always room for enhancement. Meet Waifu2x, a sophisticated tool that uses deep convolutional neural networks, or machine learning for short. Therefore it benefits from trained model data sets. Read on to see how well it performs to upscale your images, and how to get the same benefits even without an Nvidia card.<span id="more-22522"></span></p>
<p>Here are some examples. First, a character that will be familiar to Fedora fans:</p>
<div id="attachment_22680" style="width: 1396px" class="wp-caption aligncenter"><img class="wp-image-22680 size-full" src="http://www.sickgaming.net/blog/wp-content/uploads/2018/10/even-better-image-upscaling-with-waifu2x.png" alt="" width="1386" height="942" /></p>
<p class="wp-caption-text">Making the Beefy Miracle hot dog four times larger keeps it nearly perfect!</p>
</div>
<p>Here’s another example:</p>
<div id="attachment_22679" style="width: 1150px" class="wp-caption aligncenter"><img class="wp-image-22679 size-full" src="http://www.sickgaming.net/blog/wp-content/uploads/2018/10/even-better-image-upscaling-with-waifu2x-1.png" alt="" width="1140" height="632" /></p>
<p class="wp-caption-text">Upscaling a drawing from an old book delivers really outstanding results.</p>
</div>
<p>Because Waifu2x performs the calculations using Nvidia CUDA computing platform, it requires an Nvidia graphics card. This article, however, covers a more portable version called <strong>Waifu2x-converter-cpp</strong> that runs everywhere.</p>
<p>Waifu2x-converter-cpp doesn’t require a dedicated Nvidia GPU. Instead, it leverages the OpenCV and OpenCL libraries. Although the overall performance is slower compared to the original code, it’s portable and more people are able to use it. And of course it runs on Fedora!</p>
<p>Follow the directions below to give it a spin.</p>
<h2>Installing Waifu2x-converter-cpp in Fedora</h2>
<p>To build the application from source, first install build dependencies:</p>
<pre>sudo dnf install -y gcc-c++ cmake opencv-devel opencl-utils-devel</pre>
<p>Then grab the source code, build it and install the files:</p>
<pre>git clone https://github.com/DeadSix27/waifu2x-converter-cpp.git cd waifu2x-converter-cpp/build cmake -DLIB_SUFFIX=64 ../ make sudo make install</pre>
<p>Tell the dynamic library linker to index the directory with locally installed libraries:</p>
<pre>sudo ldconfig /usr/local/lib64</pre>
<p>Now everything is ready for upscaling. The example command for processing an image is as follows:</p>
<pre>waifu2x-converter-cpp --scale_ratio 2 -i /path/to/input_file -o /path/to/output_file</pre>
<p>Don’t miss this very helpful command for extras, such as switching OpenCL on/off, playing with noise level, and so on:</p>
<pre>waifu2x-converter-cpp --help</pre>
<h2>Using a graphical front-end for Waifu2x</h2>
<p>Another step forward is to install Qtwaifu2x, a graphical tool that lets you escape Fedora terminal and process images with comfort and convenience.</p>
<div id="attachment_22681" style="width: 697px" class="wp-caption aligncenter"><img class="wp-image-22681 size-full" src="http://www.sickgaming.net/blog/wp-content/uploads/2018/10/even-better-image-upscaling-with-waifu2x-2.png" alt="" width="687" height="637" /></p>
<p class="wp-caption-text">Practically all you have to do is hit <em>Browse</em> and <em>Start</em> to launch the upscaling task.</p>
</div>
<h3>Installing Qtwaifu2x in Fedora</h3>
<p>First, install the main build dependency:</p>
<pre>sudo dnf install -y qt5-qtbase-devel</pre>
<p>Then get the code and build it:</p>
<pre>git clone https://github.com/cmdrkotori/qtwaifu2x.git cd qtwaifu2x qmake-qt5 && make</pre>
<p>To run the application from the current directory:</p>
<pre>./qtwaifu2x</pre>
<p>The main window has quite a few options, but it’s usually enough to provide the input file and hit the <em>Start</em> button.</p>
<p>Brew yourself a cup of tea and come back in a while to enjoy the perfectly upscaled image!</p>
</div>