Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Linux #74

Closed
Incr3dible opened this issue Apr 5, 2019 · 38 comments
Closed

Support for Linux #74

Incr3dible opened this issue Apr 5, 2019 · 38 comments
Assignees
Labels
platform:Linux Linux platform type:Enhancement New feature or request

Comments

@Incr3dible
Copy link

Description

As for now it can only run on Windows will be there any update to support linux?

Sources

https://github.com/k4yt3x/video2x#prerequisites

@Incr3dible Incr3dible added the type:Enhancement New feature or request label Apr 5, 2019
@k4yt3x
Copy link
Owner

k4yt3x commented Apr 5, 2019

I originally wanted to design this program for Linux, but it's way harder to setup waifu2x on Linux. If you have any documentations on easy waifu2x implementations for Linux, please post them here and I'll make video2x Linux compatible.

@k4yt3x k4yt3x reopened this Apr 5, 2019
@k4yt3x
Copy link
Owner

k4yt3x commented Apr 5, 2019

We can still keep this open as a long-term project.
I still want to add Linux support.

@Smarthard
Copy link

Smarthard commented Apr 5, 2019

@k4yt3x I looked through AUR packages in my arch linux, there were:

  • waifu2x
  • waifu2x-converter-cpp
  • waifu2x-converter-glsl

So, I suppose that both waifu2x and waifu2x-converter-cpp are cross-platform. The problem is that linux users may install any possible dependecies by themselves. In that way, I suggest you to write separate shell script for bash/ksh/etc which will search for it and generate configuration for this system. For example, which shell command searches in PATH variable for command you specified in it argument and returns it absolute path.

P.S. As I mentioned before, ask me if you need help with setting it up for linux or testing.

@Smarthard
Copy link

I'll try to install it and look for some manuals or something

@k4yt3x k4yt3x added the LTP label Apr 11, 2019
@cr08
Copy link

cr08 commented Apr 19, 2019

Just throwing in my +1 for this. Only reason I'm running a Windows VM at the moment is for this alone and it'd be nice to trim the fat on my VM box and run a barebones *nix install with the GPU passed to it.

Looking at the documentation on the packages listed above it does appear the upstream waifu2x package that they pull from supports CUDA so it should be good to go. So either someone can see if it is available in their repo (as Smarthard mentioned, Arch has it and looks to be pretty up to date. I haven't been able to confirm debian or Ubuntu have it in-repo) or just simply 'compile' it which seems to not even need that and boils down to just installing its own pre-requisite packages.

Personally if it comes down to a concern over ease of install I'd do like most other *nix projects and just say 'this is a pre-req, go to this git project and install it'. But that's just me. By now this is something I have come to expect with most *nix projects on github.

@k4yt3x
Copy link
Owner

k4yt3x commented Apr 19, 2019

@cr08 for sure I will add Linux support. I know it's harder to setup, but I'm personally more willing to run this kind of applications on Linux.

The only problem here is that it would take a lot of time to develop and test the changes.

@k4yt3x
Copy link
Owner

k4yt3x commented Apr 21, 2019

Update: what do you guys think about this?

https://github.com/nagadomi/waifu2x-caffe-ubuntu/blob/ubuntu/INSTALL-linux.md

@Smarthard
Copy link

Smarthard commented Apr 24, 2019

@k4yt3x well, this project seems to be no more maintained - the latest commit was in May, 2017. Maybe it would be better to use waifu2x-converter-cpp?

I've found an issue with Arch PKGBUILD. But nothing interesting there and I still don't know how to simplify installation process for debian-family or whatever else Linux distro. However, waifu2x-converter-cpp from AUR has installed easily and works out of the box.

P.S. I think it's nothing to worry about if video2x couldn't run at any Linux right away. We just can start from setting it up and testing at Arch Linux and after it continue to add support for others.

@Smarthard
Copy link

Smarthard commented Apr 24, 2019

The only problem here is that it would take a lot of time to develop and test the changes.

For the testing setup I recommend you to use Manjaro Linux - it's installation and configuration not take too much time like it would be with Arch. But it's arch-based distro, so it compitability with Arch is 100% and with AUR too.

@k4yt3x
Copy link
Owner

k4yt3x commented Apr 29, 2019

I personally use Debian-based system a lot, so is Debian my daily OS, so I understand Debian family better than Arch. I might just start with Debian and see how far I get.

Though if Arch has an already-built-package, I might try that out as well and see how well it works.

@k4yt3x
Copy link
Owner

k4yt3x commented Apr 29, 2019

Just investigated, DeadSix27/waifu2x-converter-cpp supports linux builds, and already has AUR builds.

@sat3ll
Copy link
Contributor

sat3ll commented May 22, 2019

Take a look at https://github.com/nihui/waifu2x-ncnn-vulkan.
Seems to be reasonably easy to setup. In fact, I've managed to package it into a flatpak.

@hirios
Copy link

hirios commented Jul 10, 2019

@k4yt3x
If you could implement for linux. Maybe it was possible to use the project via google colab. We could use google gpu to perform the procedure!

@k4yt3x
Copy link
Owner

k4yt3x commented Jul 12, 2019

@hirios That would have to come after porting this project to Linux. One step at a time.
It is though, totally possible.

@ddouglas87
Copy link
Collaborator

ddouglas87 commented Sep 1, 2019

I've been using Video2x on Mint 19.2 (Ubuntu 18.04) for a bit now without issue.

For anyone who wants to run Video2X on Linux it's surprisingly easy. Here are some easy to follow instructions to get Video2X setup on your machine:

Install Dependencies (mostly for waifu2x-caffe):

sudo apt install build-essential git linux-headers-$(uname -r) libboost-all-dev libgflags-dev libprotobuf-dev protobuf-compiler libgoogle-glog-dev libhdf5-dev liblmdb-dev libleveldb-dev libsnappy-dev libopencv-dev libatlas-base-dev libpython3-all-dev python3-pip python3-numpy python-numpy doxygen libmsgpack-dev ffmpeg

CUDA 10 && CuDNN:

(I tried CUDA 9, but couldn't get waifu2x-caffe to work for some sort of reason. I kept getting core dumps.)

Build CMake:
NOTE: CUDA 10.0+ requires at least CMake 3.12.2+. You can see if your version is new enough by typing in cmake --version.

If CMake is not new enough, you can use snap to update your version:
sudo apt remove cmake (To get rid of your distro's version of cmake, or bad things could happen.)
sudo apt install snap; sudo snap install cmake

Or if your system doesn't have snap, build cmake from scratch:
sudo apt remove cmake (To get rid of your distro's version of cmake, or bad things could happen.)
cd ~; git clone --branch release https://github.com/Kitware/CMake.git
cd CMake; ./bootstrap; make -jN Where N is your number of cores
sudo make install

Graphics Drivers (optional):
I recommend the ubuntu nvidia driver ppa, as it will give the cutting edge driver. (Fun fact: If you game on Steam and have CUDA 10.1 installed on your system, it requires the PPA version, because the version on the official NVidia website does not have the required 32bit libraries.)

sudo sudo add-apt-repository ppa:graphics-drivers/ppa
sudo apt update; sudo apt install nvidia-graphics-drivers-NNN Where NNN is the newest version shown at https://launchpad.net/~graphics-drivers/+archive/ubuntu/ppa or found via apt-cache search nvidia-graphics-drivers-

NOTE: For driver changes you will need to reboot before running Video2x.

CUDA 10:
Unfortunately I don't believe there is a ppa, so CUDA has to be downloaded from NVidia's web site @ https://developer.nvidia.com/cuda-downloads. I recommend not installing the out of date video driver that comes with CUDA.

NOTE: I had to add /usr/local/cuda-10.1/bin to my PATH in sudo vim /etc/environment, which then takes effect after a reboot. (For many distros you want to add it to ~/.bash_profile or similar.)

CuDNN:
Goto https://developer.nvidia.com/cudnn and create a free dev account, if you haven't already. Grab both cuDNN Runtime Library for Ubuntu18.04 (Deb) and cuDNN Developer Library for Ubuntu18.04 (Deb).

These can be installed by cd ~/Downloads and then using dpkg. For example:
sudo dpkg -i libcudnn7_7.6.3.30-1+cuda10.1_amd64.deb libcudnn7-dev_7.6.3.30-1+cuda10.1_amd64.deb

Build waifu2x-caffe-ubuntu:

Video2x uses this to do the upscaling.

cd ~; git clone --recurse-submodules https://github.com/nagadomi/waifu2x-caffe-ubuntu.git; cd waifu2x-caffe-ubuntu/; git clone https://github.com/nagadomi/caffe.git
mkdir build; cd build; cmake ..
make -jN Where N is your number of cores
sudo mkdir /usr/lib/libcaffe; sudo cp libcaffe/lib/libcaffe.so /usr/lib/libcaffe/ (This installs caffe.)
cp waifu2x-caffe ../bin/ (For waifu2x-caffe to work it is required to be in the bin folder)

(Found at: https://github.com/nagadomi/waifu2x-caffe-ubuntu/blob/ubuntu/INSTALL-linux.md Working and obtained on 2019-08-25)

Setup Video2X:

cd ~; git clone https://github.com/k4yt3x/video2x.git

Copy waifu2x-caffe to Video2X:
cd video2x/bin; cp -r ~/waifu2x-caffe-ubuntu/bin/ waifu2x-caffe

(Waifu2x-caffe is not being installed into /usr/local/bin like a normal program, because it requires files in the same folder that I'm not comfortable putting into bin.)

Install Video2X's dependencies:
pip3 install -r requirements.txt

Modify Video2X to work on Linux:

Video2X is not designed for Linux atm, so I modified some of the code to get it working. By the time you're reading this, these issues might be fixed:

Bug fix 1: (required)
Video2X uses absolute paths instead of relative paths. Without this fix Video2X can't find the programs it's calling.

video2x.json, line 3:
Switch

"waifu2x_caffe_path": "C:\\Users\\K4YT3X\\AppData\\Local\\video2x\\waifu2x-caffe\\waifu2x-caffe-cui.exe",

with

"waifu2x_caffe_path": "waifu2x-caffe/waifu2x-caffe",

video2x.json, line 59:
Switch

"ffmpeg_path": "C:\\Users\\K4YT3X\\AppData\\Local\\video2x\\ffmpeg-latest-win64-static\\bin",

with

"ffmpeg_path": "",

ffmpeg.py, line 33
Switch

self.ffmpeg_binary = self.ffmpeg_path / 'ffmpeg.exe'
self.ffmpeg_probe_binary = self.ffmpeg_path / 'ffprobe.exe

with

self.ffmpeg_binary = self.ffmpeg_path / 'ffmpeg'
self.ffmpeg_probe_binary = self.ffmpeg_path / 'ffprobe'

video2x.py, line 230
Switch

    if not re.match('^[a-z]:', config['ffmpeg']['ffmpeg_path'], re.IGNORECASE):
        config['ffmpeg']['ffmpeg_path'] = current_directory / config['ffmpeg']['ffmpeg_path']

with

    #if not re.match('^[a-z]:', config['ffmpeg']['ffmpeg_path'], re.IGNORECASE):
    #    config['ffmpeg']['ffmpeg_path'] = current_directory / config['ffmpeg']['ffmpeg_path']

Bug fix 2: (required)
Without this change ffmpeg errors out.

ffmpeg.py, line 287:
Switch

return subprocess.run(execute, shell=True, check=True).returncode

with

return subprocess.run(execute, check=True).returncode

Bug fix 3: (optional)
Video2X by default doesn't support embedded fonts in mkvs, which is pretty common in anime. This fixes this issue.

video2x.json, line 86
Switch

          "0:v:0?",
          "1?",
          "-1:v?"

with

          "0:v?",
          "1:a?",
          "1:s?",
          "1:d?",
          "1:t?"

Bug fix 4: (required)
The pixel_formats variable is a dictionary, and Avalon.debug_info needs to be a string format.

open ffmpeg.py, goto line 70
Switch

Avalon.debug_info(pixel_formats)

with

Avalon.debug_info(str(pixel_formats))

Running Video2X:

Grab your favorite mkv and type in something like:

python3 video2x.py -m cudnn --width=1920 --height=1080 -i '/home/bunny/Desktop/ts_op.mkv' -o ~/Desktop/test-1080p.mkv

@k4yt3x
Copy link
Owner

k4yt3x commented Sep 1, 2019

@ddouglas87 what a waste to put it in an issue.
Do you want to just write it into the Wiki?

@ddouglas87
Copy link
Collaborator

ddouglas87 commented Sep 2, 2019

what a waste to put it in an issue.

Thanks. This is all new to me, so it means a lot to me that you think highly of it.

Do you want to just write it into the Wiki?

I would but before that there a few bugs that could be fixed first in Video2X. I'm not on Windows so it's hard for me to test if, most notably, bug 2 breaks Windows. I'll do a pull request.

@cr08
Copy link

cr08 commented Sep 4, 2019

I did try going through this last night and was able to at least get to where video2x would run and do the initial video-to-frames stage but once that had completed and started to move on it errored out. I don't have the exact error on hand but it had something to do with a debug logging line that syslog didn't like and the error it gave after a brief google search seemed related to null bytes that syslog doesn't like. Again, the details are really vague this early in the morning and I'll try to get that error message when I can. I also have some cruft on this VM after the last attempt many months ago to try and get video2x working on linux so I may just wipe and start fresh.

Good news is both this and my Windows 10 VM are on the same storage disk in Proxmox and the fps rates for the video-to-frames stage shot up over 2x. Windows 10 I was seeing about 60fps on average and on this Ubuntu VM I was seeing about 140-150fps. The storage disk is SSD. Crossing fingers this also translates to even a modicum of better performance in other areas.

EDIT: There were also potentially some missing packages not listed in ddouglas87's comment. Again, I want to wipe this VM and start clean and try again figure out how it goes from there.

@cr08
Copy link

cr08 commented Sep 4, 2019

We'll see if this can get posted properly. Should be the error I got which is actually on the ffprobe stage.

2019-09-04 11:37:00.063951 [+] INFO: Executing: ffprobe -v quiet -print_format json -show_format -show_streams -i /media/NAS_Downloads/completed/test/E01.mkv
2019-09-04 11:37:00.334633 [+] INFO: Executing: ffprobe -v quiet -pix_fmts
[!] ERROR: An exception has occurred
Traceback (most recent call last):
  File "video2x.py", line 403, in <module>
    upscaler.run()
  File "/home/cr08/video2x/bin/upscaler.py", line 338, in run
    pixel_formats = fm.get_pixel_formats()
  File "/home/cr08/video2x/bin/ffmpeg.py", line 70, in get_pixel_formats
    Avalon.debug_info(pixel_formats)
  File "/home/cr08/.local/lib/python3.6/site-packages/avalon_framework/py", line 195, in debug_info
    syslog.syslog(syslog.LOG_DEBUG, msg)
TypeError: [priority,] message string

@cr08
Copy link

cr08 commented Sep 4, 2019

I'm going to edit/update this particular comment as I go so not to spam this too badly. Clean install of my Ubuntu VM. Used a mini iso for Server 18.04. Only tasks I installed were the base server and OpenSSH server tasks. Those are usually my go-to for a barebones system.

Right off the bat two missing dependency that comes up during the cmake step for building waifu2x-caffe-ubuntu is protobuf-compiler and python-numpy

Also for the necessary required frameworks to be installed via pip, since we are using python3 here it is necessary to install python3-pip and run sudo pip3 install -r requirements.txt. I found sticking to the default python moniker which calls python2.7 did not track over when trying to run video2x successfully. Not sure if the two versions are interchangeable if we just use python to run video2x. This go-round with the clean install I ran the above commands and only those and the rest of the process went through without issue (not counting the error in the comment above this).

Also earlier up the process chain I found on Ubuntu 18.04 I was given the option to use snap to install Cmake vs the built in apt repo which saves a number of steps down to a single command and it specifically mentioned offering up 3.15.2 which satisfies the requirements here. This was also VERY early in this experimentation so was out of the box with the minimal packages so may be useful to recommend this?

@k4yt3x
Copy link
Owner

k4yt3x commented Sep 4, 2019

@cr08 I have just edited your post to delete the redundant information.

It's not even a v2x error, it's error in the printing framework.
I'll try to get it fixed by today.

@ddouglas87
Copy link
Collaborator

ddouglas87 commented Sep 4, 2019

I'm going to edit/update this particular comment as I go so not to spam this too badly. Clean install of my Ubuntu VM. Used a mini iso for Server 18.04. Only tasks I installed were the base server and OpenSSH server tasks. Those are usually my go-to for a barebones system.

Right off the bat two missing dependency that comes up during the cmake step for building waifu2x-caffe-ubuntu is protobuf-compiler and python-numpy

Also earlier up the process chain I found on Ubuntu 18.04 I was given the option to use snap to install Cmake vs the built in apt repo which saves a number of steps down to a single command and it specifically mentioned offering up 3.15.2 which satisfies the requirements here. This was also VERY early in this experimentation so was out of the box with the minimal packages so may be useful to recommend this?

Thanks! I wrote the guide off of memory. I was worried there would be more errors.

I have libprotobuf-dev listed. I guess that's not enough, because it might not come with protoc. I'll add protobuf-compiler to the comment above. I have python3-numpy listed, so that should be fine? I suspect python-numpy is python2? Video2X uses python3.

pip3 install -r requirements.txt

Oh, I totally forgot that bit. doh!

Also earlier up the process chain I found on Ubuntu 18.04 I was given the option to use snap to install Cmake vs the built in apt repo which saves a number of steps down to a single command and it specifically mentioned offering up 3.15.2 which satisfies the requirements here.

You can use your favorite package manager, like snap, or brew, or conan or whatever, but I decided to not mention installing a package manager just to install cmake. It may be a bit quicker if snap installs binaries as the build is a bit slow for cmake, but I'm hesitant to change the guide on this one.

What do you mean you were given the option to use snap? Did you google building cmake and snap came up? I admit I haven't heard of snap until now.

@cr08
Copy link

cr08 commented Sep 4, 2019

I have python3-numpy listed, so that should be fine? I suspect python-numpy is python2? Video2X uses python3.

The actual step of running CMake for that portion it was failing on some python related items, I forget the entire message but it did mention pytest as something missing. Explcitly installing python-numpy even after python3-numpy was installed resolved those errors and was pointed out in one of the caffe related repos after a brief google search of my own. So my guess is CMake or possibly the code in the waifu2x-caffe-ubuntu and caffe git repos are calling specifically to the python2 versions.

What do you mean you were given the option to use snap? Did you google building cmake and snap came up? I admit I haven't heard of snap until now.

It appears to be built into Ubuntu out of the box or at least a stub for snap exists. Just as a check right after the install was completed and I logged in I just ran cmake and in normal fashion it suggests the apt command to install it but it also provided a secondary sudo snap install cmake option and in the same line had a comment that it would install version 3.15.2. Doing that command and only that command seemed to possibly install snap as a whole (not sure, not familiar with it honestly) and install the listed CMake version.

@ddouglas87
Copy link
Collaborator

The actual step of running CMake for that portion it was failing on some python related items, I forget the entire message but it did mention pytest as something missing. Explcitly installing python-numpy even after python3-numpy was installed resolved those errors and was pointed out in one of the caffe related repos after a brief google search of my own. So my guess is CMake or possibly the code in the waifu2x-caffe-ubuntu and caffe git repos are calling specifically to the python2 versions.

Thanks. Added python-numpy.

It appears to be built into Ubuntu out of the box or at least a stub for snap exists. Just as a check right after the install was completed and I logged in I just ran cmake and in normal fashion it suggests the apt command to install it but it also provided a secondary sudo snap install cmake option and in the same line had a comment that it would install version 3.15.2.

bunny@Lovely:~/video2x/bin$ snap

Command 'snap' not found, but can be installed with:

sudo apt install snap

I just looked it up and it's supposed to be on Ubuntu 18.04. I'm not sure why my system doesn't have it. I'll update the guide.

Thanks for all the help. :)

@cr08
Copy link

cr08 commented Sep 6, 2019

Good news is with all the above accounted for and commenting out line 70 of ffmpeg.py (as just a test and it appears to be purely a debug note/comment) it is now to the frame upscaling stage and processing accordingly. I imagine the later stages of creating the output MKV and transferring tracks will go off without much fanfare as that all falls on ffmpeg now.

I should note just for completeness that in my case I left out the optional modifications since I only ever process one video at a time so don't have a need for concurrent instances of video2x.

@cr08
Copy link

cr08 commented Sep 6, 2019

Also as a fun tidbit for some users: If you are like me and running a headless VM and needing to do all this through SSH, you'll eventually find that Nvidia's developer site when trying to get the CuDNN libs it will prevent you from doing so via wget because it needs you to log in first for authentication. Found this particular thread on Nvidia's own forums and a couple posts down one user recommends an extension for chrome which is linked therein which will let you track down an authenticated link through Chrome on another device which you can then feed to wget. Very likely you could also do this through Chrome's developer tools as well.

https://devtalk.nvidia.com/default/topic/1002046/download-cudnn-via-wget-or-curl-/

@k4yt3x
Copy link
Owner

k4yt3x commented Sep 6, 2019

...which will let you track down an authenticated link through Chrome on another device which you can then feed to wget

I'll personally just download it onto my workstation and sftp it onto the server, or export my browser cookie into JSON and load it into curl.

@k4yt3x
Copy link
Owner

k4yt3x commented Sep 6, 2019

Good news is with all the above accounted for and commenting out line 70 of ffmpeg.py (as just a test and it appears to be purely a debug note/comment) it is now to the frame upscaling stage and processing accordingly. I imagine the later stages of creating the output MKV and transferring tracks will go off without much fanfare as that all falls on ffmpeg now.

This is a bug and will be addressed in either future releases of Video2X or future releases of the Avalon Framework.

@28598519a
Copy link
Collaborator

28598519a commented Oct 31, 2019

No root access , No apt command
NVIDIA DGX Station Version 4.0.4 (GNU/Linux 4.15.0-39-generic x86_64)
I have a Nvidia DGX-1 station account, but I don't have root access, so this is what I do.

[Environmet variable]
vi .bashrc
use a esc :w to add environment variable to the end of .bashrc

export PATH=~/lib/cmake/bin:$PATH
export PATH=~/lib/opencv/bin:$PATH
export PATH=~/lib/m4/bin:$PATH
export LIBTOOLIZE=~/lib/libtool/bin/libtoolize
export PATH=~/lib/autoconf/bin:$PATH
export PATH=~/lib/gettext/bin:$PATH
export PATH=~/lib/help2man/bin:$PATH
export PATH=~/lib/texinfo/bin:$PATH
export PATH=~/lib/bison/bin:$PATH
export PATH=~/lib/indent/bin:$PATH
export PATH=~/lib/flex/bin:$PATH
export PATH=~/lib/doxygen/bin:$PATH
export PATH=~/lib/hdf5/bin:$PATH
export PATH=~/lib/ffmpeg/bin:$PATH
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/lib/ffmpeg/lib
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/lib/libcaffe

This is what I install:
cmake 3.16.0-rc2
openssl 1.1.1d
opencv 3.4.3
m4 1.4.18
libtool 2.4.6
autoconf 2.69
gettext 0.20
help2man 1.43.3
texinfo 6.5
bison 3.1.91
indent 2.2.12
flex 2.64
doxygen 1.8.16
hdf5 1.10.5
ffmpeg

[Install Deependencies]

cmake + openssl

if your cmake version is lower than 3.12.2, this may happen when you ./configure the caffe, because CUDA 10.0+ requires at least CMake 3.12.2+
Error: CUDA_cublas_device_LIBRARY (ADVANCED) not found

wget https://github.com/openssl/openssl/archive/OpenSSL_1_1_1d.tar.gz
tar -xvzf OpenSSL_1_1_1d.tar.gz
cd openssl-OpenSSL_1_1_1d
./config --prefix=~/lib/openssl --openssldir=~/lib/openssl shared zlib
make -j20
make install

wget https://github.com/Kitware/CMake/releases/download/v3.16.0-rc2/cmake-3.16.0-rc2.tar.gz
tar -xvzf cmake-3.16.0-rc2.tar.gz
cd cmake-3.16.0-rc2
cmake -DOPENSSL_ROOT_DIR=~/lib/openssl -DOPENSSL_LIBRARIES=~/lib/openssl/lib
./configure --prefix=~/lib/cmake
make -j20
make install

opencv

mkdir opencv341
cd opencv341
git clone -b 3.4.1 https://github.com/opencv/opencv
git clone -b 3.4.1 https://github.com/opencv/opencv_contrib
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=~/lib/opencv ..
make -j20
make install

m4

git clone git://git.sv.gnu.org/m4
cd m4
./configure --prefix=~/lib/m4
make -j20
make install

libtool

git clone git://git.savannah.gnu.org/libtool.git
cd libtool
./configure --prefix=~/lib/libtool
make -j20
make install

autoconf

git clone git://git.sv.gnu.org/autoconf
cd autoconf
./configure --prefix=~/lib/autoconf
make -j20
make install

gettext

wget https://ftp.gnu.org/pub/gnu/gettext/gettext-0.20.tar.gz
tar -xvzf gettext-0.20.tar.gz
cd gettext-0.20
./configure --prefix=~/lib/gettext
make -j20
make install

help2man

wget https://ftp.gnu.org/gnu/help2man/help2man-1.43.3.tar.gz
tar -xvzf help2man-1.43.3.tar.gz
cd help2man-1.43.3
./configure --prefix=~/lib/help2man
make -j20
make install

texinfo

wget https://ftp.gnu.org/gnu/texinfo/texinfo-6.5.tar.gz
tar -xvzf texinfo-6.5.tar.gz
cd texinfo-6.5
./configure --prefix=~/lib/texinfo
make -j20
make install

bison

wget http://alpha.gnu.org/gnu/bison/bison-3.1.91.tar.gz
tar -xvzf bison-3.1.91.tar.gz
cd bison-3.1.91
./configure --prefix=~/lib/bison
make -j20
make install

indent

wget https://ftp.gnu.org/gnu/indent/indent-2.2.12.tar.gz
tar -xvzf indent-2.2.12.tar.gz
cd indent-2.2.12
./configure --prefix=~/lib/indent
make -j20
make install

flex

wget https://github.com/westes/flex/releases/download/v2.6.3/flex-2.6.3.tar.gz
tar -xvzf flex-2.6.3.tar.gz
cd flex-2.6.3
./configure --prefix=~/lib/flex
make -j20
make install

doxgen

wget https://github.com/doxygen/doxygen/archive/Release_1_8_16.tar.gz
tar -xvzf Release_1_8_16.tar.gz
cd doxygen-Release_1_8_16
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=~/lib/doxygen ..
make install

hdf5

wget https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.10/hdf5-1.10.5/src/hdf5-1.10.5.tar.gz
tar -xvzf hdf5-1.10.5.tar.gz
cd hdf5-1.10.5
./configure --prefix=~/lib/hdf5
make -j20
make install

ffmpeg ( I think this is the hardest package to build-full, but I found a script to auto build )

git clone https://github.com/markus-perl/ffmpeg-build-script.git
cd ffmpeg-build-script
./build-ffmpeg --build

Install the binary to your /usr/local/bin folder? [Y/n] n

mv workspace ffmpeg
cp -r ffmpeg ~/lib

[Build waifu2x-caffe-ubuntu]

git clone --recurse-submodules https://github.com/nagadomi/waifu2x-caffe-ubuntu.git
cd waifu2x-caffe-ubuntu
git clone https://github.com/nagadomi/caffe.git

find this file and edit it
/caffe/cmake/Dependencies.cmake
search

# ---[ HDF5
find_package(HDF5 COMPONENTS HL REQUIRED)
include_directories(SYSTEM ${HDF5_INCLUDE_DIRS} ${HDF5_HL_INCLUDE_DIR})
list(APPEND Caffe_LINKER_LIBS ${HDF5_LIBRARIES})

add this line
list(APPEND Caffe_LINKER_LIBS ${HDF5_HL_LIBRARIES})
now we can start to build ( sm_70 means NVIDIA Tesla V100 GPU card )

mkdir build
cd build
cmake .. -DCUDA_NVCC_FLAGS="-D_FORCE_INLINES -gencode arch=compute_70,code=[sm_70,compute_70]"
cmake .. -DCUDA_NVCC_FLAGS="-D_FORCE_INLINES -gencode arch=compute_70,code=[sm_70,compute_70]"
make -j20
mv libcaffe/lib libcaffe/libcaffe
cp -r libcaffe/libaoffe ~/lib
cp waifu2x-caffe ../bin/

[Video2x]

cd
git clone https://github.com/k4yt3x/video2x.git
cd video2x/bin
cp -r ~/waifu2x-caffe-ubuntu/bin/ waifu2x-caffe
pip3 install --user -r requirements.txt

Next steps is same as
Modify Video2X to work on Linux

for other linux server you may missing something else, but these instructions can still be a good reference.

@k4yt3x
Copy link
Owner

k4yt3x commented Dec 12, 2019

@ddouglas87 @28598519a I will be closing this issue right now since Linux support has already been added. Since your documentation could potentially be really helpful for the community, would you be interested to add them to v2x's wiki page?

@k4yt3x k4yt3x closed this as completed Dec 12, 2019
@28598519a
Copy link
Collaborator

@ddouglas87 @28598519a I will be closing this issue right now since Linux support has already been added. Since your documentation could potentially be really helpful for the community, would you be interested to add them to v2x's wiki page?


@gateway
Copy link

gateway commented Apr 11, 2020

git clone https://github.com/nagadomi/caffe.git

Ubuntu 18.04
Hmm.. running into an issue after cmake ..
I'm running CUDA 9.x and have a 1080.. which I think is 61 not 71..

gateway@gateway-media:~/waifu2x-caffe-ubuntu/build$ make -j4
[  1%] Running C++/Python protocol buffer compiler on /home/gateway/waifu2x-caffe-ubuntu/caffe/src/caffe/proto/caffe.proto
Scanning dependencies of target proto
[  1%] Building CXX object libcaffe/src/caffe/CMakeFiles/proto.dir/__/__/include/caffe/proto/caffe.pb.cc.o
[  1%] Linking CXX static library ../../lib/libproto.a
[  1%] Built target proto
[  1%] Building NVCC (Device) object libcaffe/src/caffe/CMakeFiles/cuda_compile_1.dir/layers/cuda_compile_1_generated_axpy_layer.cu.o
[  1%] Building NVCC (Device) object libcaffe/src/caffe/CMakeFiles/cuda_compile_1.dir/layers/cuda_compile_1_generated_absval_layer.cu.o
[  2%] Building NVCC (Device) object libcaffe/src/caffe/CMakeFiles/cuda_compile_1.dir/layers/cuda_compile_1_generated_base_data_layer.cu.o
[  2%] Building NVCC (Device) object libcaffe/src/caffe/CMakeFiles/cuda_compile_1.dir/util/cuda_compile_1_generated_math_functions.cu.o
nvcc fatal   : Unsupported gpu architecture 'compute_72'

I cant seem to find where 72 is being set so I can change it.. thoughts?

@k4yt3x
Copy link
Owner

k4yt3x commented Apr 12, 2020

@gateway I did some searches, here's what I got

@jeffshee
Copy link

jeffshee commented Jun 3, 2020

Fedora has built package of waifu2x-converter-cpp, so using this instead to avoid building stuff. However the model is installed at /usr/share/waifu2x-converter-cpp, this doesn't play well with video2x, as it pass --model-dir explicitly to waifu2x-converter-cpp.
As a workaround, copy all the model files to usr/bin/models_rgb manually.

@jeffshee
Copy link

jeffshee commented Jun 3, 2020

Ok, since the built rpm of waifu2x-converter-cpp on Fedora is somewhat broken. (For some reason I couldn't use the GPU, it gives coredump) I built it from source and at the same time packaged it as an AppImage. I had released it here:
https://github.com/jeffshee/waifu2x-appimage/releases
No more building guys ;)

@romulasry
Copy link

@jeffshee
Copy link

@romulasry I just reinstalled the package version and tested, seems no more issue.

@k4yt3x
Copy link
Owner

k4yt3x commented Nov 21, 2021

FYI, under the context of v2x, we're making Python bindings for all *-ncnn-vulkan's. Distro won't be a concern in the future either, it should work for all platforms.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform:Linux Linux platform type:Enhancement New feature or request
Projects
None yet
Development

No branches or pull requests