### Setup for TIDL Tools Source: https://github.com/texasinstruments/edgeai-tidl-tools/blob/master/examples/osrt_cpp/README.md Details the prerequisites and setup steps required before building and running the TIDL C++ examples. This includes installing the libyaml-cpp-dev library and preparing the environment by following instructions in the main README. ```bash sudo apt-get install libyaml-cpp-dev ``` -------------------------------- ### Advanced Setup: Skipping C++ Dependencies Source: https://github.com/texasinstruments/edgeai-tidl-tools/blob/master/docs/advanced_setup.md Invokes the setup script with an option to validate only Python examples and skip the execution of C++ examples. ```bash source ./setup.sh --skip_cpp_deps ``` -------------------------------- ### Advanced Setup Options Source: https://github.com/texasinstruments/edgeai-tidl-tools/blob/master/README.md Details setup options for advanced users aiming to optimize their setup time. This guide is for users who need to fine-tune their environment. ```markdown [**Advanced Setup Options**](docs/advanced_setup.md#advanced-setup-options) - Setup options for advanced users to optimize setup time ``` -------------------------------- ### Setup TIDL Tools Environment Source: https://github.com/texasinstruments/edgeai-tidl-tools/blob/master/examples/jupyter_notebooks/colab/ti_edgeai_tidl_tools_am62a.ipynb Sets the System-on-Chip (SOC) to 'am62a' and sources the setup script for the TIDL tools. It skips downloading ARM GCC and C++ dependencies. ```shell !export SOC=am62a && cd edgeai-tidl-tools && source ./setup.sh --skip_arm_gcc_download --skip_cpp_deps ``` -------------------------------- ### Build CPP Examples with CMake Source: https://github.com/texasinstruments/edgeai-tidl-tools/blob/master/examples/osrt_cpp/README.md Instructions for building C++ examples using CMake. It details creating a build directory, using CMake flags for different compilation modes and target devices, and specifying installation paths for dependencies. ```bash mkdir build && cd build cmake -DFLAG1=val -DFLAG2=val ../examples make -j2 cd ../ ``` ```bash cmake -DTARGET_DEVICE=am62 TARGET_CPU=arm ../examples make -j2 cd ../ ``` ```bash cmake -DTARGET_DEVICE=am62 -DARMNN_ENABLE=1../examples ``` ```bash cmake -DTARGET_DEVICE=am62 TARGET_CPU=arm -DARMNN_ENABLE=1../examples ``` ```bash cd /usr/lib ln -s libonnxruntime.so.1.7.0 libonnxruntime.so ``` -------------------------------- ### Setup EdgeAI TIDL Tools Environment Source: https://github.com/texasinstruments/edgeai-tidl-tools/blob/master/examples/jupyter_notebooks/colab/ti_edgeai_tidl_tools_am68a.ipynb Sets the SOC environment variable and sources the setup script for the EdgeAI TIDL Tools. It also skips downloading ARM GCC and C++ dependencies. ```bash !export SOC=am68a && cd edgeai-tidl-tools && source ./setup.sh --skip_arm_gcc_download --skip_cpp_deps ``` -------------------------------- ### Setup EdgeAI TIDL Tools Environment Source: https://github.com/texasinstruments/edgeai-tidl-tools/blob/master/examples/jupyter_notebooks/colab/ti_edgeai_tidl_tools_am69a.ipynb Sets the System-on-Chip (SOC) to 'am69a' and sources the setup script for the EdgeAI TIDL Tools. It skips downloading ARM GCC and C++ dependencies. ```shell !export SOC=am69a && cd edgeai-tidl-tools && source ./setup.sh --skip_arm_gcc_download --skip_cpp_deps ``` -------------------------------- ### Download Model and Data, Setup Environment Source: https://github.com/texasinstruments/edgeai-tidl-tools/blob/master/examples/jupyter_notebooks/colab/infer_tflite.ipynb Downloads the EfficientNet-Lite0 TFLite model and a sample image (jet.jpeg). It also renames the downloaded model file and installs the required tflite_runtime library. ```python !wget https://akm-img-a-in.tosshub.com/indiatoday/images/story/201804/jet.jpeg !wget https://tfhub.dev/tensorflow/lite-model/efficientnet/lite0/fp32/2?lite-format=tflite !mv /content/2?lite-format=tflite efficientnet-lit0.tflite !pip3 install tflite_runtime==2.8.0 ``` -------------------------------- ### Setup TIDL ONNX Model Optimizer Source: https://github.com/texasinstruments/edgeai-tidl-tools/blob/master/osrt-model-tools/osrt_model_tools/onnx_tools/tidl_onnx_model_optimizer/README.md Sets up the TIDL ONNX Model Optimizer by navigating to the 'onnx_tools' directory and sourcing the 'setup.sh' script. This installs the 'tidl_onnx_model_optimizer' Python package. ```shell cd ../onnx_tools source ./setup.sh ``` -------------------------------- ### Clone EdgeAI TIDL Tools Repository Source: https://github.com/texasinstruments/edgeai-tidl-tools/blob/master/examples/jupyter_notebooks/colab/ti_edgeai_tidl_tools_am68a.ipynb Clones the specified branch of the EdgeAI TIDL Tools repository from GitHub. This is the initial step to get the necessary tools and examples. ```bash !git clone --single-branch --depth 1 --branch master https://github.com/TexasInstruments/edgeai-tidl-tools.git ``` -------------------------------- ### Install Dependencies and Download Model/Data Source: https://github.com/texasinstruments/edgeai-tidl-tools/blob/master/examples/jupyter_notebooks/colab/infer_ort.ipynb Installs the onnxruntime library and downloads the SqueezeNet ONNX model and a sample image (jet.jpeg). It also renames the downloaded model file. ```python !pip install onnxruntime !wget https://akm-img-a-in.tosshub.com/indiatoday/images/story/201804/jet.jpeg !wget https://github.com/onnx/models/blob/1008b6e9450ab632538390e38e0ab28b3f207fbc/vision/classification/squeezenet/model/squeezenet1.1-7.onnx?raw=true !mv squeezenet1.1-7.onnx?raw=true squeezenet1.1-7.onnx ``` -------------------------------- ### Setup TIDL ONNX Model Utilities Source: https://github.com/texasinstruments/edgeai-tidl-tools/blob/master/osrt-model-tools/osrt_model_tools/onnx_tools/tidl_onnx_model_utils/README.md Installs the tidl_onnx_model_utils Python package by navigating to the onnx_tools directory and sourcing the setup script. This process depends on the onnx-graphsurgeon library. ```bash cd ../onnx_tools source ./setup.sh ``` -------------------------------- ### Docker One-Time Setup Script Source: https://github.com/texasinstruments/edgeai-tidl-tools/blob/master/docs/advanced_setup.md Executes the one-time setup script for Docker, which prepares the environment for building and running Docker images. ```bash source ./scripts/docker/setup_docker.sh ``` -------------------------------- ### Post-Container Run Setup Source: https://github.com/texasinstruments/edgeai-tidl-tools/blob/master/docs/advanced_setup.md Configures the environment within the running Docker container by exporting SOC and TIDL_TOOLS_TYPE, and then sourcing the setup script. This needs to be done every time the container is re-run. ```bash export SOC= export TIDL_TOOLS_TYPE= source ./setup.sh ``` -------------------------------- ### Setup TIDL Tools Environment for AM68PA Source: https://github.com/texasinstruments/edgeai-tidl-tools/blob/master/examples/jupyter_notebooks/colab/ti_edgeai_tidl_tools_tda4vm.ipynb Sets the System-on-Chip (SOC) to 'am68pa' and sources the setup script for the TIDL tools. This configures the necessary environment variables and dependencies for running TIDL on the specified hardware, skipping ARM GCC download and C++ dependencies. ```shell !export SOC=am68pa && cd edgeai-tidl-tools && source ./setup.sh --skip_arm_gcc_download --skip_cpp_deps ``` -------------------------------- ### Build TIDLRT CPP Examples Source: https://github.com/texasinstruments/edgeai-tidl-tools/blob/master/examples/tidlrt_cpp/advanced_examples/README.md Builds the C++ examples for TIDLRT using CMake. This process involves creating a build directory, configuring the build with CMake, and then compiling the project using make. ```bash mkdir build && cd build cmake ../examples/ make -j2 cd ../ ``` -------------------------------- ### Advanced Setup: Using Existing ARM GCC Toolchain Source: https://github.com/texasinstruments/edgeai-tidl-tools/blob/master/docs/advanced_setup.md Configures the setup script to use an existing ARM GCC toolchain by setting the ARM64_GCC_PATH environment variable and using the --skip_arm_gcc_download option. ```bash export ARM64_GCC_PATH=$(pwd)/arm-gnu-toolchain-13.2.Rel1-x86_64-aarch64-none-linux-gnu source ./setup.sh --skip_arm_gcc_download ``` -------------------------------- ### Build CPP Advanced Examples Source: https://github.com/texasinstruments/edgeai-tidl-tools/blob/master/examples/osrt_cpp/advanced_examples/README.md Builds the C++ advanced examples using CMake. This involves creating a build directory, configuring the build with CMake, and then compiling the project. ```bash mkdir build && cd build cmake ../examples/ make cd ../ ``` -------------------------------- ### Run TFLite Delegate Example (with compilation) Source: https://github.com/texasinstruments/edgeai-tidl-tools/blob/master/examples/jupyter_notebooks/colab/ti_edgeai_tidl_tools_am68a.ipynb Executes a TFLite delegate example using Python. It sets environment variables for the SOC, library path, and TIDL tools path, then runs the `tflrt_delegate.py` script with a specific model, including compilation. ```bash !export SOC=am68a && \ export LD_LIBRARY_PATH=/content/edgeai-tidl-tools/tidl_tools && \ export TIDL_TOOLS_PATH=/content/edgeai-tidl-tools/tidl_tools && \ cd ./edgeai-tidl-tools/examples/osrt_python/tfl && \ python3 tflrt_delegate.py -c -m cl-tfl-mobilenet_v1_1.0_224 ``` -------------------------------- ### Build TIDLRT CPP Examples Source: https://github.com/texasinstruments/edgeai-tidl-tools/blob/master/examples/tidlrt_cpp/README.md Instructions to build the C++ examples for TIDLRT using CMake. This involves creating a build directory, configuring the build with CMake, and then compiling the project with make. ```bash mkdir build && cd build cmake ../examples/ make cd ../ ``` -------------------------------- ### Setup Environment Source: https://github.com/texasinstruments/edgeai-tidl-tools/blob/master/osrt-model-tools/osrt_model_tools/onnx_tools/README.md Executes the setup script to configure the environment for using the ONNX tools. This is a prerequisite for running the optimization and utility packages. ```bash source ./setup.sh ``` -------------------------------- ### Run TIDL CPP Inference Examples Source: https://github.com/texasinstruments/edgeai-tidl-tools/blob/master/examples/osrt_cpp/README.md Commands to execute pre-compiled C++ inference examples for various models (ResNet18, MobileNet, InceptionNet, SSD-Lite, DeepLabV3) using different runtimes (ORT, TFL, DLR). ```bash ./bin/Release/ort_main -f model-artifacts/cl-ort-resnet18-v1/artifacts -i test_data/airshow.jpg ``` ```bash ./bin/Release/tfl_main -f model-artifacts/cl-tfl-mobilenet_v1_1.0_224/artifacts -i test_data/airshow.jpg ``` ```bash ./bin/Release/dlr_main -f model-artifacts/cl-dlr-tflite_inceptionnetv3/artifacts -i test_data/airshow.jpg ``` ```bash ./bin/Release/dlr_main -f model-artifacts/cl-dlr-onnx_mobilenetv2/artifacts -i test_data/airshow.jpg ``` ```bash ./bin/Release/ort_main -f model-artifacts/od-ort-ssd-lite_mobilenetv2_fpn/artifacts -i test_data/ADE_val_00001801.jpg ``` ```bash ./bin/Release/tfl_main -f model-artifacts/od-tfl-ssd_mobilenet_v2_300_float/artifacts -i test_data/ADE_val_00001801.jpg ``` ```bash ./bin/Release/tfl_main -f model-artifacts/ss-tfl-deeplabv3_mnv2_ade20k_float/artifacts -i test_data/ADE_val_00001801.jpg ``` -------------------------------- ### Run CPP Advanced Examples Source: https://github.com/texasinstruments/edgeai-tidl-tools/blob/master/examples/osrt_cpp/advanced_examples/README.md Executes the C++ advanced applications. The examples demonstrate priority scheduling for multiple models, with options to specify model paths, priorities, threads, offloading to a device, and preempt delays. ```bash ./bin/Release/tfl_priority_scheduling -h ./bin/Release/ort_main_adv -h ``` ```bash ./bin/Release/tfl_priority_scheduling -i test_data/ADE_val_00001801.jpg test_data/airshow.jpg -m model-artifacts/ss-tfl-deeplabv3_mnv2_ade20k_float/artifacts/ model-artifacts/cl-tfl-mobilenet_v1_1.0_224/artifacts/ -p 1 0 -t 1 -a 1 -d 1 -e 3 ``` -------------------------------- ### Run TFLite Delegate Example (with compilation) Source: https://github.com/texasinstruments/edgeai-tidl-tools/blob/master/examples/jupyter_notebooks/colab/ti_edgeai_tidl_tools_am62a.ipynb Executes a TFLite delegate example using Python. It sets environment variables for library paths and the TIDL tools path, then runs the 'tflrt_delegate.py' script with a specific model ('cl-tfl-mobilenet_v1_1.0_224') and compilation flag. ```shell !export SOC=am62a && \ export LD_LIBRARY_PATH=/content/edgeai-tidl-tools/tidl_tools && \ export TIDL_TOOLS_PATH=/content/edgeai-tidl-tools/tidl_tools && \ cd ./edgeai-tidl-tools/examples/osrt_python/tfl && \ python3 tflrt_delegate.py -c -m cl-tfl-mobilenet_v1_1.0_224 ``` -------------------------------- ### Cloning and Checking Out Repository Source: https://github.com/texasinstruments/edgeai-tidl-tools/blob/master/docs/advanced_setup.md Steps to clone the edgeai-tidl-tools GitHub repository and checkout a specific tag compatible with the SDK version. ```bash git clone https://github.com/TexasInstruments/edgeai-tidl-tools.git cd edgeai-tidl-tools git checkout ``` -------------------------------- ### Running the Docker Image Source: https://github.com/texasinstruments/edgeai-tidl-tools/blob/master/docs/advanced_setup.md Launches the Docker container for the edgeai-tidl-tools project. ```bash source ./scripts/docker/run_docker.sh ``` -------------------------------- ### Troubleshooting GPU Docker Setup: Restarting Docker Source: https://github.com/texasinstruments/edgeai-tidl-tools/blob/master/docs/advanced_setup.md Restarts the Docker service after installing the nvidia-container-toolkit to ensure GPU detection works correctly. ```bash sudo systemctl restart docker ``` -------------------------------- ### Install Requirements Source: https://github.com/texasinstruments/edgeai-tidl-tools/blob/master/examples/osrt_python/advanced_examples/unit_tests_validation/README.md Installs necessary Python packages for the unit test validation scripts using a requirements file. ```bash cd examples/osrt_python/advanced_examples/unit_tests_validation pip3 install -r ./requirements.txt ``` -------------------------------- ### Prepare Configuration Files Source: https://github.com/texasinstruments/edgeai-tidl-tools/blob/master/examples/jupyter_notebooks/colab/tidlrt_tools.ipynb Appends configuration settings to a config file and creates a list of input data for quantization/calibration. The configuration specifies the path to the device configuration file and the input data list points to the image and its expected output index. ```python !echo "perfSimConfig = /content/tidl_tools/device_config.cfg" >> /content/resnet18/config !echo "/content/resnet18/jet.jpeg 895" >> /content/resnet18/in_data_list.txt ``` -------------------------------- ### Example Quantization Proto File Source: https://github.com/texasinstruments/edgeai-tidl-tools/blob/master/docs/tidl_quantParams.md An example of a valid prototxt file for a dummy model with two layers, demonstrating the structure and required fields for bypassing TIDL's calibration step. ```text num_layers: 2 quant_type: SYMMETRIC calib_type: PERTENSOR layers { layer_name: "data" layer_type: "TIDL_DataLayer" bit_depth: 1 outputs { min: 0 max: 255 size: 1 element_type: 0 scale: 1 zero_point: 0 } } layers { layer_name: "conv1a" layer_type: "TIDL_ConvolutionLayer" bit_depth: 1 outputs { min: 0 max: 4.09663105 size: 1 element_type: 0 scale: 56.387794494628906 zero_point: 0 } weights { min: -0.00830631796 max: 0.00886716694 size: 1 element_type: 0 scale: 14435.275390625 zero_point: 0 } bias { min: -0.52766174077987671 max: 0.53365200757980347 size: 3 element_type: 0 scale: 120.27982330322266 zero_point: 0 value: 0.28929620981216431 value: -0.52766174077987671 value: 0.53365200757980347 } } ``` -------------------------------- ### Deploy Model Artifacts to EVM Source: https://github.com/texasinstruments/edgeai-tidl-tools/blob/master/examples/osrt_cpp/README.md This snippet outlines the necessary folders to copy from the host PC to the EVM (Embedded Linux Development Board) for running the model examples on the target hardware. ```shell ./model-artifacts ./models ``` -------------------------------- ### Building the Docker Image Source: https://github.com/texasinstruments/edgeai-tidl-tools/blob/master/docs/advanced_setup.md Builds the Docker image for the edgeai-tidl-tools project. Requires setting the repository location and proxy environment variables before execution. ```bash export REPO_LOCATION=artifactory.itg.ti.com/docker-public/library/ export PROXY=http://webproxy.ext.ti.com:80 source ./scripts/docker/build_docker.sh ``` -------------------------------- ### Build utils_adv Library and Install Source: https://github.com/texasinstruments/edgeai-tidl-tools/blob/master/examples/osrt_cpp/advanced_examples/utils/CMakeLists.txt This snippet defines the build process for the 'utils_adv' library, which includes source files for argument parsing and print utilities. It also specifies the installation targets for the library and its header files. ```cmake cmake_minimum_required(VERSION 3.0.2) include(${CMAKE_CURRENT_SOURCE_DIR}/../../../cmake/common.cmake) add_library(utils_adv ${CMAKE_CURRENT_SOURCE_DIR}/src/arg_parsing.cpp ${CMAKE_CURRENT_SOURCE_DIR}/include/arg_parsing.h ${CMAKE_CURRENT_SOURCE_DIR}/src/print_utils.cpp ${CMAKE_CURRENT_SOURCE_DIR}/include/print_utils.h ) install(TARGETS utils_adv DESTINATION lib) install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/include/arg_parsing.h ${CMAKE_CURRENT_SOURCE_DIR}/include/print_utils.h DESTINATION include) ``` -------------------------------- ### TIDL Required Options Source: https://github.com/texasinstruments/edgeai-tidl-tools/blob/master/examples/osrt_python/README.md These options must be specified by the user when creating inference sessions for respective runtimes. They are crucial for model compilation and inference setup. ```APIDOC tidl_tools_path: Description: Path to TIDL tools for model compilation. Populated using ${TIDL_TOOLS_PATH} environment variable. Option Type: Model compilation Default: Not specified (must be provided by user) artifacts_folder: Description: Path to the folder where model artifacts are saved or to be saved. Option Type: Model compilation / Model inference Default: Not specified (must be provided by user) ``` -------------------------------- ### Python API and Examples Source: https://github.com/texasinstruments/edgeai-tidl-tools/blob/master/README.md Provides detailed documentation for all compile and inference options for TIDL offload for each runtime session using Python. This guide is essential for users working with Python-based workflows. ```markdown [**Python API and examples**](examples/osrt_python/README.md) - Detailed documentation on all the compile and inference options for TIDL offload for each runtime sessions ``` -------------------------------- ### Initial Setup and Environment Configuration Source: https://github.com/texasinstruments/edgeai-tidl-tools/blob/master/README.md Clones the TIDL tools repository, checks out a compatible tag, sets the SOC environment variable, and sources the setup script to configure the environment. The 'source' command is crucial for exporting environment variables. ```bash git clone https://github.com/TexasInstruments/edgeai-tidl-tools.git cd edgeai-tidl-tools git checkout # Supported SOC name strings am62, am62a, (am68a or j721s2), (am68pa or j721e), (am69a or j784s4), (am67a or j722s) export SOC= source ./setup.sh ``` -------------------------------- ### TIDL Multi-DSP Inference Options Source: https://github.com/texasinstruments/edgeai-tidl-tools/blob/master/examples/osrt_python/README.md Configuration options for devices with multiple DSP cores, affecting inference mode, core utilization, and execution start points. These options are crucial for optimizing performance on multi-core architectures. ```APIDOC advanced_options:inference_mode Description: Specifies the feature/mode for inference. Must be set during compilation and affects generated artifacts. Supported values: 0 (TIDL_inferenceModeDefault): Default inference mode. 1 (TIDL_inferenceModeHighThroughput): High throughput inference mode. 2 (TIDL_inferenceModeLowLatency): Low latency inference mode. Default value: 0 Option Type: Model compilation Additional details: Refer [Multi-DSP inference](../../docs/tidl_fsg_multi_c7x.md) for more details. advanced_options:num_cores Description: Specifies the number of DSP cores to be used for inference. Supported values/range: Min: 1, Max: maximum number of DSP cores available on the device. Default value: 1 Option Type: Model compilation Additional details: Refer [Multi-DSP inference](../../docs/tidl_fsg_multi_c7x.md) for more details. core_number Description: Specifies the index of the core out of all available C7x cores to be used for single-core inference. This option is 1-indexed. For example, core_number = 1 for C7x_1. Supported values/range: Min: 1, Max: maximum number of DSP cores available on the device. Default value: 1 Option Type: Model inference Additional details: Refer [Multi-DSP inference](../../docs/tidl_fsg_multi_c7x.md) for more details. core_start_idx Description: Specifies the index of the core from which to start processing. In case of inference_mode = 1 or 2, execution would happen on C7x_{core_start_idx} to C7x_{core_start_idx + advanced_options:num_cores}. Supported values/range: Min: 1, Max: maximum number of DSP cores available on the device. Default value: 1 Option Type: Model inference Additional details: Refer [Multi-DSP inference](../../docs/tidl_fsg_multi_c7x.md) for more details. ``` -------------------------------- ### Basic CMake Project Setup Source: https://github.com/texasinstruments/edgeai-tidl-tools/blob/master/examples/osrt_cpp/dlr/CMakeLists.txt This snippet demonstrates the fundamental CMake commands to initialize a project. It sets the minimum required CMake version, defines the project name, and includes common build scripts from a specified directory. It then defines the source files for the application and initiates the build process. ```cmake cmake_minimum_required(VERSION 3.0.2) set(PROJ_NAME dlr_main) project(${PROJ_NAME}) include(${CMAKE_CURRENT_SOURCE_DIR}/../../cmake/common.cmake) set(DLR_CLS_APP_SRCS dlr_main.cpp) build_app(${PROJ_NAME} DLR_CLS_APP_SRCS) ``` -------------------------------- ### Enable ARM Only Mode for Model Compilation Source: https://github.com/texasinstruments/edgeai-tidl-tools/blob/master/docs/tidl_osr_debug.md This snippet demonstrates how to enable ARM-only mode for model compilation, which is useful for verifying script functionality without C7x offload. It shows the command for out-of-the-box ONNX examples and advises referring to custom model documentation for enabling this mode. ```python python3 onnxrt_ep.py -d ``` -------------------------------- ### Get All Node Names from ONNX Model Source: https://github.com/texasinstruments/edgeai-tidl-tools/blob/master/osrt-model-tools/osrt_model_tools/onnx_tools/tidl_onnx_model_utils/README.md Retrieves a comma-separated string of all node names within an ONNX model, between specified start and end layers (inclusive). If the end node is 'None', model output nodes are assumed. Handles cases where specified end nodes are not found. ```python from tidl_onnx_model_utils import get_all_node_names # Example usage: model_path = "path/to/your/model.onnx" start_end_layers = { '/bbox_head/Sigmoid' : ['/Cast_3', '/GatherElements_1'], '/bbox_head/offset_head/offset_head.0/Conv' : None, '/Div_2' : ['/Mul_5'] } deny_list = get_all_node_names(model_path, start_end_layers) print(deny_list) ``` -------------------------------- ### Deploy and Run Inference on EVM Board Source: https://github.com/texasinstruments/edgeai-tidl-tools/blob/master/examples/jupyter_notebooks/colab/tidlrt_tools.ipynb Provides instructions for deploying the generated model artifacts to an EVM board and running inference. It includes commands to navigate to the vision_apps directory, source initialization scripts, change directory, set the LD_LIBRARY_PATH, prepare input data, and execute the inference using the device-specific algorithm test tool. ```bash root@ j7-evm:~# cd /opt/vision_apps root@ j7-evm:~# source ./vision_apps_init.sh root@ j7-evm:~# cd /opt/tidl_test root@ j7-evm:/opt/tidl_test# export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib root@ j7-evm:~# echo "/opt/resnet18/jet.jpeg 895" > /opt/resnet18/in_data_list.txt root@ j7-evm:/opt/tidl_test# ./TI_DEVICE_a72_test_dl_algo_host_rt.out s:/opt/resnet18/config \ --netBinFile /opt/resnet18/tidl_net.bin \ --ioConfigFile /opt/resnet18/tidl_io_buff1.bin \ --inData /opt/resnet18/in_data_list.txt --inFileFormat 2 \ --outData /opt/resnet18/jet_tidl_out.bin --postProcType 1 ``` -------------------------------- ### Run TIDLRT CPP Classification Example Source: https://github.com/texasinstruments/edgeai-tidl-tools/blob/master/examples/tidlrt_cpp/README.md Example command to run the TIDLRT C++ classification example. This command specifies the label file, input image, model artifacts directory, and a debug level. ```bash ./bin/Release/tidlrt_clasification -l test_data/labels.txt -i test_data/airshow.jpg -f model-artifacts/cl-tfl-mobilenet_v1_1.0_224/artifacts/ -d 1 ``` -------------------------------- ### Run TIDLRT CPP Examples Source: https://github.com/texasinstruments/edgeai-tidl-tools/blob/master/examples/tidlrt_cpp/advanced_examples/README.md Executes the compiled TIDLRT C++ application. The example demonstrates priority scheduling and allows for disabling result analysis and specifying test duration. ```bash ./bin/Release/tidlrt_priority_scheduling ``` ```bash ./bin/Release/tidlrt_priority_scheduling -r 1 -t 1 ``` -------------------------------- ### Download and Run Pre-compiled Model Source: https://github.com/texasinstruments/edgeai-tidl-tools/blob/master/examples/osrt_cpp/README.md This snippet demonstrates the steps to download a pre-compiled model from the model zoo, prepare its directory, untar the archive, and execute the model using the tfl_main executable with specified input and configuration parameters. ```bash wget http://software-dl.ti.com/jacinto7/esd/modelzoo/08_00_00_05/modelartifacts/8bits/cl-0000_tflitert_mlperf_mobilenet_v1_1.0_224_tflite.tar.gz mkdir cl-0000_tflitert_mlperf_mobilenet_v1_1.0_224_tflite mv cl-0000_tflitert_mlperf_mobilenet_v1_1.0_224_tflite.tar.gz cl-0000_tflitert_mlperf_mobilenet_v1_1.0_224_tflite cd cl-0000_tflitert_mlperf_mobilenet_v1_1.0_224_tflite tar -xvf cl-0000_tflitert_mlperf_mobilenet_v1_1.0_224_tflite cd ../ ./bin/Release/tfl_main -z "cl-0000_tflitert_mlperf_mobilenet_v1_1.0_224_tflite/" -v 1 -i "test_data/airshow.jpg" -l "test_data/labels.txt" -a 1 -d 1 ``` -------------------------------- ### Download and Run Pre-compiled Model from Model Zoo Source: https://github.com/texasinstruments/edgeai-tidl-tools/blob/master/examples/osrt_cpp/advanced_examples/README.md Demonstrates how to download a pre-compiled model from the model zoo, extract it, and prepare it for execution. This involves using wget to download the tarball, creating a directory, moving the file, and then untarring its contents. ```bash wget http://software-dl.ti.com/jacinto7/esd/modelzoo/08_00_00_05/modelartifacts/8bits/cl-0000_tflitert_mlperf_mobilenet_v1_1.0_224_tflite.tar.gz mkdir cl-0000_tflitert_mlperf_mobilenet_v1_1.0_224_tflite mv cl-0000_tflitert_mlperf_mobilenet_v1_1.0_224_tflite.tar.gz cl-0000_tflitert_mlperf_mobilenet_v1_1.0_224_tflite cd cl-0000_tflitert_mlperf_mobilenet_v1_1.0_224_tflite tar -xvf cl-0000_tflitert_mlperf_mobilenet_v1_1.0_224_tflite ``` -------------------------------- ### CMake Project Setup and Processor Detection Source: https://github.com/texasinstruments/edgeai-tidl-tools/blob/master/examples/CMakeLists.txt This snippet shows the initial CMake setup, including minimum version, project naming, and the logic for detecting the host processor (x86 or ARM). It also handles the critical step of checking for and setting the target device (SOC) and target CPU, with error handling for missing environment variables. ```cmake cmake_minimum_required(VERSION 3.0.2) project(edgeai_tidl_examples) exec_program(pkg-config ARGS --cflags glib-2.0 OUTPUT_VARIABLE GLIB_FLAGS) set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GLIB_FLAGS}") if(NOT DEFINED CMAKE_SYSTEM_PROCESSOR OR CMAKE_SYSTEM_PROCESSOR STREQUAL "") message(WARNING "CMAKE_SYSTEM_PROCESSOR is not defined. Perhaps CMake toolchain is broken") endif() message(STATUS "Detected processor: ${CMAKE_SYSTEM_PROCESSOR}") if(CMAKE_SYSTEM_PROCESSOR MATCHES "amd64.*|x86_64.*|AMD64.*") set(HOST_CPU x86) if(NOT DEFINED ENV{SOC} OR ENV{SOC} STREQUAL "" ) message(FATAL_ERROR "SOC not specicfied, please export SOC variable") else() set(TARGET_DEVICE $ENV{SOC}) message(STATUS "TARGET_DEVICE setting to: ${TARGET_DEVICE}") endif() if(NOT DEFINED TARGET_DEVICE) message(FATAL_ERROR "SOC not specicfied, please export SOC variable") endif() if(NOT DEFINED TARGET_CPU) set(TARGET_CPU x86) message(STATUS "TARGET_CPU not specicfied using ${TARGET_CPU} ") endif() elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch64.*|AARCH64.*|arm64.*|ARM64.*)") set(HOST_CPU arm) if(NOT DEFINED ENV{SOC} OR ENV{SOC} STREQUAL "" ) message(FATAL_ERROR "SOC not specicfied, please export SOC variable") else() set(TARGET_DEVICE $ENV{SOC}) message(STATUS "TARGET_DEVICE setting to: ${TARGET_DEVICE}") endif() if(NOT DEFINED TARGET_DEVICE) message(FATAL_ERROR "SOC not specicfied, please export SOC variable") endif() if(NOT DEFINED TARGET_CPU) set(TARGET_CPU arm) message(STATUS "TARGET_CPU not specicfied using ${TARGET_CPU} ") endif() endif() ```