Skip to content

riotu-lab/tf2trt_with_onnx

Repository files navigation

tf2trt_wtih_onnx

This repo documnet how to convert Tensorflow / Keras model to TRT engine using ONNX.

Deprication of Caffe Parser and UFF Parser in TensorRT 7

Note this quote from the official TensorRT Release Notes:

Deprecation of Caffe Parser and UFF Parser - We are deprecating Caffe Parser and UFF Parser in TensorRT 7. They will be tested and functional in the next major release of TensorRT 8, but we plan to remove the support in the subsequent major release. Plan to migrate your workflow to use tf2onnx, keras2onnx or TensorFlow-TensorRT (TF-TRT) for deployment.

In this repository, we will use tf2onnx to convert Keras model to TRT engine.

ONNX Workflow

ONNX-workflow-1024x195 ONNX Workflow - image source.

  1. Convert the TensorFlow/Keras model to a .pb file.
  2. Convert the .pb file to the ONNX format.
  3. Create a TensorRT engine.
  4. Run inference from the TensorRT engine.

Jupyter Notebook

The steps are documented in this Jupyter notebook.

Known Issues

Protobuf compiler not found while installing tf2onnx tool
image

Solution
sudo apt-get install libprotobuf-dev protobuf-compiler