R2Inference - TensorRT Examples

From RidgeRun Developer Connection
Jump to: navigation, search



Previous: Examples/TensorFlow-Lite Index Next: Examples/EdgeTPU




R2Inference provides several examples to highlight its usage with different architectures and frameworks. The models used for these examples can be downloaded from our Model Zoo.

Preparation

To test the TensorRT example you will need a TensorRT C++ API compatible graph file. You can obtain the model from the Model Zoo.

Yolo v2

This example is located in r2inference/examples/r2i/tensorrt . To use this example run:

./yolov2 -i [JPG input Image] -m [TRT Model]

For example, evaluating this image:

Error creating thumbnail: Unable to save thumbnail to destination
Inception example input

Should produce the following output:

./yolov2 -i Plane_example_input.jpg -m graph_yolov2.trt
Loading Model: graph_yolov2.trt
Setting model to engine
Loading image: Plane_example_input.jpg
Configuring frame
Starting engine
Predicting...
prob: 12.11	 label: 0
x: 148	y: 68	 width: 130	 height: 107
prob: 12.30	 label: 0
x: 71	y: 51	 width: 275	 height: 138
prob: 8.96	 label: 0
x: 151	y: 67	 width: 160	 height: 108
prob: 9.24	 label: 0
x: 103	y: 51	 width: 266	 height: 136
prob: 14.02	 label: 0
x: 34	y: 75	 width: 296	 height: 126
prob: 12.29	 label: 0
x: 149	y: 70	 width: 127	 height: 129
prob: 13.00	 label: 0
x: 70	y: 78	 width: 279	 height: 118
prob: 8.39	 label: 0
x: 152	y: 80	 width: 158	 height: 109
prob: 9.54	 label: 0
x: 99	y: 79	 width: 280	 height: 118
Stopping engine

According to the VOC labels 0 corresponds to an 'aeroplane'.




Previous: Examples/TensorFlow-Lite Index Next: Examples/EdgeTPU