Classification (TF1) with TAO Deploy#
To generate an optimized TensorRT engine for TF1 Classification, the gen_trt_engine action
takes an ONNX file previously produced by the TF1 Classification export action. For more
information about training the TF1 Classification, refer to the
TF1 Classification training documentation.
Converting .onnx File into TensorRT Engine#
You can reuse the spec from the TF1 Classification export action as a starting point.
Ask the agent to run the gen_trt_engine action against your spec. For example:
Build an INT8 TensorRT engine for TF1 Classification from the exported
ONNX at ``s3://my-bucket/cls-tf1/mcls.onnx`` using ``trt-spec.yaml``.
Calibrate against ``s3://my-bucket/cls-tf1/cal-images/`` and write the
engine to ``s3://my-bucket/cls-tf1/int8.engine``. Run on local Docker.
Running Evaluation through TensorRT Engine#
You can reuse the TAO evaluation specification file for evaluation through a TensorRT engine. The following is a sample specification file:
model_config {
arch: "resnet",
n_layers: 18
use_batch_norm: true
all_projections: true
input_image_size: "3,224,224"
}
train_config {
preprocess_mode: "caffe"
}
eval_config {
eval_dataset_path: "/workspace/tao-experiments/data/split/test"
model_path: "/workspace/tao-experiments/classification_tf1/output_retrain/weights/resnet_080.tlt"
top_k: 3
batch_size: 256
n_workers: 8
enable_center_crop: True
}
Ask the agent to run the evaluate action against the engine you built. For example:
Evaluate the TF1 Classification TensorRT engine at
``s3://my-bucket/cls-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 Classification inference with the TensorRT engine at
``s3://my-bucket/cls-tf1/int8.engine`` using ``infer-spec.yaml``. Run on
your chosen backend.
CSV predictions are written to result.csv under the configured results directory.