YOLOv4 with TAO Deploy#

To generate an optimized TensorRT engine for YOLOv4, the gen_trt_engine action takes an ONNX file previously produced by the YOLOv4 export action. For more information about training the YOLOv4, refer to the YOLOv4 training documentation.

Converting an .onnx File into TensorRT Engine#

You can reuse the spec from the YOLOv4 export action as a starting point.

Note

When generating a TensorRT engine for a model trained with QAT enabled, the tensor scale factors defined by the calibration cache file are required. However, the current version of QAT does not natively support DLA int8 deployment on Jetson. To deploy this model on a Jetson with DLA int8, force post-training quantization to generate the calibration cache file.

Ask the agent to run the gen_trt_engine action against your spec. For example:

Build an INT8 TensorRT engine for YOLOv4 from the exported ONNX at
``s3://my-bucket/yolov4/model.onnx`` using ``trt-spec.yaml``. Calibrate
against ``s3://my-bucket/yolov4/cal-images/`` and write the engine to
``s3://my-bucket/yolov4/int8.engine``. Run on local Docker.

Running Evaluation through TensorRT Engine#

Use the same specification file as the TAO evaluation specification file.

Ask the agent to run the evaluate action against the engine you built. For example:

Evaluate the YOLOv4 TensorRT engine at
``s3://my-bucket/yolov4/int8.engine`` against ``eval-spec.yaml``. Run on
local Docker.

Running Inference through TensorRT Engine#

Ask the agent to run the inference action against the engine you built. For example:

Run YOLOv4 inference with the TensorRT engine at
``s3://my-bucket/yolov4/int8.engine`` using ``infer-spec.yaml``. Run on
your chosen backend.

Annotated visualizations are written to images_annotated under the configured results directory, and KITTI-format predictions are written to labels.