Inference examples are included in the files previously copied over to the target that illustrate how to integrate the model into python and C++ examples.
The examples have been installed in the following directories on the target under the directory that you created in step three. For example:
Python Inference Example
The Python inference example provided is
inference.py. There is an example bash script called
python_inference_commands.sh provided the same directory that calls this script three times, once each for FP32, FP16 and INT8.
You will notice with the bash script that you need to set a couple environment variables and pass several arguments.
TVM/TRT environment variables:
TVM_TENSORRT_CACHE_DIRcan be optionally set to a directory where the TRT engines should be cached. If not set, the engines are not cached and will be recreated each time.
TVM_TENSORRT_USE_FP16=1is set to run the FP16 model. If not set, the FP32 is used.
TRT_INT8_PATHis the location of the calibration data used during the creation of the TRT engines for INT8 (a hidden .activiations directory alongside the model library).
Command line options for
--model_pathis used to tell the example where to find the model binary.
--input_pathtells the example where to find the input image.
--labels coco.namestells the example to use coco style naming labels.
--counttells the example how many iterations to run.
Refer to the comments in the Python file for additional information on the inference example.
The C++ example provides a
Makefile that builds and links an example application called cpp_deploy. As with the Python example, there are several environment variables that need to be set.
As with the Python examples, note the use of the following TVM/TRT Environment Variables. Refer to the Python section above for more information.
Refer to the comments in the source file for more information on the C++ example.
The LRE binaries can now be integrated in the pre-trained model into your application. Please contact firstname.lastname@example.org for assistance if you need additional help integrating the model into your application.
If you would like to train the model with your own dataset, please refer to the instructions for Bring Your Own Data.