본문 바로가기
TensorFlow OpenCV

Ubuntu 18.04 CUDA + opencv-3.4.0 2019. 8. 25. 12:25

by BABEL-II 2019. 10. 5.

tightvncserver 설치

https://sugerent.tistory.com/550

How to Install and Configure VNC on Ubuntu 18.04

위 설명이 가장 잘 된다. 다른 것들은 잘 안 되는 설명도 많다.

$ sudo apt-get update

$ sudo apt install xfce4 xfce4-goodies tightvncserver

$ vncserver

vi ~/.vnc/xstartup

#!/bin/bash

xrdb $HOME/.Xresources

startxfce4 &

sudo chmod +x ~/.vnc/xstartup

서비스 등록은 따로 찾아봐서 하면 된다.

이렇게 해 놓았을 때, 화면 하단의 터미널 아이콘 클릭으로 창이 열리지 않는 경우

존재하지 않는 이미지입니다.

 

tightvncserver panel configuration

: cd .config/xfce4/panel/launcher-9

:~/.config/xfce4/panel/launcher-9$ vi *desktop

[Desktop Entry]

Version=1.0

Type=Application

#Exec=exo-open --launch Konsole

#Exec=exo-open --launch TerminalEmulator

Exec=xfce4-terminal

Icon=utilities-terminal

StartupNotify=true

Terminal=false

Categories=Utility;X-XFCE;X-Xfce-Toplevel;

OnlyShowIn=XFCE;

Name=Terminal Emulator

Name[ko]=터미널 에뮬레이터

Comment=Use the command line

Comment[ko]=명령줄 사용

X-XFCE-Source=file:///usr/share/applications/exo-terminal-emulator.desktop

서비스 등록은 여기

https://pinedance.github.io/blog/2017/09/12/Ubuntu-16.04-system-service-%EB%93%B1%EB%A1%9D%ED%95%98%EA%B8%B0

 

Ubuntu 16.04 system service 등록하기

Ubuntu 16.04 system service를 등록해 보자

pinedance.github.io

cuda10.0 install

Ubuntu18.04에서 CUDA 10.0 설치는 이곳에서

https://greedywyatt.tistory.com/106

[Ubuntu 18.04] CUDA 10.0 및 cuDNN 7.5 설치

■ 참고문헌 ● https://medium.com/@cjanze/how-to-install-tensorflow-with-gpu-support-on-ubuntu-18-04-lts-with-cuda-10-nvidia-gpu-312a693744b5https://medium.com/@vitali.usau/install-cuda-10-0-cud..

greedywyatt.tistory.com

 

dpkg 명령을 저 블로그에서 시키는 순서대로 하면 잘 설치 된다.

opencv3.4.0 install

Get help from this:https://j-remind.tistory.com/57?category=693866

4. (YOLO) Ubuntu 18.04에 OpenCV 3.4.0 설치

Ubuntu 18.04에 YOLO를 설치하기 위해 먼저 OpenCV 3.4.0을 설치합니다. 기본(Default) OpenCV 제거 Ubuntu 18.04에 기본으로 설치되어 있는 OpenCV를 제거합니다. 1 2 3 sudo apt-get remove libopencv* sudo apt..

j-remind.tistory.com

PROBLEM :

unsupported GNU version! gcc versions later than 6 are not supported!

ANSWER :

You can use -DCMAKE_C_COMPILER=/usr/bin/gcc-6 to specify the path of the compiler

You need to download gcc-6 and use -DCMAKE_C_COMPILER=/usr/bin/gcc-6 to specify the path of the compiler. CUDA doesn't work with later gcc versions

PROBLEM :

CMakeFiles/Makefile2:7395: recipe for target 'modules/cudacodec/CMakeFiles/opencv_cudacodec_pch_dephelp.dir/all' failed

make[1]: *** [modules/cudacodec/CMakeFiles/opencv_cudacodec_pch_dephelp.dir/all] Error 2

Makefile:160: recipe for target 'all' failed

make: *** [all] Error 2

ANSWER:

Actually, NVIDIA Video Decoder (NVCUVID) is deprecated in CUDA 10.

(https://docs.nvidia.com/cuda/video-decoder/index.html)

The issue is fixed if we desactivate the Cuda video decoder (also called NVCUVID ) with the following option in cmake : -D BUILD_opencv_cudacodec=OFF

IMPORTANT:

vi /home/cds/opencv/opencv-3.4.0/modules/python/src2/cv2.cpp

line 885:

template<>

bool pyopencv_to(PyObject* obj, String& value, const char* name)

{

(void)name;

if(!obj || obj == Py_None)

return true;

char* str = (char*)PyString_AsString(obj);

if(!str)

return false;

value = String(str);

return true;

}

IMPORTANT cmake flags:

cmake -D CMAKE_BUILD_TYPE=RELEASE \

-D CMAKE_INSTALL_PREFIX=/usr/local \

-D WITH_TBB=OFF \

-D WITH_IPP=OFF \

-D WITH_1394=OFF \

-D BUILD_WITH_DEBUG_INFO=OFF \

-D BUILD_DOCS=OFF \

-D INSTALL_C_EXAMPLES=ON \

-D INSTALL_PYTHON_EXAMPLES=ON \

-D BUILD_EXAMPLES=OFF \

-D BUILD_TESTS=OFF \

-D BUILD_PERF_TESTS=OFF \

-D WITH_QT=OFF \

-D WITH_GTK=ON \

-D WITH_OPENGL=ON \

-D OPENCV_EXTRA_MODULES_PATH=../../opencv_contrib-3.4.0/modules \

-D WITH_V4L=ON \

-D WITH_FFMPEG=ON \

-D WITH_XINE=ON \

-D BUILD_NEW_PYTHON_SUPPORT=ON \

-D PYTHON2_INCLUDE_DIR=/usr/include/python2.7 \

-D PYTHON2_NUMPY_INCLUDE_DIRS=/usr/lib/python2.7/dist-packages/numpy/core/include/ \

-D PYTHON2_PACKAGES_PATH=/usr/lib/python2.7/dist-packages \

-D PYTHON2_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython2.7.so \

-D PYTHON3_INCLUDE_DIR=/usr/include/python3.7m \

-D PYTHON3_NUMPY_INCLUDE_DIRS=/usr/lib/python3/dist-packages/numpy/core/include/ \

-D PYTHON3_PACKAGES_PATH=/usr/lib/python3/dist-packages \

-D PYTHON3_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython3.7m.so \

-D CUDA_NVCC_FLAGS=--expt-relaxed-constexpr \

../

Ubuntu18.04

tightvncserver

CUDA10.0

opencv3.7.3~3.7.4

까지 설치했으므로 다음에는 Anaconda를 설치하겠습니당...