Multitask Image Classification with TAO Deploy#

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

Converting .etlt File into TensorRT Engine#

You can reuse the spec from the Multitask Image 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 Multitask Image Classification from
the exported model at ``s3://my-bucket/mcls/mcls.etlt`` using
``trt-spec.yaml``. Calibrate against ``s3://my-bucket/mcls/cal-images/``
and write the engine to ``s3://my-bucket/mcls/int8.engine``. Run on
local Docker.

Running Evaluation through TensorRT Engine#

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

model_config {
  arch: "resnet",
  n_layers: 18
  use_batch_norm: true
  all_projections: true
  freeze_blocks: 0
  freeze_blocks: 1
  input_image_size: "3,80,60"
}
train_config {
  preprocess_mode: "caffe"
}
eval_config {
  eval_dataset_path: "/workspace/tao-experiments/data/split/test"
  model_path: "/export/int8.engine"
  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 Multitask Image Classification TensorRT engine at
``s3://my-bucket/mcls/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 Multitask Image Classification inference with the TensorRT engine
at ``s3://my-bucket/mcls/int8.engine`` using ``infer-spec.yaml``. Run on
your chosen backend.

CSV predictions are written to result.csv under the configured results directory.