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.
相关推荐
Piar1231sdafa1 天前
基于YOLOv26的条形码与二维码识别检测实战
yolo
YH12312359h1 天前
YOLOv8_PST模型玉米生长阶段自动识别与分类
人工智能·yolo·分类
Piar1231sdafa1 天前
YOLOv26无人机空对空目标检测算法详解
yolo·目标检测·无人机
Faker66363aaa1 天前
【智能垃圾分类】YOLOv26实现多类别可回收物智能识别与分类系统
yolo·分类·数据挖掘
Faker66363aaa1 天前
基于YOLOv26的考场作弊行为自动检测与分类系统研究_1
yolo·分类·数据挖掘
YH12312359h1 天前
战斗机目标检测与跟踪:YOLOv26算法详解与应用
算法·yolo·目标检测
深圳市友昊天创科技有限公司1 天前
友昊天创推出8K ,4K 120Hz 100米延长器方案
音视频·实时音视频·视频编解码
Piar1231sdafa1 天前
【目标检测】竹林与杂草识别_YOLOv26改进算法研究
算法·yolo·目标检测
WJSKad12351 天前
基于YOLOv26的运动员手臂动作检测与分类系统_1
yolo·分类·数据挖掘
Piar1231sdafa1 天前
基于YOLOv26的海洋鱼类识别与检测系统深度学习训练数据集Python实现_1
python·深度学习·yolo