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的分享

编译项目并运行

 make yolo -j64

模型转换:

[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 !

软件解码

输出

[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.

硬件解码

输出

[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.
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

给算法爸爸上香

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值