使用TensorRT加速yolo3
一、TensorRT支持的模型:
TensorRT 直接支持的model有ONNX、Caffe、TensorFlow,其他常见model建议先转化成ONNX。总结如下:
1 ONNX(.onnx)
2 Keras(.h5) --> ONNX(.onnx) (https://github.com/onnx/keras-onnx)
3 Caffe(.caffemodel)
4 Darknet(.cfg) --> ONNX(.onnx) (Our tutorial : yolo-v3)
5 TensorFlow(.uff)
二、TensorRT支持的常见运算:
Activation(激活函数)、Convolution(卷积运算)、Deconvolution(反卷积运算)、FullConnected(全连接)、Padding(填充)、Pooling(池化)、RNN(递归神经网络)、SoftMax()等。
更详细的API可参考:
三、TensorRT加速yolo3:
yolo3由CNN网络和detection模块组成,TensorRT只对CNN网络进行Inference加速。即:
TensorRT input is:608*608 image
TensorRT output is:array
(array[0].shape = 255 *19*19、
array[1].shape = 255*38*38、
array[2].shape = 255 *76*76)
具体实现过程:
1 Darknet(.cfg) --> ONNX(.onnx)
2 ONNX(.onnx) --> TensorRT model(.trt)
3 TensorRT加速CNN部分,执行detection模块得到最终结果。
pytorch-yolo3:https://github.com/ayooshkathuria/pytorch-yolo-v3
本项目地址:https://github.com/Cw-zero/TensorRT_yolo3
(注:本项目是对pytorch-yolo3进行改写加速的)
四、性能比较:
--------------------------------------------end~我是可爱的分割线~--------------------------------------
More about TensorRT 可参考官方指导:
【推荐】100%开源!大型工业跨平台软件C++源码提供,建模,组态!
【推荐】AI 的力量,开发者的翅膀:欢迎使用 AI 原生开发工具 TRAE
【推荐】2025 HarmonyOS 鸿蒙创新赛正式启动,百万大奖等你挑战
· 记一次 C# 平台调用中因非托管 union 类型导致的内存访问越界
· [EF Core]聊聊“复合”属性
· 那些被推迟的 C# 14 特性及其背后的故事
· 我最喜欢的 C# 14 新特性
· 程序员究竟要不要写文章
· 我是不是很有钱?
· 遭遇疯狂 cc 攻击的一个周末
· 【EF Core】聊聊“复合”属性
· GPT‑5 重磅发布
· 美丽而脆弱的天体运动:当C#遇见宇宙混沌