我爱编程

Darknet YOLO3

2018-05-27  本文已影响457人  马淑

ubuntu16.04怎么默认使用python3.5

ubuntu16.04 have python2.7 and python3.5 installed. I personally tend to use python3.5, so I choose to set python3.5 as default IDE.
sudo update-alternatives --install /usr/bin/python python /usr/bin/python2 100
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3 150

Install Opencv3.2.0

cmake -D CMAKE_BUILD_TYPE=RELEASE  -D CMAKE_INSTALL_PREFIX=/usr/local ..
cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib-3.2.0/modules -D WITH_CUDA=ON -D 
CUDA_GENERATION=Kepler..

Issue – How to build with both python2 & python3
I delete opencv-3.2.0 and reinstall opencv-3.2.0 with python3.

Issue – Cannot import cv2 in python3
Reference Links:
https://blog.csdn.net/fanzhiyi521/article/details/53456169
Solution:
rename cv2.cpython-35m-x86_64-linux-gnu.so to cv2.so
cd /usr/local/lib/python3.5/dist-packages/
sudo mv cv2.cpython-35m-x86_64-linux-gnu.so cv2.so

cv2.png

Issue-Cmake问题:CMake Error at cmake/OpenCVUtils.cmake:1043 (file)
Reference Links:
https://blog.csdn.net/lulumi2016/article/details/77984546
Solution:
I download 3.2.0 from https://github.com/google/protobuf/releases but it seems related to internet speed.

If you install opencv & opencv_contrib with CUDA 9.1 , then you may see below alarms:

Issue - CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:CUDA_nppi_LIBRARY (ADVANCED)

Reference Links:
https://blog.csdn.net/u014613745/article/details/78310916
Solution:
CUDA9.1 not compatible with Opencv3.2. Actually I finally choose to use CUDA8.0...

Issue - nvcc fatal : when make, alarm: Unsupported gpu architecture 'compute_20'
This alarm happens when cmake with CUDA.

cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D OPENCV_EXTRA_MODULES_PATH=~/opencv_contrib-3.2.0/modules -D WITH_CUDA=ON 

Reference Links:
https://stackoverflow.com/questions/48383846/nvcc-fatal-unsupported-gpu-architecture-compute-20-while-cuda-9-1caffeopen

compute_20.png
Solution:
CUDA 9.1 does not support compute_20 anymore, so I finally choose to use CUDA8.0...

ubuntu16安装gpu加速(cuda8及NVIDIA显卡安装)

Reference Links:
https://blog.csdn.net/u011128775/article/details/72850497
Solution:

sudo apt-get install libglu1-mesa-dev
sudo apt-get install freeglut3-dev build-essential libx11-dev libxmu-dev libxi-dev libgl1-mesa-glx libglu1-mesa libglu1-mesa-dev 
sudo sh cuda_8.0.61_375.26_linux.run
sudo vim ~/.bashrc
export CUDA_HOME=/usr/local/cuda-8.0
export PATH=/usr/local/cuda-8.0/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-8.0/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}

(输入:nvidia-smi,显示下面信息则说明正确安装了)

nvidia-smi.png
Unzip cudnn installations:
tar xvzf cudnn-8.0-linux-x64-v6.0.tgz

然后将库和头文件copy到cuda目录(一定是你自己安装的目录如/usr/local/cuda-8.0)
sudo cp cuda/include/cudnn.h /usr/local/cuda/include
sudo cp cuda/lib64/libcudnn* /usr/local/cuda/lib64
sudo chmod a+r /usr/local/cuda/include/cudnn.h /usr/local/cuda/lib64/libcudnn*

cudnn复制完成之后,再输入(解决可能会出现的连接符错误):

sudo cp /usr/local/cuda-8.0/lib64/libcufft.so.8.0 /usr/local/lib/libcufft.so.8.0 && sudo ldconfig

sudo cp /usr/local/cuda-8.0/lib64/libcurand.so.8.0 /usr/local/lib/libcurand.so.8.0 && sudo ldconfig

sudo cp /usr/local/cuda-8.0/lib64/libcudnn.so /usr/local/lib/libcudnn.so && sudo ldconfig

sudo cp /usr/local/cuda-8.0/lib64/libcudnn.so.6 /usr/local/lib/libcudnn.so.6 && sudo ldconfig
sudo cp /usr/local/cuda-8.0/lib64/libcudnn.so.6.0.21 /usr/local/lib/libcudnn.so.6.0.21 && sudo ldconfig

I add more libcudnn.so files to /usr/local/lib to avoid related alarms.


libcudnn.so.png

Darknet:

Reference Links:
https://pjreddie.com/darknet/yolo/

git clone https://github.com/pjreddie/darknet
cd Darknet
make
darknet makefile.png
-Download weight file
wget https://pjreddie.com/media/files/yolov3.weights houlaidewomen.png

Long time passed since I did the test, many alarms occurred during installation. I did it just for fun, and still many things to learn. Here just to record the issues that I met in case I need to do same work in the future. If anything wrong, I will appreciate your feedback.

-- the End--

上一篇 下一篇

猜你喜欢

热点阅读