yolo tensorrt视频流检测软解码和硬解码

项目地址:https://github.com/shouxieai/hard_decode_trt

环境配置

依赖第三方库:

cuda-10.2 https://developer.nvidia.com/cuda-10.2-download-archive

cudnn8.2.2.26 https://developer.nvidia.com/rdp/cudnn-archive

ffmpeg4.2 https://codeload.github.com/FFmpeg/FFmpeg/zip/refs/tags/n4.2

protobuf3.11.4 https://codeload.github.com/protocolbuffers/protobuf/zip/refs/tags/v3.11.4

opencv4.2.0 https://codeload.github.com/opencv/opencv/zip/refs/tags/4.2.0

TensorRT-8.0.1.6 https://developer.nvidia.com/nvidia-tensorrt-8x-download

Video_Codec_SDK_10.0.26 https://developer.nvidia.com/video-codec-sdk-archive

百度网盘下载链接:通过网盘分享的文件:

链接: https://pan.baidu.com/s/15EDzhLEWywpcelyKDEUkAw 提取码: btae 复制这段内容后打开百度网盘手机App,操作更方便哦

--来自百度网盘超级会员v7的分享

编译项目并运行

bash 复制代码
 make yolo -j64

模型转换:

bash 复制代码
[2025-12-15 08:20:51][info][app_yolo.cpp:46]:===================== test YoloV5 FP32 yolov5n ==================================
yolov5n.onnx
[2025-12-15 08:20:51][info][trt_builder.cpp:471]:Compile FP32 Onnx Model 'yolov5n.onnx'.
[2025-12-15 08:20:51][info][trt_builder.cpp:557]:Input shape is -1 x 3 x 640 x 640
[2025-12-15 08:20:51][info][trt_builder.cpp:558]:Set max batch size = 16
[2025-12-15 08:20:51][info][trt_builder.cpp:559]:Set max workspace size = 1024.00 MB
[2025-12-15 08:20:51][info][trt_builder.cpp:562]:Network has 1 inputs:
[2025-12-15 08:20:51][info][trt_builder.cpp:568]:      0.[images] shape is -1 x 3 x 640 x 640
[2025-12-15 08:20:51][info][trt_builder.cpp:574]:Network has 1 outputs:
[2025-12-15 08:20:51][info][trt_builder.cpp:579]:      0.[output0] shape is -1 x 25200 x 85
[2025-12-15 08:20:51][info][trt_builder.cpp:583]:Network has 371 layers:
[2025-12-15 08:20:51][info][trt_builder.cpp:650]:Building engine...
[2025-12-15 08:20:52][warn][trt_builder.cpp:33]:NVInfer: Detected invalid timing cache, setup a local cache instead
[2025-12-15 08:21:29][info][trt_builder.cpp:670]:Build done 38259 ms !

软件解码

输出

bash 复制代码
[2025-12-15 08:21:30][info][trt_infer.cpp:177]:Infer 0x7f05d4000c50 detail
[2025-12-15 08:21:30][info][trt_infer.cpp:178]: Max Batch Size: 16
[2025-12-15 08:21:30][info][trt_infer.cpp:179]: Inputs: 1
[2025-12-15 08:21:30][info][trt_infer.cpp:183]:         0.images : shape {16 x 3 x 640 x 640}, Float32
[2025-12-15 08:21:30][info][trt_infer.cpp:186]: Outputs: 1
[2025-12-15 08:21:30][info][trt_infer.cpp:190]:         0.output0 : shape {16 x 25200 x 85}, Float32
[2025-12-15 08:21:30][info][app_yolo.cpp:203]:soft decode and inference time: 230.64 ms
[2025-12-15 08:21:31][info][yolo.cpp:288]:Engine destroy.

硬件解码

输出

bash 复制代码
[2025-12-15 08:21:31][info][trt_infer.cpp:177]:Infer 0x7f05d4001140 detail
[2025-12-15 08:21:31][info][trt_infer.cpp:178]: Max Batch Size: 16
[2025-12-15 08:21:31][info][trt_infer.cpp:179]: Inputs: 1
[2025-12-15 08:21:31][info][trt_infer.cpp:183]:         0.images : shape {16 x 3 x 640 x 640}, Float32
[2025-12-15 08:21:31][info][trt_infer.cpp:186]: Outputs: 1
[2025-12-15 08:21:31][info][trt_infer.cpp:190]:         0.output0 : shape {16 x 25200 x 85}, Float32
[2025-12-15 08:21:31][info][app_yolo.cpp:169]:hard decode and inference time: 114.35 ms
[2025-12-15 08:21:32][info][yolo.cpp:288]:Engine destroy.
相关推荐
张二娃同学1 天前
深度学习入门篇——YOLO数据集的制作与模型训练
人工智能·深度学习·yolo
数据光子1 天前
【YOLO数据集】船舶检测
人工智能·python·yolo·目标检测·计算机视觉·目标跟踪
吾在学习路1 天前
【经典论文解读】YOLACT: Real-time Instance Segmentation(YOLOv5、YOLOv8实例分割的基础)
人工智能·yolo·目标跟踪
程序员爱德华1 天前
基于YOLOv8的车辆行人检测系统
yolo·目标检测
dwp11471706071 天前
在Windows上基于MSYS2 UCRT64工具链编译ffmpeg源码
windows·ffmpeg
汤姆yu1 天前
基于YOLOv8模型的行人车辆多目标检测计数与跟踪系统
yolo
音沐mu.1 天前
【38】混凝土裂缝数据集(有v5/v8模型)/YOLO混凝土裂缝检测
yolo·目标检测·计算机视觉·数据集·混凝土裂缝数据集·混凝土裂缝检测
QtHalcon1 天前
YOLOv11 +QT环境安装+标注训练+部署
深度学习·qt·yolo
qunaa01011 天前
YOLOV8与CGAFusion融合实现建筑工人头部安全装备检测
安全·yolo·目标跟踪