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.
相关推荐
no_work5 小时前
yolo摄像头下的目标检测识别集合
人工智能·深度学习·yolo·目标检测·计算机视觉
fundoit6 小时前
Windows 下 YOLO 环境搭建与使用完整指南
windows·yolo
jay神9 小时前
基于深度学习的车辆识别收费管理系统
人工智能·深度学习·yolo·目标检测·毕业设计
无巧不成书021811 小时前
FFmpeg 保姆级安装教程!Windows/macOS/Linux全平台覆盖,
windows·macos·ffmpeg
动物园猫11 小时前
7种交通场景目标检测数据集分享(适用于YOLO系列深度学习检测任务)
深度学习·yolo·目标检测
jay神1 天前
基于YOLOv8的钢材表面缺陷检测系统
人工智能·算法·yolo·目标检测·计算机视觉
no_work1 天前
基于yolo深度学习的混凝土裂缝检测
人工智能·深度学习·yolo
YOLO视觉与编程1 天前
一文读懂-yolo26如何预测识别图片|视频|摄像头|文件夹检测适用v8v11
人工智能·深度学习·yolo·目标检测·机器学习
容沁风1 天前
用opencv和yolov5su定位二维码
opencv·yolo·二维码
童话名剑2 天前
YOLO v4损失计算
yolo·yolo v4损失