使用TensorRT加速yolo3


一、TensorRT支持的模型: 

TensorRT 直接支持的modelONNXCaffeTensorFlow,其他常見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可參考:

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

 

三、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進行改寫加速的)

 

四、性能比較:

 

 

 

 

 

--------------------------------------------end~我是可愛的分割線~--------------------------------------

More about TensorRT 可參考官方指導:

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

 

 

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM