ubuntu14.04 install and run yolov2
My computer setting is ubuntu14.04+GeForce GTX TiTan X+cuda 8+opencv 2.4.9
sudo apt-get update
1. install cuda 8
install method can bu found online.
install command:
sudo dpkg -i cuda-repo-ubuntu1404-8-0-local-ga2_8.0.61-1_amd64.deb
sudo apt-get install cuda
remember environment setting :export PATH=/usr/local/cuda-8.0/bin${PATH:+:${PATH}}
sudo apt-get install nvidia-cuda-toolkit
nvcc -V
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2016 NVIDIA Corporation
Built on Tue_Jan_10_13:22:03_CST_2017
Cuda compilation tools, release 8.0, V8.0.61
test :
cd /usr/local/cuda-8.0/bin/
sudo sh cuda-install-samples-8.0.sh /home/xxx/(object file to test samples)
make
/usr/local/cuda-8.0/bin/nvcc -ccbin g++ -I../../common/inc -m64 -gencode arch=compute_20,code=compute_20 -o cudaModuleMgr.o -c cudaModuleMgr.cpp
nvcc warning : The 'compute_20', 'sm_20', and 'sm_21' architectures are deprecated, and may be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning).
notice: limits of authority ,and can be sudo chmod 777 NVIDIA_CUDA-8.0_Samples/
may face : 376 version problems
./bandwidthTest
[CUDA Bandwidth Test] - Starting...
Running on...
Device 0: GeForce GTX TITAN X
Quick Mode
Host to Device Bandwidth, 1 Device(s)
PINNED Memory Transfers
Transfer Size (Bytes) Bandwidth(MB/s)
33554432 11423.3
Device to Host Bandwidth, 1 Device(s)
PINNED Memory Transfers
Transfer Size (Bytes) Bandwidth(MB/s)
33554432 12845.2
Device to Device Bandwidth, 1 Device(s)
PINNED Memory Transfers
Transfer Size (Bytes) Bandwidth(MB/s)
33554432 249933.8
Result = PASS
NOTE: The CUDA Samples are not meant for performance measurements. Results may vary when GPU Boost is enabled.
2. install opencv
sudo apt-get install libgtk2.0-dev pkg-config
sudo apt-get install build-essential
sudo apt-get install cmake
cmake.
sudo make
[ 94%] Built target opencv_perf_superres_pch_dephelp
[ 94%] Built target pch_Generate_opencv_perf_superres
[ 94%] Built target opencv_superres_pch_dephelp
[ 94%] Built target pch_Generate_opencv_superres
Linking CXX shared library ../../lib/libopencv_superres.so
[ 95%] Built target opencv_superres
Linking CXX executable ../../bin/opencv_perf_superres
[ 95%] Built target opencv_perf_superres
[ 96%] Built target opencv_test_superres_pch_dephelp
[ 96%] Built target pch_Generate_opencv_test_superres
Linking CXX executable ../../bin/opencv_test_superres
[ 96%] Built target opencv_test_superres
[ 97%] Built target opencv_videostab_pch_dephelp
[ 98%] Built target pch_Generate_opencv_videostab
[ 99%] Built target opencv_videostab
[100%] Built target opencv_haartraining_engine
[100%] Built target opencv_createsamples
[100%] Built target opencv_haartraining
[100%] Built target opencv_performance
[100%] Built target opencv_traincascade
sudo make insatll
-- Set runtime path of "/usr/local/bin/opencv_haartraining" to "/usr/local/lib:/usr/local/cuda/lib64"
-- Installing: /usr/local/bin/opencv_createsamples
-- Set runtime path of "/usr/local/bin/opencv_createsamples" to "/usr/local/lib:/usr/local/cuda/lib64"
-- Installing: /usr/local/bin/opencv_performance
-- Set runtime path of "/usr/local/bin/opencv_performance" to "/usr/local/lib:/usr/local/cuda/lib64"
-- Installing: /usr/local/bin/opencv_traincascade
-- Set runtime path of "/usr/local/bin/opencv_traincascade" to "/usr/local/lib:/usr/local/cuda/lib64"
test:
Scanning dependencies of target DisplayImage
[100%] Building CXX object CMakeFiles/DisplayImage.dir/DisplayImage.cpp.o
Linking CXX executable DisplayImage
[100%] Built target DisplayImage
./DisplayImage cartoon.jpg
download
- git clone https://github.com/pjreddie/darknet
- cd darknet
- vim Makefile
- 修改,GPU=1 OPENCV=1
- wget http://pjreddie.com/media/files/yolo.weights
- make
- /bin/sh: 1: nvcc: not found make: *** [obj/convolutional_kernels.o] Error 127 ,This is path problem;addexport PATH=/usr/local/cuda-8.0/bin:$PATHexport LD_LIBRARY_PATH=/usr/local/cuda-8.0/lib64:$LD_LIBRARY_PATH
- ./darknet detect cfg/yolo.cfg yolo.weights data/horses.jpg
0 conv 32 3 x 3 / 1 608 x 608 x 3 -> 608 x 608 x 32
1 max 2 x 2 / 2 608 x 608 x 32 -> 304 x 304 x 32
2 conv 64 3 x 3 / 1 304 x 304 x 32 -> 304 x 304 x 64
3 max 2 x 2 / 2 304 x 304 x 64 -> 152 x 152 x 64
4 conv 128 3 x 3 / 1 152 x 152 x 64 -> 152 x 152 x 128
5 conv 64 1 x 1 / 1 152 x 152 x 128 -> 152 x 152 x 64
6 conv 128 3 x 3 / 1 152 x 152 x 64 -> 152 x 152 x 128
7 max 2 x 2 / 2 152 x 152 x 128 -> 76 x 76 x 128
8 conv 256 3 x 3 / 1 76 x 76 x 128 -> 76 x 76 x 256
9 conv 128 1 x 1 / 1 76 x 76 x 256 -> 76 x 76 x 128
10 conv 256 3 x 3 / 1 76 x 76 x 128 -> 76 x 76 x 256
11 max 2 x 2 / 2 76 x 76 x 256 -> 38 x 38 x 256
12 conv 512 3 x 3 / 1 38 x 38 x 256 -> 38 x 38 x 512
13 conv 256 1 x 1 / 1 38 x 38 x 512 -> 38 x 38 x 256
14 conv 512 3 x 3 / 1 38 x 38 x 256 -> 38 x 38 x 512
15 conv 256 1 x 1 / 1 38 x 38 x 512 -> 38 x 38 x 256
16 conv 512 3 x 3 / 1 38 x 38 x 256 -> 38 x 38 x 512
17 max 2 x 2 / 2 38 x 38 x 512 -> 19 x 19 x 512
18 conv 1024 3 x 3 / 1 19 x 19 x 512 -> 19 x 19 x1024
19 conv 512 1 x 1 / 1 19 x 19 x1024 -> 19 x 19 x 512
20 conv 1024 3 x 3 / 1 19 x 19 x 512 -> 19 x 19 x1024
21 conv 512 1 x 1 / 1 19 x 19 x1024 -> 19 x 19 x 512
22 conv 1024 3 x 3 / 1 19 x 19 x 512 -> 19 x 19 x1024
23 conv 1024 3 x 3 / 1 19 x 19 x1024 -> 19 x 19 x1024
24 conv 1024 3 x 3 / 1 19 x 19 x1024 -> 19 x 19 x1024
25 route 16
26 conv 64 1 x 1 / 1 38 x 38 x 512 -> 38 x 38 x 64
27 reorg / 2 38 x 38 x 64 -> 19 x 19 x 256
28 route 27 24
29 conv 1024 3 x 3 / 1 19 x 19 x1280 -> 19 x 19 x1024
30 conv 425 1 x 1 / 1 19 x 19 x1024 -> 19 x 19 x 425
31 detection
mask_scale: Using default '1.000000'
Loading weights from yolo.weights...Done!
data/horses.jpg: Predicted in 0.697368 seconds.
horse: 46%
horse: 59%
cow: 26%
horse: 91%
0.697/s,time is too long ,next will make use of cudnn6
Loading weights from weights/yolo.weights...Done!
data/horses.jpg: Predicted in 0.028641 seconds.
horse: 46%
horse: 59%
cow: 26%
horse: 91%
improve 45 times.
picture: ./darknet detect cfg/yolo.cfg weights/yolo.weights data/horses.jpg
video: ./darknet detector demo cfg/coco.data cfg/yolo.cfg weights/yolo.weights videos/PICT6595.mp4
usb-camera: ./darknet detector demo cfg/coco.data cfg/yolo.cfg weights/yolo.weights
anyway, feel recognition not good well.
next, will be select suitable device to run this algorithm , and optimize in order for our own apply.