一、运行环境
1、项目运行环境如下
2、CPU配置
3、GPU配置
如果没有GPU yolov5目标检测时间会比较久
二、编程语言与使用库版本
项目编程语言使用c++,使用的第三方库,onnxruntime-linux-x64-1.12.1,opencv-4.6.0
opencv 官方地址Releases - OpenCV
opencv github地址https://github.com/opencv/opencv/tree/4.10.0
onnxruntime 官方地址https://onnxruntime.ai/
onnxruntime github 地址GitHub - microsoft/onnxruntime: ONNX Runtime: cross-platform, high performance ML inferencing and training accelerator
三、 检测模型
1、项目使用yolov5目标检测模型
yolov5s.pt模型下载 ONNX > CoreML > TFLite">GitHub - ultralytics/yolov5: YOLOv5 🚀 in PyTorch > ONNX > CoreML > TFLite
2、使用命令 转换格式
python export.py --weights yolov5s.pt --include torchscript onnx
3、 使用feature.onnx 为特征提取模型
四、编译脚本
1、项目使用cmake 编写
创建文件CMakeLists.txt
cmake_minimum_required(VERSION 3.5)
add_definitions(-DPROJECT_PATH="${CMAKE_SOURCE_DIR}")
project(DeepSORT LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(ONNXRUNTIME_DIR ${CMAKE_SOURCE_DIR}/lib/onnxruntime-linux-x64-1.12.1)
set(OpenCV_DIR ${CMAKE_SOURCE_DIR}/lib/opencv-4.6.0/install/lib/cmake/opencv4) # 填入OpenCVConfig.cmake
include_directories("${ONNXRUNTIME_DIR}/include")
find_package(OpenCV 4 REQUIRED )
#message(STATUS "OpenCV_INCLUDE_DIRS: ${OpenCV_INCLUDE_DIRS}")
include_directories(
${OpenCV_INCLUDE_DIRS}
${CMAKE_SOURCE_DIR}/tracker/deepsort/include
${CMAKE_SOURCE_DIR}/tracker/bytetrack/include
${CMAKE_SOURCE_DIR}/detector/YOLOv5/include
${CMAKE_SOURCE_DIR}/include/eigen3
${CMAKE_SOURCE_DIR}/tracker/com/include
${CMAKE_SOURCE_DIR}/tracker/iou/include
)
add_executable(DeepSORT
detector/YOLOv5/src/YOLOv5Detector.cpp
tracker/deepsort/src/Feature