Qt+YOLOv4实现目标检测
Posted QtHalcon
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Qt+YOLOv4实现目标检测相关的知识,希望对你有一定的参考价值。
环境:
系统:win10 (显卡:NVIDIA GTX 1050)
Yolo版本:V4
cuda:11.2
cudnn:8.1.1
opencv:3.4.15
VS:2019
1.编译前准备
1.1 opencv
首先要安装opencv,下载地址如下
https://opencv.org/
安装3.4.16就可以了
1.2 安装cuda和cudnn
安装教程可以参考我这篇文章。
2.编译YOLO
YOLO下载地址:
https://github.com/AlexeyAB/darknet
https://codechina.csdn.net/mirrors/alexeyab/darknet?utm_source=csdn_github_accelerator
用记事本打开yolo_cpp_dll.vcxproj
将里面的版本换成自己的版本,文件中有两处修改。
修改完成后,打开yolo_cpp_dll.sln,然后选择release,然后生成。
生成完后就会得到DLL和LIB。
然后将头文件和库拷贝到自己工程目录下。
3.构建项目
3.1 添加头文件路径和库
#OPENCV
INCLUDEPATH += E:/build/include/
INCLUDEPATH += E:/build/include/opencv/
INCLUDEPATH += E:/build/include/opencv2/
LIBS += -LE:/build/x64/vc15/lib/ -lopencv_world3415
#YOLO
INCLUDEPATH += $$PWD/yolov4/include/
LIBS += -L$$PWD/yolov4/lib/ -lyolo_cpp_dll
3.2 添加宏和头文件
//
#define OPENCV
#define GPU
#include "yolo_v2_class.hpp"
//
#include <opencv2\\opencv.hpp>
#include "opencv2/highgui/highgui.hpp"
using namespace cv;
3.3 要下载这几个文件
里面有权重文件。
https://pan.baidu.com/s/1c-clykwyKHGQp2ENnJjFoA
密码:d6lz
3.4 最后运行程序
结果如下:
测试源码地址:
https://download.csdn.net/download/qq_40732350/33811403
参考链接:
https://link.zhihu.com/?target=https%3A//pjreddie.com/media/files/yolov3.weights
https://blog.csdn.net/weixin_42448226/article/details/105752224
https://www.cnblogs.com/ivint/p/14298388.html
https://github.com/gyutaebbb/yolo-qt
https://github.com/AlexeyAB/darknet
1、https://blog.csdn.net/lixudem/article/details/106993430?utm_medium=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-6.control&depth_1-utm_source=distribute.pc_relevant.none-task-blog-BlogCommendFromMachineLearnPai2-6.control
2、https://blog.csdn.net/sinat_41852207/article/details/90906309?utm_medium=distribute.pc_relevant.none-task-blog-OPENSEARCH-5.control&depth_1-utm_source=distribute.pc_relevant.none-task-blog-OPENSEARCH-5.control
3、https://blog.csdn.net/alansss/article/details/104448347?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522161095690516780271532753%2522%252C%2522scm%2522%253A%252220140713.130102334.pc%255Fall.%2522%257D&request_id=161095690516780271532753&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~all~first_rank_v2~rank_v29-3-104448347.first_rank_v2_pc_rank_v29&utm_term=win10%E7%BC%96%E8%AF%91yolov3%E6%97%B6%E6%8A%A5%E9%94%99error%20MSB3721&spm=1018.2226.3001.4187
4、https://blog.csdn.net/jin739738709/article/details/90342696
5、https://blog.csdn.net/stjuliet/article/details/87884976?ops_request_misc=%257B%2522request%255Fid%2522%253A%2522161102361916780269894467%2522%252C%2522scm%2522%253A%252220140713.130102334.pc%255Fall.%2522%257D&request_id=161102361916780269894467&biz_id=0&utm_medium=distribute.pc_search_result.none-task-blog-2~all~first_rank_v2~rank_v29-3-87884976.first_rank_v2_pc_rank_v29&utm_term=%E4%BD%BF%E7%94%A8yolo%E7%9A%84%E5%8A%A8%E6%80%81%E9%93%BE%E6%8E%A5%E5%BA%93&spm=1018.2226.3001.4187
以上是关于Qt+YOLOv4实现目标检测的主要内容,如果未能解决你的问题,请参考以下文章
基于YOLOv4的目标检测系统(附MATLAB代码+GUI实现)
YOLO-Darknet实战:Ubuntu下QT自建YOLOv4工程(C++版本)
YOLO-Darknet实战:Ubuntu下QT自建YOLOv4工程(C++版本)