LPRNet with TAO Deploy#
To generate an optimized TensorRT engine for LPRNet, the gen_trt_engine action takes an
ONNX file previously produced by the LPRNet export action. For more information about
training the LPRNet, refer to the LPRNet training documentation.
Converting .onnx File into TensorRT Engine#
You can reuse the spec from the LPRNet export action as a starting point. Note that
int8 is not supported for LPRNet — use fp32 or fp16.
Ask the agent to run the gen_trt_engine action against your spec. For example:
Build an FP16 TensorRT engine for LPRNet from the exported ONNX at
``s3://my-bucket/lprnet/model.onnx`` using ``trt-spec.yaml``. Write the
engine to ``s3://my-bucket/lprnet/fp16.engine``. Run on the local Docker daemon.
Running Evaluation through TensorRT Engine#
Use the same specification file as the TAO evaluation specification file. The following is a sample specification file:
random_seed: 42
lpr_config {
hidden_units: 512
max_label_length: 8
arch: "baseline"
nlayers: 10
}
eval_config {
batch_size: 1
}
augmentation_config {
output_width: 96
output_height: 48
output_channel: 3
}
dataset_config {
data_sources: {
label_directory_path: "/workspace/tao-experiments/datasets/lpr_default_dataset/train/label"
image_directory_path: "/workspace/tao-experiments/datasets/lpr_default_dataset/train/image"
}
characters_list_file: "/workspace/tao-experiments/datasets/lpr_default_dataset/us_lp_characters.txt"
validation_data_sources: {
label_directory_path: "/workspace/tao-experiments/datasets/lpr_default_dataset/test/label"
image_directory_path: "/workspace/tao-experiments/datasets/lpr_default_dataset/test/image"
}
}
Ask the agent to run the evaluate action against the engine you built. For example:
Evaluate the LPRNet TensorRT engine at ``s3://my-bucket/lprnet/fp16.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 LPRNet inference with the TensorRT engine at
``s3://my-bucket/lprnet/fp16.engine`` using ``infer-spec.yaml``. Run on
your chosen backend.
The decoded predictions are printed to STDOUT.