/tiny-tensorrt

A simple, efficient, easy-to-use Nvidia TensorRT wrapper for CNN, support c++ and python.

Primary LanguageC++

image

tiny-tensorrt

A simple, efficient, easy-to-use nvidia TensorRT wrapper for cnn with c++ and python api,support caffe, uff and onnx format models. you will be able to deploy your model with tiny-tensorrt in few lines of code!

// create engine
trt.CreateEngine(onnxModelpath, engineFile, customOutput, maxBatchSize, mode);
// transfer you input data to tensorrt engine
trt.CopyFromHostToDevice(input,inputIndex);
// inference!!!
trt.Forward();
//  retrieve network output
trt.CopyFromHostToDevice(output, outputIndex) // you can get outputIndex in CreateEngine phase

News

Want to implement your own onnx plugin and don't know where to start?

onnx plugin template

Features

  • Support TensorRT 7
  • Custom plugin tutorial and well_commented sample!
  • Custom onnx model output node
  • Support onnx,caffe and tensorflow model(caffe and uff support will be removed at next major version)
  • PReLU and up-sample plugin
  • Engine serialization and deserialization
  • INT8 support
  • Python api support
  • Set device
  • Dynamic shape suppport for onnx

System Requirements

cuda 10.0+

TensorRT 6 or 7

For python api, python 2.x/3.x and numpy in needed

Installation

Make sure you had install dependencies list above, if you are familiar with docker, you can use official docker

# clone project and submodule
git clone --recurse-submodules -j8 https://github.com/zerollzeng/tiny-tensorrt.git

cd tiny-tensorrt

mkdir build && cd build && cmake .. && make

Then you can intergrate it into your own project with libtinytrt.so and Trt.h, for python module, you get pytrt.so

Docs

User Guide

Custom Plugin Tutorial (En-Ch)

If you want some examples with tiny-tensorrt, you can refer to tensorrt-zoo

For the windows port of tiny-tensorrt, you can refer to @Devincool's repo

Extra Support layer

  • upsample with custom scale, under test with yolov3.
  • yolo-det, last layer of yolov3 which sum three scales output and generate final result for nms. under test with yolov3.
  • PRELU, under test with openpose and mtcnn.

About License

For the 3rd-party module and TensorRT, maybe you need to follow their license

For the part I wrote, you can do anything you want