YOLOv8目标检测推理流程及C++代码
这部分主要是使用c++对Onnx模型进行推理,边先贴代码,过段时间再详细补充下代码说明。
代码主要分成三部分,1.main_det.cpp推理函数主入口;2.inference_det.h 头文件及inference_det.cpp具体函数实现;3.CMakeList.txt.
1.main_det
推理配置信息全部写在config.txt中,执行代码时会读取该文本中配置信息来进行推理,config.txt格式如下:
rectConfidenceThreshold=0.5
iouThreshold=0.7
imageSize=640
img_root=/root/inference_CPP/inferenceCPP_2/images
save_root=/root/inference_CPP/inferenceCPP_2/output
modelPath=/root/inference_CPP/inferenceCPP_2/yolov8n.onnx
useGPU=true
classes=0: person,1: bicycle,2: car,3: motorcycle,4: airplane,5: bus,6: train,7: truck,8: boat,9: traffic light,10: fire hydrant,11: stop sign,12: parking meter,13: bench,