Home

Awesome

ONNX-TensorRT

Yolov5(4.0)/Yolov5(5.0)/YoloR/YoloX/Yolov4/Yolov3/CenterNet/CenterFace/RetinaFace/Classify/Unet Implementation

Yolov4/Yolov3/Yolov5/yolor/YoloX

centernet

Unet

<img src="./model/result/unet.jpg" style="zoom:70%;" /> <img src="./model/result/unet_result.png" style="zoom:70%;" />

CenterFace

<img src="./model/result/centerface_result.png" style="zoom:70%;" />

retinaface

<img src="./model/result/retinaface_result.png" style="zoom:70%;" />

INTRODUCTION

you have the trained model file from the darknet/libtorch/pytorch/mxnet

Features

<details><summary><b>BENCHMARK</b></summary>

window x64 (detect time)

modelsizegpufp32fp16INT8GPU(MB)(FP32/FP16/INT8)
yolov3608x6082080ti28.14ms19.79ms18.53ms1382/945/778
yolov4320x3202080ti8.85ms6.62ms6.33ms1130/1075/961
yolov4416x4162080ti12.19ms10.20ms9.35ms1740/1193/1066
yolov4512x5122080ti15.63ms12.66ms12.19ms1960/1251/1218
yolov4608x6082080ti24.39ms17.54ms17.24ms1448/1180/1128
yolov4320x32030709.70ms7.30ms6.37ms1393/1366/1238
yolov4416x416307014.08ms9.80ms9.70ms1429/1394/1266
yolov4512x512307018.87ms13.51ms13.51ms1485/1436/1299
yolov4608x608307028.57ms19.60ms18.52ms1508/1483/1326
yolov4320x320107018.52ms\12.82ms686//442
yolov4416x416107027.03ms\20.83ms1480//477
yolov4512x512107034.48ms\27.03ms1546//515
yolov4608x608107050ms\35.71ms1272//584
yolov4320x3201660TI16.39ms11.90ms10.20ms1034/863/787
yolov4416x4161660TI23.25ms17.24ms13.70ms1675/1227/816
yolov4512x5121660TI29.41ms24.39ms21.27ms1906/1322/843
yolov4608x6081660TI43.48ms34.48ms26.32ms1445/1100/950
yolov5 5s640x6402080ti24.47ms22.46ms22.38ms720/666/652
yolov5 5m640x6402080ti30.61ms24.02ms23.73ms851/728/679
yolov5 5l640x6402080ti32.58ms25.84ms24.44ms1154/834/738
yolov5 5x640x6402080ti40.69ms29.81ms27.19ms1530/1001/827
yolor_csp_x512x5122080ti27.89ms20.54ms18.71ms2373/1060/853
yolor_csp512x5122080ti21.30ms18.06ms17.03ms1720/856/763
YOLOX-Nano416x4162080ti6.84ms6.81ms6.69ms795/782/780
YOLOX-Tiny416x4162080ti7.86ms7.13ms6.73ms823/798/790
YOLOX-S640x6402080ti19.51ms16.62ms16.33ms940/836/794
YOLOX-M640x6402080ti23.35ms18.67ms17.87ms919/716/684
YOLOX-L640x6402080ti28.25ms20.36ms19.24ms1410/855/769
YOLOX-Darknet53640x6402080ti29.95ms20.38ms18.91ms1552/928/772
YOLOX-X640x6402080ti40.40ms22.95ms21.99ms1691/1187/1020
darknet53224*2242080ti3.53ms1.84ms1.71ms1005/769/658
darknet53224*22430704.29ms2.16ms1.75ms1227/1017/951
resnet18-v2-7224*2242080ti1.89ms1.29ms1.18ms878/655/624
unet512*5122080ti20.91ms17.01ms16.05ms1334/766/744
retinaface_r50512x5122080ti12.33ms8.96ms8.22ms1189/745/678
mnet.25512x5122080ti6.90ms6.32ms6.23ms782/603/615

x64(inference / detect time)

modelsizegpufp32(inference/detect)fp16(inference/detect)INT8(inference/detect)GPU(MB)(FP32/FP16/INT8)
centernet512x5122080ti17.8ms/39.7ms15.7ms/36.49ms14.37ms/36.34ms1839/1567/1563
centerface640x6402080ti5.56ms/11.79ms4.23ms/10.89ms/854/646/640
centerface_bnmerged640x6402080ti5.67ms/11.82ms4.22ms/10.46ms/850/651/645
</details>

windows10

Model and 3rdparty

model : https://drive.google.com/drive/folders/1KzBjmCOG9ghcq9L6-iqfz6QwBQq6Hl4_?usp=sharing or https://share.weiyun.com/td9CRDhW

3rdparty:https://drive.google.com/drive/folders/1SddUgQ5kGlv6dDGPqnVWZxgCoBY85rM2?usp=sharing or https://share.weiyun.com/WEZ3TGtb

API

struct Config
{
    std::string cfgFile = "configs/yolov3.cfg";

    std::string onnxModelpath = "configs/yolov3.onnx";

    std::string engineFile = "configs/yolov3.engine";

    std::string calibration_image_list_file = "configs/images/";

    std::vector<std::string> customOutput;

    int calibration_width = 0;

    int calibration_height = 0;
    
    int maxBatchSize = 1;

    int mode; //0,1,2

    //std::string calibration_image_list_file_txt = "configs/calibration_images.txt";
};

class YoloDectector
{
void init(Config config);
void detect(const std::vector<cv::Mat>& vec_image,
	std::vector<BatchResult>& vec_batch_result);
}

REFERENCE

https://github.com/onnx/onnx-tensorrt.git

https://github.com/NVIDIA/TensorRT/tree/master/samples/opensource/sampleDynamicReshape

https://github.com/NVIDIA-AI-IOT/deepstream_reference_apps

https://github.com/enazoe/yolo-tensorrt.git

https://github.com/zerollzeng/tiny-tensorrt.git

Contact

<img src="./model/result/weixin.jpg" style="zoom:50%;" />