우선 YOLO를 사용하기 전에 컴퓨터를 세팅해보겠습니다.
- 현재 Ubuntu 18.04 와 CUDA 10.1는 설치되어 있습니다.
- cuDNN 7.5.0
CUDA 10.1에서는 cuDNN 7.5.0만 사용가능합니다. (아래 링크에서 다운받으면 됩니다.)
$ cd "다운경로" $ sudo tar -xzvf cudnn-10.1-linux-x64-v7.5.0.56.tgz $ cd cuda $ sudo cp include/cudnn.h /usr/local/cuda/include $ sudo cp lib64/libcudnn* /usr/local/cuda/lib64 $ sudo chmod a+r /usr/local/cuda/lib64/libcudnn* $ cat /usr/local/cuda/include/cudnn.h | grep CUDNN_MAJOR -A 2 | cs |
- openCV 3.2.0
1. 리눅스를 최신 상태로 업데이트
# Ubuntu 18.04에서 libjasper-dev 패기지를 설치하기 위해 저장소를 추가 $ sudo add-apt-repository "deb http://security.ubuntu.com/ubuntu xenial-security main" $ sudo apt update $ sudo apt upgrade # Ubuntu 18.04 설치 후 추가적으로 필요한 코덱, 미디어 라이브러리를 설치 $ sudo apt install ubuntu-restricted-extras | cs |
2. 필요한 패키치 설치
# Build tools & required $ sudo apt install build-essential cmake git pkg-config # For still image $ sudo apt install libjpeg-dev libtiff5-dev libjasper-dev libpng-dev # For videos $ sudo apt install libavcodec-dev libavformat-dev libswscale-dev $ sudo apt install libdc1394-22-dev libxvidcore-dev libx264-dev x264 $ sudo apt install libxine2-dev libv4l-dev v4l-utils $ sudo apt install libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev #GUI $ sudo apt install libgtk-3-dev # Optimization, Python3, etc. $ sudo apt install libatlas-base-dev libeigen3-dev gfortran $ sudo apt install python3-dev python3-numpy libtbb2 libtbb-dev | cs |
3. OpenCV 3.2.0 소스 코드를 다운로드
# Create a working directory named opencv $ cd ~ $ mkdir opencv $ cd opencv # Download sources $ wget -O opencv-3.2.0.zip https://github.com/opencv/opencv/archive/3.2.0.zip $ wget -O opencv_contrib-3.2.0.zip https://github.com/opencv/opencv_contrib/archive/3.2.0.zip # Unpack $ unzip opencv-3.2.0.zip $ unzip opencv_contrib-3.2.0.zip |
4. CMake를 이용해 Markfile을 생성
# Create a build directory $ mkdir build && cd build # Run CMake $ cmake \ -D CMAKE_BUILD_TYPE=Release \ -D CMAKE_INSTALL_PREFIX=/usr/local \ -D BUILD_WITH_DEBUG_INFO=OFF \ -D BUILD_EXAMPLES=ON \ -D BUILD_opencv_cudacodec=OFF \ -D BUILD_opencv_python2=OFF \ -D BUILD_opencv_python3=ON \ -D INSTALL_PYTHON_EXAMPLES=ON \ -D OPENCV_EXTRA_MODULES_PATH=../opencv_contrib-3.2.0/modules \ -D WITH_TBB=ON \ -D WITH_V4L=ON \ ../opencv-3.2.0/ 2>&1 | tee cmake_messages.txt | cs |
https://devtalk.nvidia.com/default/topic/1044773/error-in-installing-opencv-3-4-0-on-cuda-10/
5. 컴파일과 설치를 진행
# find out the number of CPU cores in your machine $ nproc # substitute 2 after -j by the output of nproc $ make -j2 2>&1 | tee build_messages.txt $ sudo make install $ sudo ldconfig # Package opencv was not found in the pkg-config search path라는 에러가 뜬 경우 $ sudo apt install apt-file $ sudo apt-get install libopencv-dev # If the output of next command is '3.2.0' then it's ok! $ pkg-config --modversion opencv | cs |
반응형
'Capstone > 2019-1 Capstone' 카테고리의 다른 글
⑥ Darknet(YOLOv3) (12) | 2019.06.21 |
---|---|
⑤ Darkflow : YOLO의 Tensorflow 버전 (5) | 2019.06.21 |
④ 이미지 수집 & 데이터 불리기 (0) | 2019.05.27 |
③ Docker (0) | 2019.05.20 |
① Capstone 아이디어 (0) | 2019.03.08 |