使用TensorRT加速yolo3

1、TensorRT支持的模型: 

TensorRT 直接支持的modelONNXCaffeTensorFlow,其余常见model建议先转化成ONNX。总结以下:html

1 ONNX(.onnx) python

2 Keras(.h5) --> ONNX(.onnx) (https://github.com/onnx/keras-onnx)git

3 Caffe(.caffemodel)github

4 Darknet(.cfg) --> ONNX(.onnx) (Our tutorial : yolo-v3)api

5 TensorFlow(.uff)网络

 

2、TensorRT支持的常见运算:ide

 Activation(激活函数)Convolution(卷积运算)Deconvolution(反卷积运算)FullConnected(全链接)Padding(填充)Pooling(池化)RNN(递归神经网络)SoftMax()等。函数

更详细的API可参考:性能

https://docs.nvidia.com/deeplearning/sdk/tensorrt-api/c_api/classnvinfer1_1_1_i_network_definition.htmlui

 

3、TensorRT加速yolo3

yolo3CNN网络和detection模块组成,TensorRT只对CNN网络进行Inference加速。即:

TensorRT input is608*608 image

TensorRT output isarray

  (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进行改写加速的)

 

4、性能比较:

 

 

 

 

 

--------------------------------------------end~我是可爱的分割线~--------------------------------------

More about TensorRT 可参考官方指导:

https://docs.nvidia.com/deeplearning/sdk/tensorrt-developer-guide/index.html#python_example_unsupported

 

 

 

原文出处:https://www.cnblogs.com/justcoder/p/10428100.html

相关文章
相关标签/搜索