In step one, LEIP Recipes were used to export a pre-trained, traced model. The second step of the recipe compiles and compresses this model in the same Docker container to produce the binary artifact for the model optimized to the architecture of your target device. You will then be able to copy this artifact and the associated files to the target device for evaluation.

Step two of the recipe uses the LEIP Pipeline command with a predefined build configuration provided in /latentai/recipes to ensure the best compilation results:

export PYTHONPATH=/latentai/recipes/yolov5_L_RT/evaluation/utils:$PYTHONPATH
leip pipeline \
   --input_path /latentai/artifacts/ \
   --config_path /latentai/recipes/yolov5_L_RT/pipeline.json

This pipeline will provide two flavors of the binary artifact:

  • A Float32 version at: /latentai/pipeline_output/Float32/01-compile/.

  • An Int8 version at: /latentai/pipeline_output/Int8/01-optimize/.

Preparing the model files

Now that you have generated the model artifacts, you will need to copy them out of the Docker container in order to run the model on the target. There are several files and directories that you will need to copy over. A script has been provided to facilitate copying these files into a tar archive file:

In the Docker container:

# Gather the model artifacts to copy to the target
cd /latentai/recipes/yolov5_L_RT
sh ./

# An archive will be created at: /latentai/recipes/yolov5_L_RT/agx-artifacts.tar.gz

Copying the dependency and model files

Before you can evaluate the model on the target device, you need to retrieve two archive files that will be copied to the AGX target. The first archive is a set of dependencies that you will need to install on the AGX the first time that you configure the target for testing:

Note: All the examples on this page assume you have named your running SDK Docker container leip. If you have used another name, please change this in the Docker commands.

# Run this command on the host machine to copy the dependency file from the container
# You will later copy this file to the AGX target

docker cp leip:/agx-install.tar.gz .

Next, copy the model files that you prepared above with the script. You will need to repeat this step each time you have generated new model files:

# Copy the model artifacts from the docker container to the host

docker cp leip:/latentai/recipes/yolov5_L_RT/agx-artifacts.tar.gz .

Next, you will evaluate your optimized model on the target device.