Home

Awesome

TRTForYolov3

Desc

tensorRT for Yolov3

Test Enviroments

Ubuntu  16.04
TensorRT 5.0.2.6/4.0.1.6
CUDA 9.2

Models

Download the caffe model converted by official model:

If run model trained by yourself, comment the "upsample_param" blocks, and modify the prototxt the last layer as:

layer {
    #the bottoms are the yolo input layers
    bottom: "layer82-conv"
    bottom: "layer94-conv"
    bottom: "layer106-conv"
    top: "yolo-det"
    name: "yolo-det"
    type: "Yolo"
}

It also needs to change the yolo configs in "YoloConfigs.h" if different kernels.

Run Sample

#build source code
git submodule update --init --recursive
mkdir build
cd build && cmake .. && make && make install
cd ..

#for yolov3-608
./install/runYolov3 --caffemodel=./yolov3_608.caffemodel --prototxt=./yolov3_608.prototxt --input=./test.jpg --W=608 --H=608 --class=80

#for fp16
./install/runYolov3 --caffemodel=./yolov3_608.caffemodel --prototxt=./yolov3_608.prototxt --input=./test.jpg --W=608 --H=608 --class=80 --mode=fp16

#for int8 with calibration datasets
./install/runYolov3 --caffemodel=./yolov3_608.caffemodel --prototxt=./yolov3_608.prototxt --input=./test.jpg --W=608 --H=608 --class=80 --mode=int8 --calib=./calib_sample.txt

#for yolov3-416 (need to modify include/YoloConfigs for YoloKernel)
./install/runYolov3 --caffemodel=./yolov3_416.caffemodel --prototxt=./yolov3_416.prototxt --input=./test.jpg --W=416 --H=416 --class=80

Performance

ModelGPUModeInference Time
Yolov3-416GTX 1060Caffe54.593ms
Yolov3-416GTX 1060float3223.817ms
Yolov3-416GTX 1060int811.921ms
Yolov3-608GTX 1060Caffe88.489ms
Yolov3-608GTX 1060float3243.965ms
Yolov3-608GTX 1060int821.638ms
Yolov3-608GTX 1080 Tifloat3219.353ms
Yolov3-608GTX 1080 Tiint89.727ms
Yolov3-416GTX 1080 Tifloat329.677ms
Yolov3-416GTX 1080 Tiint86.129ms

Eval Result

run above models with appending --evallist=labels.txt

int8 calibration data made from 200 pics selected in val2014 (see scripts dir)

ModelGPUModedatasetMAP(0.50)MAP(0.75)
Yolov3-416GTX 1060Caffe(fp32)COCO val201450.3333.00
Yolov3-416GTX 1060float32COCO val201450.2732.98
Yolov3-416GTX 1060int8COCO val201444.1530.24
Yolov3-608GTX 1060Caffe(fp32)COCO val201452.8935.31
Yolov3-608GTX 1060float32COCO val201452.8435.26
Yolov3-608GTX 1060int8COCO val201448.5535.53

Notice:

Details About Wrapper

see link TensorRTWrapper