1.直接设置使用,编译通过
git clone https://github.com/pjreddie/darknet.git
cd darknet
make
2. 下载权重测试
wget http://pjreddie.com/media/files/yolo.weights
./darknet yolo test cfg/yolo.cfg yolo.weights data/dog.jpg
3.测试结果:
dsp@dsp:/media/dsp/学习/yolo_darknet/darknet$ ./darknet yolo test cfg/yolo.cfg yolo.weights data/dog.jpg
layer filters size input output
conv x / x x -> x x
max x / x x -> x x
conv x / x x -> x x
max x / x x -> x x
conv x / x x -> x x
conv x / x x -> x x
conv x / x x -> x x
max x / x x -> x x
conv x / x x -> x x
conv x / x x -> x x
conv x / x x -> x x
max x / x x -> x x
conv x / x x -> x x
conv x / x x -> x x
conv x / x x -> x x
conv x / x x -> x x
conv x / x x -> x x
max x / x x -> x x
conv x / x x -> x x1024
conv x / x x1024 -> x x
conv x / x x -> x x1024
conv x / x x1024 -> x x
conv x / x x -> x x1024
conv x / x x1024 -> x x1024
conv x / x x1024 -> x x1024
route
conv x / x x -> x x
reorg / x x -> x x
route
conv x / x x1280 -> x x1024
conv x / x x1024 -> x x
detection
mask_scale: Using default '1.000000'
Loading weights from yolo.weights…Done!
data/dog.jpg: Predicted in 9.566333 seconds.
Not compiled with OpenCV, saving to predictions.png instead
- 区分上下连个命令:
./darknet yolo test cfg/yolo.cfg yolo.weights data/dog.jpg
./darknet detect cfg/yolo.cfg yolo.weights data/dog.jpg
-/darknet detect cfg/yolo.cfg yolo.weights data/dog.jpg 结果:
4.设置GPU和opencv
GPU=
OPENCV=
-编译错误
/usr/bin/ld: cannot find -lippicv
collect2: error: ld returned exit status
Makefile:: recipe for target 'darknet' failed
make: *** [darknet] Error
/usr/bin/ld: cannot find -make: *** Waiting for unfinished jobs….
lippicv
collect2: error: ld returned exit status
Makefile:: recipe for target 'libdarknet.so' failed
make: *** [libdarknet.so] Error
- opencv安装的问题,于是重新安装
https://github.com/pjreddie/darknet/issues/290: /usr/bin/ld: cannot find -lippicv collect2: error: ld returned 1 exit status
https://github.com/opencv/opencv/issues/5852这篇文章中也遇到了这个错误. 可以在cmake时加上"cmake -DINSTALL_CREATE_DISTRIB=ON"
这句,就不会有这个错误了.
- 首先卸载opencv,然后在安装 :卸载参考:Ubuntu16.04 上openCV的卸载与 opencv3.0.2安装记录
cd /home/hy/opencv/build
make uninstall//卸载掉配置路径中的文件
sudo rm -r build//删除build文件
//删除掉环境中有关的其余包
sudo rm -r /usr/local/include/opencv2 /usr/local/include/opencv /usr/include/opencv /usr/include/opencv2 /usr/local/share/opencv /usr/local/share/OpenCV /usr/share/opencv /usr/share/OpenCV /usr/local/bin/opencv* /usr/local/lib/libopencv*
-安装,安装有图割错误,以前解决办法
dsp@dsp:~/opencv-3.1./build$ sudo cmake -D CMAKE_BUILD_TYPE=Release -D CMAKE_INSTALL_PREFIX=/usr/local .. -DWITH_IPP=ON -DINSTALL_CREATE_DISTRIB=ON
dsp@dsp:~/opencv-3.1./build$ sudo make -j$(nproc)
5. 在编译darknet
dart -lcublas -lcurand -lcudnn -lstdc++ libdarknet.a
/usr/local/lib/libopencv_imgcodecs.so: undefined reference to `TIFFReadRGBAStrip@LIBTIFF_4.'
/usr/local/lib/libopencv_imgcodecs.so: undefined reference to `TIFFReadDirectory@LIBTIFF_4.'
/usr/local/lib/libopencv_imgcodecs.so: undefined reference to `TIFFWriteEncodedStrip@LIBTIFF_4.'
/usr/local/lib/libopencv_imgcodecs.so: undefined reference to `TIFFIsTiled@LIBTIFF_4.'
/usr/local/lib/libopencv_imgcodecs.so: undefined reference to `TIFFWriteScanline@LIBTIFF_4.'
/usr/local/lib/libopencv_imgcodecs.so: undefined reference to `TIFFGetField@LIBTIFF_4.'
/usr/local/lib/libopencv_imgcodecs.so: undefined reference to `TIFFNumberOfStrips@LIBTIFF_4.'
/usr/local/lib/libopencv_imgcodecs.so: undefined reference to `TIFFScanlineSize@LIBTIFF_4.'
/usr/local/lib/libopencv_imgcodecs.so: undefined reference to `TIFFReadEncodedTile@LIBTIFF_4.'
/usr/local/lib/libopencv_imgcodecs.so: undefined reference to `TIFFReadRGBATile@LIBTIFF_4.'
/usr/local/lib/libopencv_imgcodecs.so: undefined reference to `TIFFClose@LIBTIFF_4.'
/usr/local/lib/libopencv_imgcodecs.so: undefined reference to `TIFFRGBAImageOK@LIBTIFF_4.'
/usr/local/lib/libopencv_imgcodecs.so: undefined reference to `TIFFOpen@LIBTIFF_4.'
/usr/local/lib/libopencv_imgcodecs.so: undefined reference to `TIFFReadEncodedStrip@LIBTIFF_4.'
/usr/local/lib/libopencv_imgcodecs.so: undefined reference to `TIFFSetField@LIBTIFF_4.'
/usr/local/lib/libopencv_imgcodecs.so: undefined reference to `TIFFSetWarningHandler@LIBTIFF_4.'
/usr/local/lib/libopencv_imgcodecs.so: undefined reference to `TIFFSetErrorHandler@LIBTIFF_4.'
collect2: error: ld returned exit status
Makefile:: recipe for target 'darknet' failed
make: *** [darknet] Error
//权限问题,sudo即可解决
这个可能是权限问题,采用以下指令:
sudo su;
一切都能顺利解决。
6. 运行yolo和yolo9000,可以实现demo运行,并实现视频检测
YOLOv2是Joseph Redmon提出的针对YOLO算法不足的改进版本,作者使用了一系列的方法对原来的YOLO多目标检测框架进行了改进,在保持原有速度的优势之下,精度上得以提升,此外作者提出了一种目标分类与检测的联合训练方法,通过这种方法YOLO9000可以同时在COCO和ImageNet数据集中进行训练,训练后的模型可以实现多达9000种物体的实时检测。
手机扫一扫
移动阅读更方便
你可能感兴趣的文章