AlexeyAB版本Darknet的README.md中文版本
1、opencv
下载3.4.0版本opencv(测试成功)
wget https://github.com/opencv/opencv/archive/3.4.0.zip
安装
参考:
Ubuntu下编译Opencv4.0及opencv_contribute模块步骤详解 - 云+社区 - 腾讯云
Ubuntu 16.04 安装opencv的各种方法(含opencv contrib扩展包安装方法)_ZeroZone零域的博客-CSDN博客_ubuntu安装opencv
darknet入门—yolov3目标检测(安装、编译、实现) - 知乎
(图片来源:https://github.com/AlexeyAB/darknet#how-to-train-tiny-yolo-to-detect-your-custom-objects)
unzip opencv-3.4.0.zip
mkdir build
cd build
cmake -D CMAKE_BUILD_TYPE=RELEASE \
-D INSTALL_C_EXAMPLES=ON \
-D INSTALL_PYTHON_EXAMPLES=ON \
-D BUILD_EXAMPLES=ON \
-D BUILD_opencv_python2=OFF \
-D BUILD_opencv_python3=ON \
-D WITH_FFMPEG=ON \
-D WITH_LIBV4L=ON \
-D WITH_GTK=ON \
-D WITH_OPENGL=ON \
-D WITH_ZLIB=ON \
-D BUILD_PNG=ON \
-D BUILD_JPEG=ON \
-D BUILD_TIFF=ON \
-D WITH_CUDA=ON \
-D WITH_OPENCL=ON \
-D ENABLE_FAST_MATH=1 \
-D CUDA_FAST_MATH=1 \
-D WITH_CUBLAS=1 \
-D WITH_LAPACK=OFF \
-D CMAKE_INSTALL_PREFIX=/你/的/opencv安装路径 \ #也可选默认路径 /usr/local
-D PYTHON3_EXECUTABLE=$(which python) \ #安装在当前python路径
-D PYTHON3_INCLUDE_DIR=$(python -c "from distutils.sysconfig import get_python_inc; print(get_python_inc())") \
-D PYTHON3_PACKAGES_PATH=$(python -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())") ..
make -j16 # 16代表线程,越大跑得越快
make install
#设置环境
export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH" #安装路径
2、Darknet安装
开坑Jetson Nano(三):试跑yolov3(tiny版和tiny剪枝版)_(~o▔▽▔)~o o~(▔▽▔o~)的博客-CSDN博客
详细步骤!使用yolov3-tiny训练,测试、验证VOC数据集 - 灰信网(软件开发博客聚合)
报错
./darknet: error while loading shared libraries: libopencv_highgui.so.3.4: cannot open shared object file: No such file or
directory
解决方法:
# 查看需要哪些库
ldd darknet
# 定位库的位置
locate 库名
#例如:
locate libopencv_highgui.so.3.4
# 写入库的位置
#1)修改ld的配置文件
sudo vim /etc/ld.so.conf
#加入
/xxxxxx/xxxxxx/opencv-3.4.0/build/lib # 注(opencv编译时设置的路径)
/xxxxxx/xxxxxx/opencv-3.4.0/lib/x86_64-linux-gnu
/xxxxxx/xxxxxx/anaconda3/envs/py3.8/lib # 注(opencv编译时设置的python路径)
#2) 再运行
ldconfig
make clean
make
darknet 的python接口使用