기술 성공, 실패 기록소

darknet_ros install 본문

카테고리 없음

darknet_ros install

sunlab 2019. 11. 1. 15:11
728x90

(환경)

그래픽카드 RTX 2060

Driver Version 430.50 CUDA Version(driver cuda) : 10,1

CUDA SDK(runtime cuda) : 10.1.105

CUDNN - CUDA SDK 버전에 해당하는 버전.

opencv - 3.4.0

ros kinetic

 

+ opencv 를 설치할 적에 CUDA SDK와 호환이 되도록 설치해야한다.

https://e3jake.tistory.com/38

위 과정을 따라서 opencv - 3.4.0을 설치하면되는데

cuda 10 을 opencv 3.4.x 와 쓰기 위해서는 cmake 수정이 필요하다.

 

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=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 WITH_NVCUVID=OFF 추가

 

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=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 WITH_NVCUVID=OFF \
../

 

NVCUVID 라는게 cuda 10에서 deprecation(유지보수중단) 됨

https://github.com/opencv/opencv/issues/9544

opencv 재설치한다고 관련파일 삭제하는 과정에서 ros opencv파일 일부분 날라가기도 하니.

sudo apt-get purge ros-kinetic-vision-opencv

sudo apt-get purge ros-kinetic-opencv3

sudo apt-get install ros-kinetic-vision-opencv

sudo apt-get install ros-kinetic-opencv3

하기 

-------------------------------------------------

 

https://github.com/leggedrobotics/darknet_ros

 

leggedrobotics/darknet_ros

YOLO ROS: Real-Time Object Detection for ROS. Contribute to leggedrobotics/darknet_ros development by creating an account on GitHub.

github.com

darknet_ros github

 

먼저는 opencv, boost 설치해줘야함.

 

!!!!!!!!!!!! boost 설치 따로 안해줘도 된다. ros kinetic에 boost 포함되어 있음

괜히 설치하다가 boost때문에 컴파일 에러나더라.

 

+ install boost

 

https://www.boost.org/

 

Boost C++ Libraries

Welcome to Boost.org! Boost provides free peer-reviewed portable C++ source libraries. We emphasize libraries that work well with the C++ Standard Library. Boost libraries are intended to be widely useful, and usable across a broad spectrum of applications

www.boost.org

https://www.osetc.com/en/how-to-install-boost-on-ubuntu-16-04-18-04-linux.html

 

How to Install Boost on Ubuntu 16.04/18.04 Linux

This post will guide you how to install Boost libraries on Ubunt 16.04/18.04 Linux server. How do I install Boost C++ libraries 1.64 from a... read more »

www.osetc.com

 

 

여기에서 .tar 을 받아서

압축 풀어주는 형식으로 진행

https://stackoverflow.com/questions/8430332/uninstall-boost-and-install-another-version

 

Uninstall boost and install another version

I've installed the boost libraries on Linux Mint 12 using the command sudo apt-get install libboost-dev libboost-doc, which installs the default version available in the repositories. However, the

stackoverflow.com

$ tar -zxvf boost...

$ cd boost...

$ ./bootstrap.sh --prefix=/usr/local

$ sudo ./b2 --with=all -j(cpu core num) install

 

check installed version

$ cat /usr/local/include/boost/version.hpp | grep "BOOST_LIB_VERSION"

$ dpkg -s libboost-dev | grep 'Version'

 

+boost error

latest version of boost is not working on yolo

boost_1_69_0 is working

 

-그 다음 패키지 다운 받기

git clone --recursive https://github.com/leggedrobotics/darknet_ros.git

 

 

-환경에 맞게 패키지 수정

/darknet_ros/darknet_ros/CMakeLists.txt 에서

# Find CUDA 항목에서

-gencode arch=compute_75,code=sm_75 를 추가해준다.

 

+

https://en.wikipedia.org/wiki/CUDA#Supported_GPUs

 

CUDA - Wikipedia

CUDA (Compute Unified Device Architecture) is a parallel computing platform and application programming interface (API) model created by Nvidia.[1] It allows software developers and software engineers to use a CUDA-enabled graphics processing unit (GPU) fo

en.wikipedia.org

CUDA SDK 10.0 – 10.1 support for compute capability 3.0 – 7.5 (Kepler, Maxwell, Pascal, Volta, Turing)

RTX 2060 은 Turing Architecture

Turing에는 runtime cuda 10.0-10.1 버전을 사용해야한다.

Turing의 Compute capability (version)은 7.5 그래서

-gencode arch=compute_75,code=sm_75

를 추가해주는 것.

----------------------------------

 

/darknet_ros/darknet/Makefile 에서 

그래픽카드, cudnn, opencv 다 쓸거니까

GPU=1

CUDNN=1

OPENCV=1

로 변경

 

Turing Graphic card 를 인식하도록

-gencode arch=compute_75,code=sm_75

을 추가해준다.

그 다음에 make

 

환경에 맞게 darknet_ros 수정해 줬으면

 

catkin_make -DCMAKE_BUILD_TYPE=Release

 

그 다음 정상적으로 작동되는지 테스트

catkin_make darknet_ros run_tests

정상적으로 작동되면 끝

 

 

+

darknet_ros 는 yolo v3를 사용

for Yolo v3 from Darknet - you should use OpenCV <= 3.4.0

https://github.com/pjreddie/darknet/issues/1072

 

opencv3은 c++을 사용하지만 opencv4는 c++11을 사용한다.

 

opencv4 need C++11 to compile

but, darknet dont support C++11, because darknet files is C

https://github.com/pjreddie/darknet/issues/691

 

compile opencv with darknet wrong · Issue #691 · pjreddie/darknet

hi,when I compile opencv with darknet,the following error occurred: gcc -Iinclude/ -Isrc/ -DOPENCV pkg-config --cflags opencv -DGPU -I/usr/local/cuda-8.0/include/ -Wall -Wno-unused-result -Wno-unkn...

github.com

 

+uninstall boost

https://askubuntu.com/questions/325504/ubuntu-12-04-uninstall-boost-installed-from-source

 

Ubuntu 12.04 : Uninstall boost installed from source

I installed boost 1.54 libraries on ubuntu 12.04, and it seems to conflict with my installation of libboost-all-dev, so i want to uninstall boost 1.54 libraries completely. How to uninstall the one

askubuntu.com

delete /usr/local/lib/libboost* and /usr/local/include/boost

 

+opencv install - libEGL.so does not exist error

https://github.com/colmap/colmap/issues/380

 

libEGL.so does not exist · Issue #380 · colmap/colmap

Linux Ubuntu 16.04, i7-7700K, GTX 1080Ti Hello, I am new to COLMAP and am installing it in Ubuntu. When I run cmake .., there occurs the error that The imported target "QT5::Gui" referenc...

github.com