EfficientDet (TF1) with TAO Deploy#

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

Converting .onnx File into TensorRT Engine#

You can reuse the spec from the TF1 EfficientDet export action as a starting point. For EfficientDet, INT8 calibration is a one-step process with data batches generated on the fly.

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

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

Running Evaluation through TensorRT Engine#

The label file is derived from dataset_config.validation_json_file in the specification file. Use the same specification file as the TAO evaluation specification file. The following is a sample specification file:

dataset_config {
    num_classes: 91
    image_size: "512,512"
    training_file_pattern: "/workspace/tao-experiments/data/train*.tfrecord"
    validation_file_pattern: "/workspace/tao-experiments/data/val*.tfrecord"
    validation_json_file: "/workspace/tao-experiments/data/raw-data/annotations/instances_val2017.json"
    max_instances_per_image: 100
    skip_crowd_during_training: True
}
eval_config {
    eval_batch_size: 16
    eval_epoch_cycle: 2
    eval_samples: 500
    min_score_thresh: 0.4
    max_detections_per_image: 100
}

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

Evaluate the TF1 EfficientDet TensorRT engine at
``s3://my-bucket/effdet-tf1/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 TF1 EfficientDet inference with the TensorRT engine at
``s3://my-bucket/effdet-tf1/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.