Git Product home page Git Product logo

edgeai-tidl-tools's Introduction

TIDL - TI Deep Learning Product

TIDL is a comprehensive software product for acceleration of Deep Neural Networks (DNNs) on TI's embedded devices. It supports heterogeneous execution of DNNs across cortex-A based MPUs, TI’s latest generation C7x DSP and TI's DNN accelerator (MMA). TIDL is released as part of TI's Software Development Kit (SDK) along with additional computer vision functions and optimized libraries including OpenCV. TIDL is available on a variety of embedded devices from Texas Instruments.

TIDL is a fundamental software component of TI’s Edge AI solution. TI's Edge AI solution simplifies the whole product life cycle of DNN development and deployment by providing a rich set of tools and optimized libraries. DNN based product development requires two main streams of expertise:

  • Data Scientists, who can design and train DNNs for targeted applications
  • Embedded System Engineers, who can design and develop inference solutions for real time execution of DNNs on low power embedded device

TI's Edge AI solution provides the right set of tools for both of these categories:

  • Edge AI Studio: Integrated development environment for development of AI applications for edge processors, hosting tools like Model Composer to train, compile and deploy models with click of mouse button and Model Analyzer to let you evaluate and analyze deep learning model performance on TI devices from your browser in minutes
  • Model zoo: A large collection of pre-trained models for data scientists, which along with TI's Model Selection Tool enables picking the ideal model for TI's embedded devices
  • Training and quantization tools for popular frameworks, allowing data scientists to make DNNs more suitable for TI devices
  • Edge AI Benchmark: A python based framework which can allow you to perform accuracy and performance benchmark. Accuracy benchmark can be performed without development board, but for performance benchmark, a development board is needed.
  • Edge AI TIDL Tools: Edge AI TIDL Tools provided in this repository shall be used for model compilation on X86. Artifacts from compilation process can used for Model inference. Model inference can happen on X86 machine (host emulation mode) or on development board with TI SOC. This repository also provides examples to be directly used on X86 target and can be used on development board with TI SOC. For deployment and execution on the development board, one has to use this package.

The figure below illustrates the work flow of DNN development and deployment on TI devices:

TI EdgeAI Work Flow

EdgeAI TIDL Tools

Introduction

TIDL provides multiple deployment options with industry defined inference engines as listed below. These inference engines are being referred as Open Source Runtimes (OSRT) in this document.

  • TFLite Runtime: TensorFlow Lite based inference with heterogeneous execution on cortex-A** + C7x-MMA, using TFlite Delegates TFLite Delgate API
  • ONNX RunTime: ONNX Runtime based inference with heterogeneous execution on cortex-A** + C7x-MMA.
  • TVM/Neo-AI RunTime: TVM/Neo-AI-DLR based inference with heterogeneous execution on cortex-A** + C7x-MMA

** AM68PA has cortex-A72 as its MPU, refer to the device TRM to know which cortex-A MPU it contains.

These heterogeneous execution enables:

  1. OSRT as the top level inference for user applications
  2. Offloading subgraphs to C7x/MMA for accelerated execution with TIDL
  3. Runs optimized code on ARM core for layers that are not supported by TIDL

Edge AI TIDL Tools provided in this repository supports model compilation and model inference. The diagram below illustrates the TFLite based work flow as an example. ONNX Runtime and TVM/Neo-AI Runtime also follows similar work flow.

The below table covers the supported operations with this repository on X86_PC and TI's development board.

Operation X86_PC TI SOC Python API CPP API
Model Compilation ✔️ ✔️
Model Inference ✔️ ✔️ ✔️ ✔️

What IS Supported

  • Benchmark latency and Memory bandwidth of out of box example models (10+)
  • Compile user / custom model for deployment with TIDL
  • Inference of compiled models on X86_PC or TI SOC using file base input and output

What IS NOT Supported

  • Camera , Display and DL runtime based end-to-end pipeline development or benchmarking.
  • Benchmarking accuracy of models using TIDL acceleration with standard datasets, for e.g. - accuracy benchmarking using MS COCO dataset for object detection models.

Supported Devices

  • Following table shows the devices supported by this repository
  • Device with hardware acceleration have TI-DSP and MMA(Matrix Multiplier Accelerator) for faster execution.
Device Family(Product) Environment Variable Hardware Acceleration
AM62 am62
AM62A am62a ✔️
AM67A am67a ✔️
AM68PA am68pa ✔️
AM68A am68a ✔️
AM69A am69a ✔️
J721E (TDA4VM) am68pa ✔️
J721S2 (TDA4AL, TDA4VL) am68a ✔️
J722S am67a ✔️
J784S4 (TDA4AP, TDA4VP,
TDA4AH, TDA4VH)
am69a ✔️

Setup

Note Please select / checkout to the tag compatible with the SDK version that you are using with the TI's Evaluation board before continuing on the below steps. Refer to SDK Version compatibility Table for the tag of your SDK version

Pre-requisites to setup on x86_PC

  • X86_PC mode for this repository is validated with below configuration:
OS Python Version
Ubuntu 22.04 3.10
  • We recommend Docker based setup to avoid dependency issues

  • Tools built with GPU acceleration need to be run inside the appropriate Docker container. Refer to relevant steps to build and run the container

Setup on X86_PC

  • Run below one time setup for system level packages. This needs sudo permission, get it installed by your system administrator if required.
  sudo apt-get install libyaml-cpp-dev
  • Make sure you have all permission for the current directory before proceeding
  • Run the below commands to install the dependent components on your machine and set all the required environments

Note source in the setup command is important as this script is exporting all required environment variables. Without this, user may encounter some compilation/runtime issues

git clone https://github.com/TexasInstruments/edgeai-tidl-tools.git
cd edgeai-tidl-tools
git checkout <TAG Compatible with your SDK version>
# Supported SOC name strings am62, am62a, am68a, am68pa, am69a, am67a
export SOC=<Your SOC name>
source ./setup.sh
  • While opening new terminal in a system where above setup is already done once for a given SDK version, set below environment variables
cd edgeai-tidl-tools
export SOC=<Your SOC name>
export TIDL_TOOLS_PATH=$(pwd)/tidl_tools
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$TIDL_TOOLS_PATH
export ARM64_GCC_PATH=$(pwd)/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu

Validate and Benchmark out-of-box examples

  • We provide 10+ out-of-box examples for model compilation on X86_PC and Inference on X86_PC and TI SOC in the below category of tasks. Refer Model zoo for complete set of validated models across multiple categories
    • Image classification
    • Object detection
    • Pixel level semantic Segmentation

Compile and Validate on X86_PC

  • Execute below to compile and run inference of the model in X86_PC
    • Inference is validated with both Python and CPP APIs
mkdir build && cd build
cmake ../examples && make -j && cd ..
source ./scripts/run_python_examples.sh
python3 ./scripts/gen_test_report.py
  • The execution of above step will generate compiled-model artifacts and output images at ./edgeai-tidl-tools/output_images. These outputs images can be compared against the expected outputs in /edgeai-tidl-tools/test_data/refs-pc-{soc}, this confirms successful installation / setup on PC
model-artifacts/
models/
output_images/
test_report_pc.csv
  • An output image can be found for each model in the'output_images' folder, similar to what's shown below
Image Classification Object detection Semantic Segmentation

Benchmark on TI SOC

  • Prepare the development board by following the below steps
 git clone https://github.com/TexasInstruments/edgeai-tidl-tools.git
 cd edgeai-tidl-tools
 git checkout <TAG Compatible with your SDK version>
 export SOC=<Your SOC name>
 export TIDL_TOOLS_PATH=$(pwd)
  • Copy the compiled artifacts from X86_PC to Development boards file system at ./edgeai-tidl-tools/
  • Execute below to run inference on target development board with both Python and CPP APIs
# scp -r <pc>/edgeai-tidl-tools/model-artifacts/  <dev board>/edgeai-tidl-tool/
# scp -r <pc>/edgeai-tidl-tools/models/  <dev board>/edgeai-tidl-tool/
mkdir build && cd build
cmake ../examples && make -j && cd ..
python3 ./scripts/gen_test_report.py
  • The execution of above step will generate output images at ./edgeai-tidl-tools/output_images. These outputs images can be compared against the expected outputs in /edgeai-tidl-tools/test_data/refs-{soc}. This confirms successful installation / setup on board.

Compile and Benchmark Custom Model

  • New Model Evaluation : Refer this if your model falls into one of supported out-of-box example tasks categories such as image classification, object detection or pixel level semantic Segmentation
  • Custom Model Evaluation : Refer this section if your custom model doesn't fall in supported example task category or input and output format is different from the supported list of tasks
  • Reporting issues with Model deployment - Refer notes here for reporting issues in custom model deployment

User Guide

License

Please see the license under which this repository is made available: LICENSE

edgeai-tidl-tools's People

Contributors

abhaychirania2411 avatar anshu-jain30 avatar debapriyamaji avatar dokyoungkwon avatar gibrane avatar kumardesappan avatar paulacarrillo avatar pramodswamiti avatar shyam-j avatar yuanzhaoti avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

edgeai-tidl-tools's Issues

Model Compilation Problem

when i run "python3 onnxrt_ep.py -c" code to create modelartifacts folder. The code runtime stands and waits and not finish.

terminal output expects as follows:


sefau18@ubuntu:~/edgeai-tidl-tools/examples/osrt_python/ort$ python3 onnxrt_ep.py -c
Available execution providers : ['TIDLExecutionProvider', 'TIDLCompilationProvider', 'CPUExecutionProvider']

Running 1 Models - ['best']

Running_Model : best

TIDL Meta PipeLine (Proto) File : /home/sefau18/edgeai-tidl-tools/models/public/best.prototxt
yolo_v3
yolo_v3
Number of OD backbone nodes = 0
Size of odBackboneNodeIds = 0

Preliminary subgraphs created = 0
Final number of subgraphs created are : 0, - Offloaded Nodes - 0, Total Nodes - 1
TIDL Meta PipeLine (Proto) File : /home/sefau18/edgeai-tidl-tools/models/public/best.prototxt
yolo_v3
yolo_v3
Number of OD backbone nodes = 0
Size of odBackboneNodeIds = 0

Preliminary subgraphs created = 0
Final number of subgraphs created are : 0, - Offloaded Nodes - 0, Total Nodes - 1
TIDL Meta PipeLine (Proto) File : /home/sefau18/edgeai-tidl-tools/models/public/best.prototxt
yolo_v3
yolo_v3
Number of OD backbone nodes = 328
Size of odBackboneNodeIds = 328

Preliminary subgraphs created = 1
Final number of subgraphs created are : 1, - Offloaded Nodes - 434, Total Nodes - 434


What could be the problem?

Efficientnet_lite4 ONNX compilation failing

I am trying to compile the official ONNX version of Efficientnet_lite4 (from here) to run on the Jacinto7 but the compilation fails with the following error message:

onnxruntime.capi.onnxruntime_pybind11_state.RuntimeException: [ONNXRuntimeError] : 6 : RUNTIME_EXCEPTION : Non-zero status code returned while running Gemm node. Name:'gemm' Status Message: /home/a0230315/workarea/onnxrt/onnxruntime/onnxruntime/core/providers/cpu/math/gemm_helper.h:13 onnxruntime::GemmHelper::GemmHelper(const onnxruntime::TensorShape&, bool, const onnxruntime::TensorShape&, bool, const onnxruntime::TensorShape&) left.NumDimensions() == 2 || left.NumDimensions() == 1 was false. 

I suspect it comes from an unsuported Gemm layer according to the previous warning:

ALLOWLISTING : GEMM : Only supported Gemm Params are transA = 0, transB = 1, alpha = 1.0 and beta = 1.0. The same will processed as Inner product or fully connected layer in TIDL  -- file info - tidl_onnxImport.cpp , TIDL_onnxGemmBaseParams , 849 

Do you have an idea on how to solve this ?

can not compile onnx & prototxt

I trained a model from edgeai-mmdetection, and export onnx & prototxt, but, as I run edgeai-tidl-tools to compile it, it will blocked with no error report and never finish.

terminal just stop here:
there is no need to override it, by either re-generating the model with latest exporter/converter or with the tool onnxruntime/tools/python/remove_initializer_from_input.py.
2021-10-27 17:02:49.090050279 [W:onnxruntime:, graph.cc:1074 Graph] Initializer 3002 appears in graph inputs and will not be treated as constant value/weight. This may prevent some of the graph optimizations, like const folding. Move it out of graph inputs if there is no need to override it, by either re-generating the model with latest exporter/converter or with the tool onnxruntime/tools/python/remove_initializer_from_input.py.
2021-10-27 17:02:49.090058641 [W:onnxruntime:, graph.cc:1074 Graph] Initializer 3003 appears in graph inputs and will not be treated as constant value/weight. This may prevent some of the graph optimizations, like const folding. Move it out of graph inputs if there is no need to override it, by either re-generating the model with latest exporter/converter or with the tool onnxruntime/tools/python/remove_initializer_from_input.py.
0.0s: VX_ZONE_INIT:Enabled
0.25s: VX_ZONE_ERROR:Enabled
0.27s: VX_ZONE_WARNING:Enabled
TIDL Meta PipeLine (Proto) File : ../../../models/public/onnx/ssd-lite_mobilenet_fpn.prototxt
ssd

Number of OD backbone nodes = 156
Size of odBackboneNodeIds = 156

Dockerfile fails to run

Hello!

I'm currently having issues launching the dockerfile. The build went well (docker build -t edgeai-tidl-tools .), but when trying to launch it I get:

$ sudo docker run edgeai-tidl-tools
/curr_entrypoint.sh: line 6: ./setup.sh: No such file or directory
CMake Error: The source directory "/examples" does not exist.
Specify --help for usage, or press the help button on the CMake GUI.
make: *** No targets specified and no makefile found.  Stop.
/curr_entrypoint.sh: line 11: ./scripts/run_python_examples.sh: No such file or directory
python3: can't open file './scripts/gen_test_report.py': [Errno 2] No such file or directory
total 88
drwxr-xr-x   1 root root 4096 Oct 21 12:56 bin
drwxr-xr-x   2 root root 4096 Apr 24  2018 boot
drwxr-xr-x   2 root root 4096 Oct 21 13:00 build
-rwxr-xr-x   1 root root  244 Oct 21 12:58 curr_entrypoint.sh
drwxr-xr-x   5 root root  360 Oct 21 13:00 dev
-rwxr-xr-x   1 root root   40 Oct 21 12:58 dev_entrypoint.sh
-rwxrwxr-x   1 root root  244 Oct 21 12:48 entrypoint.sh
drwxr-xr-x   1 root root 4096 Oct 21 13:00 etc
drwxr-xr-x   2 root root 4096 Apr 24  2018 home
drwxr-xr-x   1 root root 4096 Oct 21 12:52 lib
drwxr-xr-x   2 root root 4096 Sep 13 19:28 lib64
drwxr-xr-x   2 root root 4096 Sep 13 19:27 media
drwxr-xr-x   2 root root 4096 Sep 13 19:27 mnt
drwxr-xr-x   2 root root 4096 Sep 13 19:27 opt
dr-xr-xr-x 497 root root    0 Oct 21 13:00 proc
-rw-r--r--   1 root root   45 Oct 21 13:00 report.txt
-rw-rw-r--   1 root root  670 Oct 21 12:48 requirements_pc.txt
drwx------   1 root root 4096 Oct 21 12:56 root
drwxr-xr-x   5 root root 4096 Sep 13 19:28 run
drwxr-xr-x   2 root root 4096 Sep 13 19:28 sbin
drwxr-xr-x   2 root root 4096 Sep 13 19:27 srv
dr-xr-xr-x  13 root root    0 Oct 21 13:00 sys
drwxrwxrwt   1 root root 4096 Oct 21 12:58 tmp
drwxr-xr-x   1 root root 4096 Sep 13 19:27 usr
drwxr-xr-x   1 root root 4096 Sep 13 19:28 var

Any ideas? Thanks!

This is an invalid model. Error: the graph is not acyclic.

When converting onnx model, I got below error.

Running runtimes graphviz - /home/wanchaoyao/Code/TexasInstruments/edgeai-tidl-tools/tidl_tools/tidl_graphVisualiser_runtimes.out custom-artifacts/onnx/onenet/allowedNode.txt custom-artifacts/onnx/onenet/tempDir/graphvizInfo.txt custom-artifacts/onnx/onenet/tempDir/runtimes_visualization.svg
Traceback (most recent call last):
File "test.py", line 74, in
sess = rt.InferenceSession(onnx_model_path, providers=EP_list, provider_options=[compile_options, {}], sess_options=so)
File "/home/wanchaoyao/.local/lib/python3.6/site-packages/onnxruntime/capi/onnxruntime_inference_collection.py", line 283, in init
self._create_inference_session(providers, provider_options)
File "/home/wanchaoyao/.local/lib/python3.6/site-packages/onnxruntime/capi/onnxruntime_inference_collection.py", line 315, in _create_inference_session
sess.initialize_session(providers, provider_options)
onnxruntime.capi.onnxruntime_pybind11_state.Fail: [ONNXRuntimeError] : 1 : FAIL : This is an invalid model. Error: the graph is not acyclic.

You can see the svg file in attachment. I think it is acutually acyclic..
runtimes_visualization
.

How to use the softmax(dim=1)?

Hello.

I am making a segmentation model using softmax(dim=1).

I compiled my model using edgeai-tidl-tools on PC.

But, I found softmax(dim=1) layer is not supported.

Because softmax is only supported in [1, 1, 1, N], so it cannot be used for dim=1.

How to use the softmax(dim=1)?

Also, How to check softmax(dim=1) in compile using edgeai-tidl-tools on PC?

could not load library libvx_tidl_rt.so

Hi,

We are using docker environment suggestions from the dockerfile and also made sure we have python3.6
However, when we run the tfl python example, we get the following error ->

Running 3 Models - ['cl-tfl-mobilenet_v1_1.0_224', 'ss-tfl-deeplabv3_mnv2_ade20k_float', 'od-tfl-ssd_mobilenet_v2_300_float']


Running_Model :  cl-tfl-mobilenet_v1_1.0_224

Running_Model :  ss-tfl-deeplabv3_mnv2_ade20k_float

Running_Model :  od-tfl-ssd_mobilenet_v2_300_float
Process Process-3:
Process Process-1:
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/tflite_runtime/interpreter.py", line 175, in load_delegate
    delegate = Delegate(library, options)
  File "/usr/local/lib/python3.6/dist-packages/tflite_runtime/interpreter.py", line 113, in __init__
    raise ValueError(capture.message)
ValueError: could not load library libvx_tidl_rt.so

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.6/multiprocessing/process.py", line 258, in _bootstrap
    self.run()
  File "/usr/lib/python3.6/multiprocessing/process.py", line 93, in run
    self._target(*self._args, **self._kwargs)
  File "tflrt_delegate.py", line 174, in run_model
    experimental_delegates=[tflite.load_delegate(os.path.join(tidl_tools_path, 'tidl_model_import_tflite.so'), delegate_options)])
  File "/usr/local/lib/python3.6/dist-packages/tflite_runtime/interpreter.py", line 178, in load_delegate
    library, str(e)))
ValueError: Failed to load delegate from /resources/edgeai-tidl-tools/tidl_tools/tidl_model_import_tflite.so
could not load library libvx_tidl_rt.so
Process Process-2:
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/tflite_runtime/interpreter.py", line 175, in load_delegate
    delegate = Delegate(library, options)
  File "/usr/local/lib/python3.6/dist-packages/tflite_runtime/interpreter.py", line 113, in __init__
    raise ValueError(capture.message)
ValueError: could not load library libvx_tidl_rt.so

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.6/multiprocessing/process.py", line 258, in _bootstrap
    self.run()
  File "/usr/lib/python3.6/multiprocessing/process.py", line 93, in run
    self._target(*self._args, **self._kwargs)
  File "tflrt_delegate.py", line 174, in run_model
    experimental_delegates=[tflite.load_delegate(os.path.join(tidl_tools_path, 'tidl_model_import_tflite.so'), delegate_options)])
  File "/usr/local/lib/python3.6/dist-packages/tflite_runtime/interpreter.py", line 178, in load_delegate
    library, str(e)))
ValueError: Failed to load delegate from /resources/edgeai-tidl-tools/tidl_tools/tidl_model_import_tflite.so
could not load library libvx_tidl_rt.so
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/tflite_runtime/interpreter.py", line 175, in load_delegate
    delegate = Delegate(library, options)
  File "/usr/local/lib/python3.6/dist-packages/tflite_runtime/interpreter.py", line 113, in __init__
    raise ValueError(capture.message)
ValueError: could not load library libvx_tidl_rt.so

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3.6/multiprocessing/process.py", line 258, in _bootstrap
    self.run()
  File "/usr/lib/python3.6/multiprocessing/process.py", line 93, in run
    self._target(*self._args, **self._kwargs)
  File "tflrt_delegate.py", line 174, in run_model
    experimental_delegates=[tflite.load_delegate(os.path.join(tidl_tools_path, 'tidl_model_import_tflite.so'), delegate_options)])
  File "/usr/local/lib/python3.6/dist-packages/tflite_runtime/interpreter.py", line 178, in load_delegate
    library, str(e)))
ValueError: Failed to load delegate from /resources/edgeai-tidl-tools/tidl_tools/tidl_model_import_tflite.so
could not load library libvx_tidl_rt.so
^CTraceback (most recent call last):
  File "tflrt_delegate.py", line 257, in <module>
    nthreads = join_one(nthreads)
  File "tflrt_delegate.py", line 239, in join_one
    sem.acquire()

However, we have checked that the TIDL_TOOLS_PATH is set and has the necessary libs.

ls ${TIDL_TOOLS_PATH}
device_config.cfg        libvx_tidl_rt.so         tidl_graphVisualiser.out           tidl_model_import.so
itidl_rt.h               libvx_tidl_rt.so.1.0     tidl_graphVisualiser_runtimes.out  tidl_model_import_tflite.so
itvm_rt.h                osrt_deps                tidl_model_import_onnx.so          yaml-cpp
libtidl_onnxrt_EP.so     PC_dsp_test_dl_algo.out  tidl_model_import.out
libtidl_tfl_delegate.so  ti_cnnperfsim.out        tidl_model_import_relay.so

Is there anything more we can do to debug the issue?

Thank You
Niranjan

ValueError: could not load library libvx_tidl_rt.so

Hi,

I have compiled the dockerfile and run the setup.py. it seems everything goes well, and i get these libraries in ./tidl_tools dir:
PC_dsp_test_dl_algo.out libonnxruntime.so libtidl_onnxrt_EP.so libvx_tidl_rt.so.1.0 tidl_graphVisualiser_runtimes.out tidl_model_import_tflite.so device_config.cfg libonnxruntime.so.1.7.0 libtidl_tfl_delegate.so ti_cnnperfsim.out tidl_model_import_onnx.so itidl_rt.h libtensorflow-lite.a libvx_tidl_rt.so tidl_graphVisualiser.out tidl_model_import_relay.so

however, when i try to run ./scripts/run_python_examples.sh, an error was thrown as follows:

`
X64 Architecture
Running 3 Models - ['cl-tfl-mobilenet_v1_1.0_224', 'ss-tfl-deeplabv3_mnv2_ade20k_float', 'od-tfl-ssd_mobilenet_v2_300_float']

Running_Model : cl-tfl-mobilenet_v1_1.0_224

Running_Model : ss-tfl-deeplabv3_mnv2_ade20k_float

Running_Model : od-tfl-ssd_mobilenet_v2_300_float
Process Process-2:
Process Process-1:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/tflite_runtime/interpreter.py", line 152, in load_delegate
delegate = Delegate(library, options)
File "/usr/local/lib/python3.6/dist-packages/tflite_runtime/interpreter.py", line 111, in init
raise ValueError(capture.message)
ValueError: could not load library libvx_tidl_rt.so

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/lib/python3.6/multiprocessing/process.py", line 258, in _bootstrap
self.run()
File "/usr/lib/python3.6/multiprocessing/process.py", line 93, in run
self._target(*self._args, **self._kwargs)
File "tflrt_delegate.py", line 149, in run_model
experimental_delegates=[tflite.load_delegate(os.path.join(tidl_tools_path, 'tidl_model_import_tflite.so'), delegate_options)])
File "/usr/local/lib/python3.6/dist-packages/tflite_runtime/interpreter.py", line 155, in load_delegate
library, str(e)))
ValueError: Failed to load delegate from /edgeai-tidl-tools/tidl_tools/tidl_model_import_tflite.so
could not load library libvx_tidl_rt.so
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/tflite_runtime/interpreter.py", line 152, in load_delegate
delegate = Delegate(library, options)
File "/usr/local/lib/python3.6/dist-packages/tflite_runtime/interpreter.py", line 111, in init
raise ValueError(capture.message)
ValueError: could not load library libvx_tidl_rt.so

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/lib/python3.6/multiprocessing/process.py", line 258, in _bootstrap
self.run()
File "/usr/lib/python3.6/multiprocessing/process.py", line 93, in run
self._target(*self._args, **self._kwargs)
File "tflrt_delegate.py", line 149, in run_model
experimental_delegates=[tflite.load_delegate(os.path.join(tidl_tools_path, 'tidl_model_import_tflite.so'), delegate_options)])
File "/usr/local/lib/python3.6/dist-packages/tflite_runtime/interpreter.py", line 155, in load_delegate
library, str(e)))
ValueError: Failed to load delegate from /edgeai-tidl-tools/tidl_tools/tidl_model_import_tflite.so
could not load library libvx_tidl_rt.so
Process Process-3:
Traceback (most recent call last):
File "/usr/local/lib/python3.6/dist-packages/tflite_runtime/interpreter.py", line 152, in load_delegate
delegate = Delegate(library, options)
File "/usr/local/lib/python3.6/dist-packages/tflite_runtime/interpreter.py", line 111, in init
raise ValueError(capture.message)
ValueError: could not load library libvx_tidl_rt.so
(many other similar information lines)
`

is there anything i can do to fix this problem? thanks for your reply in advance.

Questions about python examples running on a target board

Hi. Thanks for this great library!

I'm following the Python Examples.: https://github.com/TexasInstruments/edgeai-tidl-tools/blob/master/examples/osrt_python/README.md
I was able to compile models on PC and copied ./models and ./model-artifacts to my TDA4x (SDK8.2)

My question is, when running onnxrt_ep.py on the target board TDA4x,
I feel like the python script's input is still onnx file, not .bin files, where I think .bin files are the product of compiling.

For example, when I check the codes below in the onnxrt_ep.py, config['model_path'] is ../../../models/public/resnet18_opset9.onnx.

    # the execution part
    EP_list = ['TIDLExecutionProvider', 'CPUExecutionProvider']
    sess = rt.InferenceSession(config['model_path'],
                               providers=EP_list,
                               provider_options=[delegate_options, {}],
                               sess_options=so)
  • Shouldn't the target board inference be loaded from .bin files in model-artifacts? (ex. 191_tidl_io_1.bin, 191_tidl_net.bin)
  • Why did I have to compile on PC, if the target board can infer models by directly loading from onnx files?
  • Is there a python script example of creating and inferring a model from .bin files?

Can you please advise? What am I missing?


FYI, I'm setting like this on the board

export DEVICE=j7
export TIDL_TOOLS_PATH=/home/root/edgeai-tidl-tools/tidl_tools

Error runing models on chip with TFLite

Hello,

I compiled the models on my computer, copied them to my Beaglebone AI-64, and I'm now trying to run tflrt_delegate.py. However, I'm gettting this error:

$ python tflrt_delegate.py 
Running 3 Models - ['cl-tfl-mobilenet_v1_1.0_224', 'ss-tfl-deeplabv3_mnv2_ade20k_float', 'od-tfl-ssd_mobilenet_v2_300_float']


Running_Model :  cl-tfl-mobilenet_v1_1.0_224

 Number of subgraphs:0 , 0 nodes delegated out of 34 nodes 
 
/home/aurelien/Projects/GitHub/edgeai-tidl-tools/examples/osrt_python/tfl/tflrt_delegate.py:87: DeprecationWarning: LANCZOS is deprecated and will be removed in Pillow 10 (2023-07-01). Use Resampling.LANCZOS instead.
  imgs.append(Image.open(image_files[i]).convert('RGB').resize((new_width, new_height), PIL.Image.LANCZOS))
INFO: Created TensorFlow Lite XNNPACK delegate for CPU.
Traceback (most recent call last):
  File "/home/aurelien/Projects/GitHub/edgeai-tidl-tools/examples/osrt_python/tfl/tflrt_delegate.py", line 250, in <module>
    run_model(model, mIdx)
  File "/home/aurelien/Projects/GitHub/edgeai-tidl-tools/examples/osrt_python/tfl/tflrt_delegate.py", line 179, in run_model
    imgs, output, proc_time, sub_graph_time, ddr_write, ddr_read, new_height, new_width  = infer_image(interpreter, input_images, config)
  File "/home/aurelien/Projects/GitHub/edgeai-tidl-tools/examples/osrt_python/tfl/tflrt_delegate.py", line 109, in infer_image
    copy_time, proc_time, sub_graphs_proc_time, ddr_write, ddr_read  = get_benchmark_output(interpreter)
  File "/home/aurelien/Projects/GitHub/edgeai-tidl-tools/examples/osrt_python/tfl/tflrt_delegate.py", line 50, in get_benchmark_output
    benchmark_dict = interpreter.get_TI_benchmark_data()
AttributeError: 'Interpreter' object has no attribute 'get_TI_benchmark_data'

What could I have missed? Thanks

operating efficiency

Thank you very much. Is it more efficient to run ONNX on TDA and directly call openvx?

Error when run the CPP examples

After building the CPP examples using cmake from repository base directory, i tried to run the CPP examples by
./bin/Release/ort_main -f model-artifacts/cl-ort-resnet18-v1 -i test_data/airshow.jpg
however, i got:

***** Display run Config: start *****
verbose level set to: 3
accelerated mode set to: 1
device mem set to: 1
loop count set to: 1
model path set to: 
model artifacts path set to: model-artifacts/cl-ort-resnet18-v1
image path set to: test_data/airshow.jpg
device_type set to: cpu
labels path set to: test_data/labels.txt
num of threads set to: 4
num of results set to: 5
num of warmup runs set to: 2

***** Display run Config: end *****
2022-03-18 02:28:57.043595673 [W:onnxruntime:, graph.cc:3106 CleanUnusedInitializers] Removing initializer 'layer4.1.bn2.num_batches_tracked'. It is not used by any node and should be removed from the model.
2022-03-18 02:28:57.043631889 [W:onnxruntime:, graph.cc:3106 CleanUnusedInitializers] Removing initializer 'layer4.1.bn1.num_batches_tracked'. It is not used by any node and should be removed from the model.
2022-03-18 02:28:57.043639134 [W:onnxruntime:, graph.cc:3106 CleanUnusedInitializers] Removing initializer 'layer4.0.downsample.1.num_batches_tracked'. It is not used by any node and should be removed from the model.
2022-03-18 02:28:57.043645109 [W:onnxruntime:, graph.cc:3106 CleanUnusedInitializers] Removing initializer 'layer4.0.bn2.num_batches_tracked'. It is not used by any node and should be removed from the model.
2022-03-18 02:28:57.043650998 [W:onnxruntime:, graph.cc:3106 CleanUnusedInitializers] Removing initializer 'layer3.1.bn1.num_batches_tracked'. It is not used by any node and should be removed from the model.
2022-03-18 02:28:57.043657350 [W:onnxruntime:, graph.cc:3106 CleanUnusedInitializers] Removing initializer 'layer1.1.bn1.num_batches_tracked'. It is not used by any node and should be removed from the model.
2022-03-18 02:28:57.043662885 [W:onnxruntime:, graph.cc:3106 CleanUnusedInitializers] Removing initializer 'layer1.0.bn2.num_batches_tracked'. It is not used by any node and should be removed from the model.
2022-03-18 02:28:57.043669844 [W:onnxruntime:, graph.cc:3106 CleanUnusedInitializers] Removing initializer 'layer4.0.bn1.num_batches_tracked'. It is not used by any node and should be removed from the model.
2022-03-18 02:28:57.043678334 [W:onnxruntime:, graph.cc:3106 CleanUnusedInitializers] Removing initializer 'layer3.0.bn2.num_batches_tracked'. It is not used by any node and should be removed from the model.
2022-03-18 02:28:57.043687471 [W:onnxruntime:, graph.cc:3106 CleanUnusedInitializers] Removing initializer 'layer3.0.bn1.num_batches_tracked'. It is not used by any node and should be removed from the model.
2022-03-18 02:28:57.043697618 [W:onnxruntime:, graph.cc:3106 CleanUnusedInitializers] Removing initializer 'bn1.num_batches_tracked'. It is not used by any node and should be removed from the model.
2022-03-18 02:28:57.043709844 [W:onnxruntime:, graph.cc:3106 CleanUnusedInitializers] Removing initializer 'layer1.0.bn1.num_batches_tracked'. It is not used by any node and should be removed from the model.
2022-03-18 02:28:57.043717928 [W:onnxruntime:, graph.cc:3106 CleanUnusedInitializers] Removing initializer 'layer2.0.bn1.num_batches_tracked'. It is not used by any node and should be removed from the model.
2022-03-18 02:28:57.043727013 [W:onnxruntime:, graph.cc:3106 CleanUnusedInitializers] Removing initializer 'layer1.1.bn2.num_batches_tracked'. It is not used by any node and should be removed from the model.
2022-03-18 02:28:57.043737236 [W:onnxruntime:, graph.cc:3106 CleanUnusedInitializers] Removing initializer 'layer2.0.bn2.num_batches_tracked'. It is not used by any node and should be removed from the model.
2022-03-18 02:28:57.043747144 [W:onnxruntime:, graph.cc:3106 CleanUnusedInitializers] Removing initializer 'layer2.0.downsample.1.num_batches_tracked'. It is not used by any node and should be removed from the model.
2022-03-18 02:28:57.043758673 [W:onnxruntime:, graph.cc:3106 CleanUnusedInitializers] Removing initializer 'layer2.1.bn1.num_batches_tracked'. It is not used by any node and should be removed from the model.
2022-03-18 02:28:57.043768833 [W:onnxruntime:, graph.cc:3106 CleanUnusedInitializers] Removing initializer 'layer2.1.bn2.num_batches_tracked'. It is not used by any node and should be removed from the model.
2022-03-18 02:28:57.043779750 [W:onnxruntime:, graph.cc:3106 CleanUnusedInitializers] Removing initializer 'layer3.1.bn2.num_batches_tracked'. It is not used by any node and should be removed from the model.
2022-03-18 02:28:57.043789666 [W:onnxruntime:, graph.cc:3106 CleanUnusedInitializers] Removing initializer 'layer3.0.downsample.1.num_batches_tracked'. It is not used by any node and should be removed from the model.
libtidl_onnxrt_EP loaded 0x555989d89ef0 
ERROR : artifacts_folder not a directoryParsing ONNX Model 
2022-03-18 02:28:57.250911581 [E:onnxruntime:, inference_session.cc:1311 operator()] Exception during initialization: std::bad_alloc
terminate called after throwing an instance of 'Ort::Exception'
  what():  Exception during initialization: std::bad_alloc
Aborted (core dumped)

what does artifacts_folder not a directoryParsing ONNX Model mean? I googled the issue but gained nothing.
Any advice on this problem?
Thanks.

Could not load library libvx_tidl_rt.so

When try to execute python3 tflr_delegate.py -c from /examples/osrt_python/tfl , the following error is observed

Running 3 Models - ['cl-tfl-mobilenet_v1_1.0_224', 'ss-tfl-deeplabv3_mnv2_ade20k_float', 'od-tfl-ssd_mobilenet_v2_300_float']
Running_Model : cl-tfl-mobilenet_v1_1.0_224
Running_Model : ss-tfl-deeplabv3_mnv2_ade20k_float
Running_Model : od-tfl-ssd_mobilenet_v2_300_float
Process Process-2:
Process Process-1:
Traceback (most recent call last):
File "/home/treerunner/venv/lib/python3.6/site-packages/tflite_runtime/interpreter.py", line 152, in load_delegate
delegate = Delegate(library, options)
Traceback (most recent call last):
File "/home/treerunner/venv/lib/python3.6/site-packages/tflite_runtime/interpreter.py", line 111, in init
raise ValueError(capture.message)
Process Process-3:
File "/home/treerunner/venv/lib/python3.6/site-packages/tflite_runtime/interpreter.py", line 152, in load_delegate
delegate = Delegate(library, options)
File "/home/treerunner/venv/lib/python3.6/site-packages/tflite_runtime/interpreter.py", line 111, in init
raise ValueError(capture.message)
ValueError: could not load library libvx_tidl_rt.so

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
ValueError: could not load library libvx_tidl_rt.so
File "/usr/lib/python3.6/multiprocessing/process.py", line 258, in _bootstrap
self.run()
File "/usr/lib/python3.6/multiprocessing/process.py", line 93, in run
self._target(*self._args, **self._kwargs)

During handling of the above exception, another exception occurred:

File "tflrt_delegate.py", line 157, in run_model
experimental_delegates=[tflite.load_delegate(os.path.join(tidl_tools_path, 'tidl_model_import_tflite.so'), delegate_options)])
Traceback (most recent call last):
File "/home/treerunner/venv/lib/python3.6/site-packages/tflite_runtime/interpreter.py", line 155, in load_delegate
library, str(e)))
File "/usr/lib/python3.6/multiprocessing/process.py", line 258, in _bootstrap
self.run()
File "/usr/lib/python3.6/multiprocessing/process.py", line 93, in run
self._target(*self._args, **self._kwargs)
ValueError: Failed to load delegate from /home/treerunner/Documents/SDK/7_03_00/TI_RTOS_PSDK/ti-processor-sdk-rtos-j721e-evm-07_03_00_07/tidl_j7_02_00_00_07/tidl_tools/tidl_model_import_tflite.so
could not load library libvx_tidl_rt.so
File "tflrt_delegate.py", line 157, in run_model
experimental_delegates=[tflite.load_delegate(os.path.join(tidl_tools_path, 'tidl_model_import_tflite.so'), delegate_options)])
File "/home/treerunner/venv/lib/python3.6/site-packages/tflite_runtime/interpreter.py", line 155, in load_delegate
library, str(e)))
ValueError: Failed to load delegate from /home/treerunner/Documents/SDK/7_03_00/TI_RTOS_PSDK/ti-processor-sdk-rtos-j721e-evm-07_03_00_07/tidl_j7_02_00_00_07/tidl_tools/tidl_model_import_tflite.so
could not load library libvx_tidl_rt.so
Traceback (most recent call last):
File "/home/treerunner/venv/lib/python3.6/site-packages/tflite_runtime/interpreter.py", line 152, in load_delegate
delegate = Delegate(library, options)
File "/home/treerunner/venv/lib/python3.6/site-packages/tflite_runtime/interpreter.py", line 111, in init
raise ValueError(capture.message)
ValueError: could not load library libvx_tidl_rt.so

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/lib/python3.6/multiprocessing/process.py", line 258, in _bootstrap
self.run()
File "/usr/lib/python3.6/multiprocessing/process.py", line 93, in run
self._target(*self._args, **self._kwargs)
File "tflrt_delegate.py", line 157, in run_model
experimental_delegates=[tflite.load_delegate(os.path.join(tidl_tools_path, 'tidl_model_import_tflite.so'), delegate_options)])
File "/home/treerunner/venv/lib/python3.6/site-packages/tflite_runtime/interpreter.py", line 155, in load_delegate
library, str(e)))
ValueError: Failed to load delegate from /home/treerunner/Documents/SDK/7_03_00/TI_RTOS_PSDK/ti-processor-sdk-rtos-j721e-evm-07_03_00_07/tidl_j7_02_00_00_07/tidl_tools/tidl_model_import_tflite.so
could not load library libvx_tidl_rt.so

Note: In ${PSDK_RTOS_PATH}/ti_dl/rt/out/PC/x86_64/LINUX/release i can find the libvx_tidl_rt.so library. I wonder if i missed a makefile target that installs these libraries into the correct location. Any help on this would be great

while loading shared libraries: libcgraph.so.6: cannot open shared object file: No such file or directory

/home/user/github/edgeai-tidl-tools-master/tidl_tools/tidl_graphVisualiser.out: error while loading shared libraries: libcgraph.so.6: cannot open shared object file: No such file or directory

when compiling and running the model, it popped up an error which says missing libcgraph.so.6.

Can anyone help.

The command I was running: "python3 onnxrt_ep.py -c" under the directory "examples/osrt_python/ort".

error when make cpp examples

when i follow the instruction here for cpp example, i ran make and got:

Scanning dependencies of target post_process
[  5%] Building CXX object osrt_cpp/post_process/CMakeFiles/post_process.dir/post_process.cpp.o
[ 11%] Linking CXX static library /edgeai-tidl-tools/lib/Release/libpost_process.a
[ 11%] Built target post_process
Scanning dependencies of target pre_process
[ 16%] Building CXX object osrt_cpp/pre_process/CMakeFiles/pre_process.dir/pre_process.cpp.o
[ 22%] Linking CXX static library /edgeai-tidl-tools/lib/Release/libpre_process.a
[ 22%] Built target pre_process
Scanning dependencies of target utils
[ 27%] Building CXX object osrt_cpp/utils/CMakeFiles/utils.dir/src/utility_functs.cpp.o
[ 33%] Building CXX object osrt_cpp/utils/CMakeFiles/utils.dir/src/model_info.cpp.o
[ 38%] Building CXX object osrt_cpp/utils/CMakeFiles/utils.dir/src/edgeai_classnames.cpp.o
[ 44%] Building CXX object osrt_cpp/utils/CMakeFiles/utils.dir/src/ti_logger.cpp.o
[ 50%] Building CXX object osrt_cpp/utils/CMakeFiles/utils.dir/src/arg_parsing.cpp.o
[ 55%] Linking CXX static library /edgeai-tidl-tools/lib/Release/libutils.a
[ 55%] Built target utils
Scanning dependencies of target tfl_main
[ 61%] Building CXX object osrt_cpp/tfl/CMakeFiles/tfl_main.dir/tfl_main.cpp.o
In file included from /edgeai-tidl-tools/examples/osrt_cpp/tfl/tfl_main.cpp:63:0:
/edgeai-tidl-tools/examples/osrt_cpp/tfl/tfl_main.h:96:22: **fatal error: itidl_rt.h: No such file or directory**
compilation terminated.
osrt_cpp/tfl/CMakeFiles/tfl_main.dir/build.make:62: recipe for target 'osrt_cpp/tfl/CMakeFiles/tfl_main.dir/tfl_main.cpp.o' failed
make[2]: *** [osrt_cpp/tfl/CMakeFiles/tfl_main.dir/tfl_main.cpp.o] Error 1
CMakeFiles/Makefile2:252: recipe for target 'osrt_cpp/tfl/CMakeFiles/tfl_main.dir/all' failed
make[1]: *** [osrt_cpp/tfl/CMakeFiles/tfl_main.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2

Any advice for solving this problem?
Thanks.

Expected Model Compilation Output in Model Artifacts?

I am compiling YOLOv5 Ti Lite .onnx and .prototxt using onnxrt_ep.py. If the model compilation is successful, what files should I expect to see in model_artifacts?

If I am compiling for the Beaglebone AI board on my Linux PC, what should I be setting device to?

[ONNXRuntimeError] : 1 : FAIL : This is an invalid model. Error: the graph is not acyclic.

I am trying to compile the mobilenet-SSD based model on onnxruntime. But I am facing an error.

Preliminary subgraphs created = 2
Final number of subgraphs created are : 1, - Offloaded Nodes - 48, Total Nodes - 55
Node in deny list...delegated to ARM --- layer type - Transpose, Node name - Transpose_45
Node in deny list...delegated to ARM --- layer type - Reshape, Node name - Reshape_46
Node in deny list...delegated to ARM --- layer type - Transpose, Node name - Transpose_50
Node in deny list...delegated to ARM --- layer type - Reshape, Node name - Reshape_51
Node in deny list...delegated to ARM --- layer type - Concat, Node name - Concat_52
Node in deny list...delegated to ARM --- layer type - Concat, Node name - Concat_53
Node in deny list...delegated to ARM --- layer type - Softmax, Node name - Softmax_54
Running runtimes graphviz - /data/home/paneesh/edgeai-tidl-tools/tidl_tools/tidl_graphVisualiser_runtimes.out ../../../model-artifacts//fd//allowedNode.txt ../../../model-artifacts//fd//tempDir/graphvizInfo.txt ../../../model-artifacts//fd//tempDir/runtimes_visualization.svg
Process Process-1:
Traceback (most recent call last):
File "/usr/lib/python3.6/multiprocessing/process.py", line 258, in _bootstrap
self.run()
File "/usr/lib/python3.6/multiprocessing/process.py", line 93, in run
self._target(*self._args, **self._kwargs)
File "onnxrt_ep.py", line 174, in run_model
sess = rt.InferenceSession(config['model_path'] ,providers=EP_list, provider_options=[delegate_options, {}], sess_options=so)
File "/data/home/paneesh/.local/lib/python3.6/site-packages/onnxruntime/capi/onnxruntime_inference_collection.py", line 283, in init
self._create_inference_session(providers, provider_options)
File "/data/home/paneesh/.local/lib/python3.6/site-packages/onnxruntime/capi/onnxruntime_inference_collection.py", line 315, in _create_inference_session
sess.initialize_session(providers, provider_options)
onnxruntime.capi.onnxruntime_pybind11_state.Fail: [ONNXRuntimeError] : 1 : FAIL : This is an invalid model. Error: the graph is not acyclic.

The onnx model is converted from a PyTorch model.

But the model is working with the CPU.(CPUEXECUTIONPROVIDER).

Please help me in solving the issue.

batch processing about this tool?

I'm using TIDL 8.1 and trying a simple classification model (input: [N, 3, 64, 64], output: [N, 26]).

I think TIDL now supports batch processing (I guess since version 8..).
I created a batch-2 onnx model and I believe compiling (TIDLCompilationProvider) worked well.

When I run inference (TIDLExecutionProvider), I checked the session info knows its batch shape is 2 and input_data also has batch 2, but the output is always batch of 1. For example, I added some prints
(in edgeai-tidl-tools/examples/osrt_python/ort/onnxrt_ep.py)

    print('batch from session info:', input_details[0].shape)
    print('input shape:', input_data.shape)
    output = list(sess.run(None, {input_name: input_data}))
    print('output shape:', output[0].shape)

and result is

batch from session info: [2, 3, 64, 64]
input shape: (2, 3, 64, 64)
output shape: (1, 1, 1, 26)

I think output shape should be (2, 1, 1, 26).
Can't I check batching results with this tool?

Size Limit on the Feature Maps for Batch Processing

Hello,

I am trying to generate the artifacts for TDA4 inference from tflite models.
While trying to invoke the tflite_runtime interpreter with the tidl_delegate options on a batched input with the shape of [2, 224, 224, 8], I faced the following error in the network compiler traces:

ERROR: Batch processing is not supported with large feature map case

I can go through the process without any issues if the input shape is changed to [2, 16, 16, 8]

I was wondering what is the size/shape limit for batch processing if we want to still offload the operations to TIDL rather than using ARM processor.

Thanks

Python version requirement

This repo has strict requirement of Python=3.6. It would be helpful to other users, if captured in requirement.txt or mention in the doc.

ERROR: [TIDL_Deconv2DLayer] ConvTranspose_138 is not supported.

when i try to compile the my custom onnx model by ./out/tidl_model_import.out /edgeai-tidl-tools/models/**/tidl_import_peeleNet.txt, it didn't succeed. Logs are as follows:

TIDL Network File      : ../../test/testvecs/config/tidl_models/onnx/tidl_net_CenterNet.1.bin  
TIDL IO Info File      : ../../test/testvecs/config/tidl_models/onnx/tidl_io_CenterNet1.1_  
Current ONNX OpSet Version   : 9  

~~~~~Running TIDL in PC emulation mode to collect Activations range for each layer~~~~~

Processing config file #0 : /ti-processor-sdk-rtos-j721e-evm-08_01_00_13/tidl_j7_08_01_00_05/ti_dl/test/testvecs/config/tidl_models/onnx/tidl_import_peeleNet.txt.qunat_stats_config.txt 
 ----------------------- TIDL Process with REF_ONLY FLOW ------------------------

#    0 . .. T    7733.23  .... ..... ... A :     0, 1.0000, 1.0000,     0 .... .....
#    1 . .. T    7659.66  .... ..... ... A :     0, 1.0000, 1.0000,     0 .... .....
#    2 . .. T    7721.69  .... ..... ... A :     0, 1.0000, 1.0000,     0 .... .....
~~~~~Running TIDL in PC emulation mode to collect Activations range for each layer~~~~~

Processing config file #0 : /ti-processor-sdk-rtos-j721e-evm-08_01_00_13/tidl_j7_08_01_00_05/ti_dl/test/testvecs/config/tidl_models/onnx/tidl_import_peeleNet.txt.qunat_stats_config.txt 
 ----------------------- TIDL Process with REF_ONLY FLOW ------------------------

#    0 . .. T    4555.80  .... ..... ... A :     0, 0.0000, 0.0000,  2152 .... .....
#    1 . .. T    3955.10  .... ..... ... A :     0, 0.0000, 0.0000, 10317 .... .....
#    2 . .. T    4026.27  .... ..... ... A :     0, 0.0000, 0.0000, 10317 .... .....
 
 
 *****************   Calibration iteration number 0 completed ************************ 
 
 
 

------------------ Network Compiler Traces -----------------------------
successful Memory allocation
SUGGESTION: [TIDL_Deconv2DLayer] ConvTranspose_114 Please change to Upsample/Resize if possible. Upsample/Resize will be more efficient.
SUGGESTION: [TIDL_Deconv2DLayer] ConvTranspose_102 Please change to Upsample/Resize if possible. Upsample/Resize will be more efficient.
SUGGESTION: [TIDL_Deconv2DLayer] ConvTranspose_120 Please change to Upsample/Resize if possible. Upsample/Resize will be more efficient.
SUGGESTION: [TIDL_Deconv2DLayer] ConvTranspose_96 Please change to Upsample/Resize if possible. Upsample/Resize will be more efficient.
SUGGESTION: [TIDL_Deconv2DLayer] ConvTranspose_108 Please change to Upsample/Resize if possible. Upsample/Resize will be more efficient.
**ERROR: [TIDL_Deconv2DLayer] ConvTranspose_138 is not supported.**
SUGGESTION: [TIDL_Deconv2DLayer] ConvTranspose_138 Please change to Upsample/Resize if possible. Upsample/Resize will be more efficient.
SUGGESTION: [TIDL_Deconv2DLayer] ConvTranspose_126 Please change to Upsample/Resize if possible. Upsample/Resize will be more efficient.
SUGGESTION: [TIDL_Deconv2DLayer] ConvTranspose_132 Please change to Upsample/Resize if possible. Upsample/Resize will be more efficient.
****************************************************
**          8 WARNINGS          1 ERRORS          **
****************************************************

i just don't think this is a model layer problem as the log says, because the other ConvTranspose layers are fine.

when TIDL complier will be updated based on onnx opset=13?

Hi.

I'm a DL engineer, use the TDA4VM chip for automotive.

We choses TDA4VM for plexible DSP H/W architecture.

But, TIDL support layers and operation based on onnx opset=11 have so many limitations.

We can't fully develop Deep Learning algorithms because of the limiatations.

So, We wait for SDK8.2 update, but it was not.

When do you update TIDL SDK based on ONNX opset=13?

If it will be updated, almost DL algorithm develpers using TIDL welcome.

We really eagerly look forward to update.

Thanks.

YOLOP compile

Hi,

I would like to compile YOLOP (https://github.com/hustvl/YOLOP)

YOLOP has three heads (object detection, lane segmentation, road segmentation)

How can I select "model_type"?

Object detection must have NMS, but Segmentation uses not NMS.

Thanks

FAIL : This is an invalid model. Error: the graph is not acyclic.

I have a ONNX model and I'm trying to compile using this tool. This model is not acyclic but the message says so.

Number of OD backbone nodes = 0 
Size of odBackboneNodeIds = 0 

Preliminary subgraphs created = 2 
Final number of subgraphs created are : 1, - Offloaded Nodes - 306, Total Nodes - 313 
Traceback (most recent call last):
  File "onnxrt_compiler_tsr.py", line 201, in <module>
    run_model(config)
  File "onnxrt_compiler_tsr.py", line 137, in run_model
    sess_options=so)
  File "/home/paul/.virtualenvs/tidl81/lib/python3.6/site-packages/onnxruntime/capi/onnxruntime_inference_collection.py", line 283, in __init__
    self._create_inference_session(providers, provider_options)
  File "/home/paul/.virtualenvs/tidl81/lib/python3.6/site-packages/onnxruntime/capi/onnxruntime_inference_collection.py", line 315, in _create_inference_session
    sess.initialize_session(providers, provider_options)
onnxruntime.capi.onnxruntime_pybind11_state.Fail: [ONNXRuntimeError] : 1 : FAIL : This is an invalid model. Error: the graph is not acyclic.

The model itself should be okay since

  1. There is no such error when I just use ['CPUExecutionProvider'].

  2. Here is the tempDir/runtimes_visualization.svg. The backbone is based on mobileNet. There are 14 output tensors. The network is not acyclic.
    runtimes_visualization

  3. When I compile manually with ti-processor-sdk-rtos-j721e-evm-08_01_00_13/tidl_j7_08_01_00_05/ti_dl/utils/tidlModelImport/out/tidl_model_import, I was able to compile the model into TIDL bin files.

Is this tool only for small example networks? The manual way (i.e, ./out/tidl_model_import.out ./custom/tidl_import_model.txt) is too cumbersome to setup, so I was going to use this tool.

Here is the onnx model. (I don't need any post-processing.)
debug-b1.zip

I gave these options:

framework: 'MMDetection'
meta_arch_type: 3
meta_layers_names_list: ''
model_path: ''
model_type: 'od'
num_images: 3
od_type: 'SSD'
mean: [0, 0, 0]
std: [1., 1., 1.]
image_size: [512, 256]

How can I compile model having two outputs?

Hi

I want to compile a model having two branches.

The model architecture is below:

Backbone -> FPN -> output1(object detection branch, using NMS), output2 (segmentation branch)

To compile the model, I need to set the values as in the example below.

For example,

스크린샷, 2022-10-12 18-18-55

But, I want to compile different model types such as 'od', and 'seg' at the same time.

Also, Object detection must use the NMS. but, Segmentation does not use NMS.

And, Object detection must have prototxt file. but, Segmentation does not have it.

Compiling the od and seg models separately works without any problems. But we want to share the backbone and get 2 different branch results.

I look forward to your reply.

Thank you.

TIDL-RT for object detection task.

Hi~

According to this README, one can easily reproduce the tidl-rt-based classification demo.
However, now i am trying to deploy an object detection model, which encountered some problem.
I have not changed the cpp file, and build it as the README says. Significantly, i use a od model to replace a classification model like
./bin/Release/tidlrt_clasification -i test_data/airshow.jpg -f model-artifacts/od-ort-ssd-lite_mobilenetv2_fpn -d 1
It gives only little error information:

Model Files names : model-artifacts/od-ort-ssd-lite_mobilenetv2_fpn/boxeslabels_tidl_net.bin,model-artifacts/od-ort-ssd-lite_mobilenetv2_fpn/boxeslabels_tidl_io_1.bin
 0.0s:  VX_ZONE_INIT:Enabled
 0.26s:  VX_ZONE_ERROR:Enabled
 0.29s:  VX_ZONE_WARNING:Enabled
 0.1057s:  VX_ZONE_INIT:[tivxInit:178] Initialization Done !!!
invoked 
Segmentation fault (core dumped)

So wired! Could any please offer any cues about this error?

How to install onnxsim?

How do you install onnxsim in PC emulation environment in order to run the scripts in edgeai-tidl-tools/examples/osrt_python/advanced_examples/unit_tests_validation? I failed to install it by running pip3 install onnxsim. Is there a specific version or a TI custom version of onnxsim required?

Python DLR library prints an import message which breaks the setup script

Issue

When running the setup script, dlr v1.10 is installed. This version prints out an information message when the module is imported in the interpreter:

You acknowledge and agree that DLR collects the following metrics to help improve its performance.
By default, Amazon will collect and store the following information from your device:

record_type: <enum, internal record status, such as model_loaded, model_>,
arch: <string, platform architecture, eg 64bit>,
osname: <string, platform os name, eg. Linux>,
uuid: <string, one-way non-identifable hashed mac address, eg. 8fb35b79f7c7aa2f86afbcb231b1ba6e>,
dist: <string, distribution of os, eg. Ubuntu 16.04 xenial>,
machine: <string, retuns the machine type, eg. x86_64 or i386>,
model: <string, one-way non-identifable hashed model name, eg. 36f613e00f707dbe53a64b1d9625ae7d>

If you wish to opt-out of this data collection feature, please follow the steps below:
1. Disable it with through code:
from dlr.counter.phone_home import PhoneHome
PhoneHome.disable_feature()
2. Or, create a config file, ccm_config.json inside your DLR target directory path, i.e. python3.6/site-packages/dlr/counter/ccm_config.json. Then added below format content in it, {"enable_phone_home" : false}
3. Restart DLR application.
4. Validate this feature is disabled by verifying this notification is no longer displayed, or programmatically with following command:
from dlr.counter.phone_home import PhoneHome
PhoneHome.is_enabled() # false as disabled

This message is seen by the install script, which picks it up at the install location of the library and the following error is generated:

cp: cannot stat 'CALL': No such file or directory
cp: cannot stat 'HOME': No such file or directory
cp: cannot stat 'FEATURE': No such file or directory
cp: cannot stat 'ENABLED': No such file or directory
cp: cannot stat 'You': No such file or directory
cp: cannot stat 'acknowledge': No such file or directory
cp: cannot stat 'and': No such file or directory
cp: cannot stat 'agree': No such file or directory
cp: cannot stat 'that': No such file or directory
cp: cannot stat 'DLR': No such file or directory
cp: cannot stat 'collects': No such file or directory
cp: cannot stat 'the': No such file or directory
cp: cannot stat 'following': No such file or directory
cp: cannot stat 'metrics': No such file or directory
cp: cannot stat 'to': No such file or directory
cp: cannot stat 'help': No such file or directory
cp: cannot stat 'improve': No such file or directory
cp: cannot stat 'its': No such file or directory
cp: cannot stat 'performance.': No such file or directory
cp: cannot stat 'By': No such file or directory
cp: cannot stat 'default,': No such file or directory
cp: cannot stat 'Amazon': No such file or directory
cp: cannot stat 'will': No such file or directory
cp: cannot stat 'collect': No such file or directory
cp: cannot stat 'and': No such file or directory
cp: cannot stat 'store': No such file or directory
cp: cannot stat 'the': No such file or directory
cp: cannot stat 'following': No such file or directory
cp: cannot stat 'information': No such file or directory
cp: cannot stat 'from': No such file or directory
cp: cannot stat 'your': No such file or directory
cp: cannot stat 'device:': No such file or directory
cp: cannot stat 'record_type:': No such file or directory
cp: cannot stat '<enum,': No such file or directory
cp: cannot stat 'internal': No such file or directory
cp: cannot stat 'record': No such file or directory
cp: cannot stat 'status,': No such file or directory
cp: cannot stat 'such': No such file or directory
cp: cannot stat 'as': No such file or directory
cp: cannot stat 'model_loaded,': No such file or directory
cp: cannot stat 'model_>,': No such file or directory
cp: cannot stat 'arch:': No such file or directory
cp: cannot stat '<string,': No such file or directory
cp: cannot stat 'platform': No such file or directory
cp: cannot stat 'architecture,': No such file or directory
cp: cannot stat 'eg': No such file or directory
cp: cannot stat '64bit>,': No such file or directory
cp: cannot stat 'osname:': No such file or directory
cp: cannot stat '<string,': No such file or directory
cp: cannot stat 'platform': No such file or directory
cp: cannot stat 'os': No such file or directory
cp: cannot stat 'name,': No such file or directory
cp: cannot stat 'eg.': No such file or directory
cp: cannot stat 'Linux>,': No such file or directory
cp: cannot stat 'uuid:': No such file or directory
cp: cannot stat '<string,': No such file or directory
cp: cannot stat 'one-way': No such file or directory
cp: cannot stat 'non-identifable': No such file or directory
cp: cannot stat 'hashed': No such file or directory
cp: cannot stat 'mac': No such file or directory
cp: cannot stat 'address,': No such file or directory
cp: cannot stat 'eg.': No such file or directory
cp: cannot stat '8fb35b79f7c7aa2f86afbcb231b1ba6e>,': No such file or directory
cp: cannot stat 'dist:': No such file or directory
cp: cannot stat '<string,': No such file or directory
cp: cannot stat 'distribution': No such file or directory
cp: cannot stat 'of': No such file or directory
cp: cannot stat 'os,': No such file or directory
cp: cannot stat 'eg.': No such file or directory
cp: cannot stat 'Ubuntu': No such file or directory
cp: cannot stat '16.04': No such file or directory
cp: cannot stat 'xenial>,': No such file or directory
cp: cannot stat 'machine:': No such file or directory
cp: cannot stat '<string,': No such file or directory
cp: cannot stat 'retuns': No such file or directory
cp: cannot stat 'the': No such file or directory
cp: cannot stat 'machine': No such file or directory
cp: cannot stat 'type,': No such file or directory
cp: cannot stat 'eg.': No such file or directory
cp: cannot stat 'x86_64': No such file or directory
cp: cannot stat 'or': No such file or directory
cp: cannot stat 'i386>,': No such file or directory
cp: cannot stat 'model:': No such file or directory
cp: cannot stat '<string,': No such file or directory
cp: cannot stat 'one-way': No such file or directory
cp: cannot stat 'non-identifable': No such file or directory
cp: cannot stat 'hashed': No such file or directory
cp: cannot stat 'model': No such file or directory
cp: cannot stat 'name,': No such file or directory
cp: cannot stat 'eg.': No such file or directory
cp: cannot stat '36f613e00f707dbe53a64b1d9625ae7d>': No such file or directory
cp: cannot stat 'If': No such file or directory
cp: cannot stat 'you': No such file or directory
cp: cannot stat 'wish': No such file or directory
cp: cannot stat 'to': No such file or directory
cp: cannot stat 'opt-out': No such file or directory
cp: cannot stat 'of': No such file or directory
cp: cannot stat 'this': No such file or directory
cp: cannot stat 'data': No such file or directory
cp: cannot stat 'collection': No such file or directory
cp: cannot stat 'feature,': No such file or directory
cp: cannot stat 'please': No such file or directory
cp: cannot stat 'follow': No such file or directory
cp: cannot stat 'the': No such file or directory
cp: cannot stat 'steps': No such file or directory
cp: cannot stat 'below:': No such file or directory
cp: cannot stat '1.': No such file or directory
cp: cannot stat 'Disable': No such file or directory
cp: cannot stat 'it': No such file or directory
cp: cannot stat 'with': No such file or directory
cp: cannot stat 'through': No such file or directory
cp: cannot stat 'code:': No such file or directory
cp: cannot stat 'from': No such file or directory
cp: cannot stat 'dlr.counter.phone_home': No such file or directory
cp: cannot stat 'import': No such file or directory
cp: cannot stat 'PhoneHome': No such file or directory
cp: cannot stat 'PhoneHome.disable_feature()': No such file or directory
cp: cannot stat '2.': No such file or directory
cp: cannot stat 'Or,': No such file or directory
cp: cannot stat 'create': No such file or directory
cp: cannot stat 'a': No such file or directory
cp: cannot stat 'config': No such file or directory
cp: cannot stat 'file,': No such file or directory
cp: cannot stat 'ccm_config.json': No such file or directory
cp: cannot stat 'inside': No such file or directory
cp: cannot stat 'your': No such file or directory
cp: cannot stat 'DLR': No such file or directory
cp: cannot stat 'target': No such file or directory
cp: cannot stat 'directory': No such file or directory
cp: cannot stat 'path,': No such file or directory
cp: cannot stat 'i.e.': No such file or directory
cp: cannot stat 'python3.6/site-packages/dlr/counter/ccm_config.json.': No such file or directory
cp: cannot stat 'Then': No such file or directory
cp: cannot stat 'added': No such file or directory
cp: cannot stat 'below': No such file or directory
cp: cannot stat 'format': No such file or directory
cp: cannot stat 'content': No such file or directory
cp: cannot stat 'in': No such file or directory
cp: cannot stat 'it,': No such file or directory
cp: cannot stat '{"enable_phone_home"': No such file or directory
cp: cannot stat ':': No such file or directory
cp: cannot stat 'false}': No such file or directory
cp: cannot stat '3.': No such file or directory
cp: cannot stat 'Restart': No such file or directory
cp: cannot stat 'DLR': No such file or directory
cp: cannot stat 'application.': No such file or directory
cp: cannot stat '4.': No such file or directory
cp: cannot stat 'Validate': No such file or directory
cp: cannot stat 'this': No such file or directory
cp: cannot stat 'feature': No such file or directory
cp: cannot stat 'is': No such file or directory
cp: cannot stat 'disabled': No such file or directory
cp: cannot stat 'by': No such file or directory
cp: cannot stat 'verifying': No such file or directory
cp: cannot stat 'this': No such file or directory
cp: cannot stat 'notification': No such file or directory
cp: cannot stat 'is': No such file or directory
cp: cannot stat 'no': No such file or directory
cp: cannot stat 'longer': No such file or directory
cp: cannot stat 'displayed,': No such file or directory
cp: cannot stat 'or': No such file or directory
cp: cannot stat 'programmatically': No such file or directory
cp: cannot stat 'with': No such file or directory
cp: cannot stat 'following': No such file or directory
cp: cannot stat 'command:': No such file or directory
cp: cannot stat 'from': No such file or directory
cp: cannot stat 'dlr.counter.phone_home': No such file or directory
cp: cannot stat 'import': No such file or directory
cp: cannot stat 'PhoneHome': No such file or directory
cp: cannot stat 'PhoneHome.is_enabled()': No such file or directory
cp: cannot stat '#': No such file or directory
cp: cannot stat 'false': No such file or directory
cp: cannot stat 'as': No such file or directory
cp: cannot stat 'disabled': No such file or directory

This prevents the libdlr.so file from being copied to the appropriate location.

Proposed solution

In the install script, replace

dlr_loc=$(python3  << EOF
import dlr 
print(dlr.__file__)
EOF
)

with

dlr_loc=$(python3 -W ignore -c "import sys,os; sys.stdout = open(os.devnull, 'w'); import dlr; sys.stdout = sys.__stdout__; print(dlr.__file__)")

This solution temporarily blocks printing to stdout while dlr is imported and prevents the import message from being parsed in the install script.

Failed to compile onnx model if use PSDK-RTOS's tidl_tools

SDK_version : ti-processor-sdk-rtos-j721s2-evm-08_05_00_11
TIDL_version : tidl_j721s2_08_05_00_16

I run commands below

export DEVICE=j7
export TIDL_TOOLS_PATH=${PSDKR_PATH}/tidl_j721s2_08_05_00_16/tidl_tools
source ./setup.sh

and all passed. but error occured when I compile the onnx model: resnet18_opset9.onnx

MEM: Init ... !!!
MEM: Init ... Done !!!
 0.0s:  VX_ZONE_INIT:Enabled
 0.2s:  VX_ZONE_ERROR:Enabled
 0.3s:  VX_ZONE_WARNING:Enabled
 0.929s:  VX_ZONE_INIT:[tivxInit:184] Initialization Done !!!
 0.21883s:  VX_ZONE_ERROR:[tivxTIDLValidate:193] 'outArgs' should be a user_data_object of name:
 TIDL_outArgs 
 0.21892s:  VX_ZONE_ERROR:[ownGraphNodeKernelValidate:531] node kernel validate failed for kernel com.ti.tidl:1:1 at index 0
 0.21894s:  VX_ZONE_ERROR:[vxVerifyGraph:1941] Node kernel Validate failed
 0.21895s:  VX_ZONE_ERROR:[vxVerifyGraph:2109] Graph verify failed
TIDL_RT_OVX: ERROR: Verifying TIDL graph ... Failed !!!
TIDL_RT_OVX: ERROR: Verify OpenVX graph failed
 0.22304s:  VX_ZONE_ERROR:[tivxTIDLValidate:193] 'outArgs' should be a user_data_object of name:
 TIDL_outArgs 
 0.22308s:  VX_ZONE_ERROR:[ownGraphNodeKernelValidate:531] node kernel validate failed for kernel com.ti.tidl:1:1 at index 0
 0.22309s:  VX_ZONE_ERROR:[vxVerifyGraph:1941] Node kernel Validate failed
 0.22310s:  VX_ZONE_ERROR:[vxVerifyGraph:2109] Graph verify failed
 0.22330s:  VX_ZONE_ERROR:[ownGraphScheduleGraphWrapper:799] graph is not in a state required to be scheduled
 0.22332s:  VX_ZONE_ERROR:[vxProcessGraph:734] schedule graph failed
 0.22333s:  VX_ZONE_ERROR:[vxProcessGraph:739] wait graph failed
ERROR: Running TIDL graph ... Failed !!!

**********  Frame Index 1 : Running float inference **********
 0.48069s:  VX_ZONE_ERROR:[tivxTIDLValidate:193] 'outArgs' should be a user_data_object of name:
 TIDL_outArgs 
 0.48079s:  VX_ZONE_ERROR:[ownGraphNodeKernelValidate:531] node kernel validate failed for kernel com.ti.tidl:1:1 at index 0
 0.48081s:  VX_ZONE_ERROR:[vxVerifyGraph:1941] Node kernel Validate failed
 0.48082s:  VX_ZONE_ERROR:[vxVerifyGraph:2109] Graph verify failed
 0.48103s:  VX_ZONE_ERROR:[ownGraphScheduleGraphWrapper:799] graph is not in a state required to be scheduled
 0.48104s:  VX_ZONE_ERROR:[vxProcessGraph:734] schedule graph failed
 0.48106s:  VX_ZONE_ERROR:[vxProcessGraph:739] wait graph failed
ERROR: Running TIDL graph ... Failed !!!

**********  Frame Index 2 : Running fixed point mode for calibration **********

~~~~~Running TIDL in PC emulation mode to collect Activations range for each layer~~~~~
...

This error is disappeared if I export TIDL_TOOLS_PATH=${this_repo}/tidl_tools, and run the same python script

MEM: Init ... !!!
MEM: Init ... Done !!!
 0.0s:  VX_ZONE_INIT:Enabled
 0.13s:  VX_ZONE_ERROR:Enabled
 0.14s:  VX_ZONE_WARNING:Enabled
 0.8960s:  VX_ZONE_INIT:[tivxInit:184] Initialization Done !!!

**********  Frame Index 1 : Running float inference **********

**********  Frame Index 2 : Running fixed point mode for calibration **********

What should I do to use ${PSDKR_PATH}/***/tidl_tools to compile onnx model?

segmentation fault (core dumped) - substitute string tidl_net_ not found

When converting model, I got the following error:
------------------ Network Compiler Traces -----------------------------
successful Memory allocation
substitute string tidl_net_ not found
INFORMATION: [TIDL_ResizeLayer] Upsample_54 Any resize ratio which is power of 2 and greater than 4 will be placed by combination of 4x4 resize layer and 2x2 resize layer. For example a 8x8 resize will be replaced by 4x4 resize followed by 2x2 resize.
INFORMATION: [TIDL_ResizeLayer] Upsample_58 Any resize ratio which is power of 2 and greater than 4 will be placed by combination of 4x4 resize layer and 2x2 resize layer. For example a 8x8 resize will be replaced by 4x4 resize followed by 2x2 resize.
INFORMATION: [TIDL_ResizeLayer] Upsample_62 Any resize ratio which is power of 2 and greater than 4 will be placed by combination of 4x4 resize layer and 2x2 resize layer. For example a 8x8 resize will be replaced by 4x4 resize followed by 2x2 resize.


** 3 WARNINGS 0 ERRORS **


[1] 17435 segmentation fault (core dumped) python test.py

And I searched one related post:
https://e2e.ti.com/support/processors-group/processors/f/processors-forum/986167/perfsim-tool-is-stopped-with-segmentationfault

I want to know if the error is caused by Upsample? So I can change my model architecture.
Besides, the Upsample comes from FPN. So I want to know how you solve FPN conversion?

CPP Compiled Failed: cannot find -lonnxruntime

Hi there,

I need to run my model on TDA4VM with CPP APIs (dlr). I write a CPP script for my model,which can be built and run on PC. But that file cannot be built on TDA4, below is the output info:

edgeai

I tried to 2 ways :

  1. copy the libonnxruntime.so from tidl_tools(PC sdk8.0 folder) to /usr/lib (on TDA4)
  2. download tidl_tools.tar.gz in this repo and copy libonnxruntime.so to /usr/lib (on TDA4)

But cannot work, how can I solve this problem?

BTW, I can run my model with CPP API on TDA4VM in this way, but the inference time is two times slower than python API.
so what's the difference between these two methods to run CPP API?

TIDLExecutionProvider Unavailable compiling YOLOv5 Ti Lite ONNX and PROTOTXT

When I run onnxrt_ep.py in osrt_python I get the following error, how do I fix this? Why is TIDL not available?
I am trying to compile my YOLOv5 Ti Lite ONNX and PROTOTXT for use on the Beaglebone AI.

Available execution providers : ['CPUExecutionProvider']

Running 1 Models - ['yolov5s6_640_ti_lite']

Running_Model : yolov5s6_640_ti_lite

/home/mm282681/miniconda3/envs/tidl-tools/lib/python3.6/site-packages/onnxruntime/capi/onnxruntime_inference_collection.py:56: UserWarning: Specified provider 'TIDLExecutionProvider' is not in available provider names.Available providers: 'CPUExecutionProvider'
"Available providers: '{}'".format(name, ", ".join(available_provider_names)))
Process Process-1:
Traceback (most recent call last):
File "/home/mm282681/miniconda3/envs/tidl-tools/lib/python3.6/multiprocessing/process.py", line 258, in _bootstrap
self.run()
File "/home/mm282681/miniconda3/envs/tidl-tools/lib/python3.6/multiprocessing/process.py", line 93, in run
self._target(*self._args, **self._kwargs)
File "onnxrt_ep.py", line 190, in run_model
sess = rt.InferenceSession(config['model_path'] ,providers=EP_list, provider_options=[delegate_options, {}], sess_options=so)
File "/home/mm282681/miniconda3/envs/tidl-tools/lib/python3.6/site-packages/onnxruntime/capi/onnxruntime_inference_collection.py", line 335, in init
self._create_inference_session(providers, provider_options, disabled_optimizers)
File "/home/mm282681/miniconda3/envs/tidl-tools/lib/python3.6/site-packages/onnxruntime/capi/onnxruntime_inference_collection.py", line 379, in _create_inference_session
sess.initialize_session(providers, provider_options, disabled_optimizers)
RuntimeError: Unknown Provider Type: TIDLExecutionProvider

How to control the quantization log

Hi, when running the onnxrt_ep.py for model compilation, I can see the typical model import messages like "Calibration iteration number xxx completed" and "collect Activations range for each layer", but when running the jupyter notebooks for compilation, there are no messages at all, the code snippets are the same, so how can i control the printed messages?

In custom-model-onnx.ipynb, Inferences Per Second of resnet18v2 is only 1.92 fps

Hi, I want to know whether the 'Inferences Per Second' is credible on TDA4VM or just a kind of emulation?
Because I think the fps cannot be so low on board...

Below is the output of notebook:
[0] Indian elephant/Elephas maximus
[1] tusker
[2] African elephant/Loxodonta africana
[3] warthog
[4] water buffalo/water ox/Asiatic buffalo/Bubalus bubalis
res
Statistics :
Inferences Per Second : 1.92 fps
Inference Time Per Image : 521.45 ms
DDR BW Per Image : 0.00 M

Compile pytorch model

I am compiling a onnx model to its compiled artifacts with the following command:
python3 onnxrt_ep_mymodel.py -c
(I did necessary setting for this model)

However, the model compiling does not succeed. The error message "Segmentation fault (core dumped)" is given.
image

Two questions regarding this issue arise:

  1. When the pytorch model is converted to onnx model, should a standard onnxruntime work or do we need to set the target CPU as "CPU-TIDL"?
  2. Is there a limitation to the size of the input data of a model?

Thank you a lot for your attention and help!

Python examples model-compilation failure on PC with Ubuntu-20.04

I setup the edgeai-tidl-tools (tag: 08_03_00_19) with success. But model compilation and model-artifacts creation using python examples is giving issue with below output.

yantrr@yantrr-ulnx-ws6:~/edgeai-tidl-tools$ ./scripts/run_python_examples.sh
X64 Architecture
Running 3 Models - ['cl-tfl-mobilenet_v1_1.0_224', 'ss-tfl-deeplabv3_mnv2_ade20k_float', 'od-tfl-ssd_mobilenet_v2_300_float']


Running_Model :  cl-tfl-mobilenet_v1_1.0_224
Downloading   ../../../models/public/mobilenet_v1_1.0_224.tflite

Running_Model :  ss-tfl-deeplabv3_mnv2_ade20k_float
Downloading   ../../../models/public/deeplabv3_mnv2_ade20k_float.tflite

Running_Model :  od-tfl-ssd_mobilenet_v2_300_float
Downloading   ../../../models/public/ssd_mobilenet_v2_300_float.tflite
/home/yantrr/edgeai-tidl-tools/models/public/deeplabv3_mnv2_ade20k_float.tflite

 Number of subgraphs:1 , 81 nodes delegated out of 81 nodes 
 
Warning : Requested Output Data Convert Layer is not Added to the network, It is currently not Optimal

 ************** Frame index 1 : Running float import ************* 
/home/yantrr/git-repos/edgeai-tidl-tools/tidl_tools/tidl_graphVisualiser.out: error while loading shared libraries: libcgraph.so.6: cannot open shared object file: No such file or directory
INFORMATION: [TIDL_ResizeLayer] ResizeBilinear_TIDL_0 Any resize ratio which is power of 2 and greater than 4 will be placed by combination of 4x4 resize layer and 2x2 resize layer. For example a 8x8 resize will be replaced by 4x4 resize followed by 2x2 resize.
INFORMATION: [TIDL_ResizeLayer] ResizeBilinear_TIDL_1 Any resize ratio which is power of 2 and greater than 4 will be placed by combination of 4x4 resize layer and 2x2 resize layer. For example a 8x8 resize will be replaced by 4x4 resize followed by 2x2 resize.
INFORMATION: [TIDL_ResizeLayer] ResizeBilinear Any resize ratio which is power of 2 and greater than 4 will be placed by combination of 4x4 resize layer and 2x2 resize layer. For example a 8x8 resize will be replaced by 4x4 resize followed by 2x2 resize.
INFORMATION: [TIDL_ResizeLayer] decoder/ResizeBilinear Any resize ratio which is power of 2 and greater than 4 will be placed by combination of 4x4 resize layer and 2x2 resize layer. For example a 8x8 resize will be replaced by 4x4 resize followed by 2x2 resize.
INFORMATION: [TIDL_ResizeLayer] ResizeBilinear_1 Any resize ratio which is power of 2 and greater than 4 will be placed by combination of 4x4 resize layer and 2x2 resize layer. For example a 8x8 resize will be replaced by 4x4 resize followed by 2x2 resize.
WARNING: [TIDL_E_DATAFLOW_INFO_NULL] ti_cnnperfsim.out fails to allocate memory in MSMC. Please look into perfsim log. This model can only be used on PC emulation, it will get fault on target.
****************************************************
**          6 WARNINGS          0 ERRORS          **
****************************************************
 0.0s:  VX_ZONE_INIT:Enabled
 0.4s:  VX_ZONE_ERROR:Enabled
 0.5s:  VX_ZONE_WARNING:Enabled
 0.618s:  VX_ZONE_INIT:[tivxInit:178] Initialization Done !!!
/home/yantrr/edgeai-tidl-tools/models/public/mobilenet_v1_1.0_224.tflite

 Number of subgraphs:1 , 34 nodes delegated out of 34 nodes 
 
Warning : Requested Output Data Convert Layer is not Added to the network, It is currently not Optimal

 ************** Frame index 1 : Running float import ************* 
/home/yantrr/git-repos/edgeai-tidl-tools/tidl_tools/tidl_graphVisualiser.out: error while loading shared libraries: libcgraph.so.6: cannot open shared object file: No such file or directory
WARNING: [TIDL_E_DATAFLOW_INFO_NULL] ti_cnnperfsim.out fails to allocate memory in MSMC. Please look into perfsim log. This model can only be used on PC emulation, it will get fault on target.
****************************************************
**          1 WARNINGS          0 ERRORS          **
****************************************************
 0.0s:  VX_ZONE_INIT:Enabled
 0.7s:  VX_ZONE_ERROR:Enabled
 0.8s:  VX_ZONE_WARNING:Enabled
 0.355s:  VX_ZONE_INIT:[tivxInit:178] Initialization Done !!!

 ************ Frame index 1 : Running float inference **************** 
Process Process-1:
Traceback (most recent call last):
  File "/usr/lib/python3.8/multiprocessing/process.py", line 315, in _bootstrap
    self.run()
  File "/usr/lib/python3.8/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "tflrt_delegate.py", line 179, in run_model
    imgs, output, proc_time, sub_graph_time, ddr_write, ddr_read, new_height, new_width  = infer_image(interpreter, input_images, config)
  File "tflrt_delegate.py", line 109, in infer_image
    copy_time, proc_time, sub_graphs_proc_time, ddr_write, ddr_read  = get_benchmark_output(interpreter)
  File "tflrt_delegate.py", line 50, in get_benchmark_output
    benchmark_dict = interpreter.get_TI_benchmark_data()
AttributeError: 'Interpreter' object has no attribute 'get_TI_benchmark_data'

 ************ Frame index 1 : Running float inference **************** 
Process Process-2:
Traceback (most recent call last):
  File "/usr/lib/python3.8/multiprocessing/process.py", line 315, in _bootstrap
    self.run()
  File "/usr/lib/python3.8/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "tflrt_delegate.py", line 179, in run_model
    imgs, output, proc_time, sub_graph_time, ddr_write, ddr_read, new_height, new_width  = infer_image(interpreter, input_images, config)
  File "tflrt_delegate.py", line 109, in infer_image
    copy_time, proc_time, sub_graphs_proc_time, ddr_write, ddr_read  = get_benchmark_output(interpreter)
  File "tflrt_delegate.py", line 50, in get_benchmark_output
    benchmark_dict = interpreter.get_TI_benchmark_data()
AttributeError: 'Interpreter' object has no attribute 'get_TI_benchmark_data'
/home/yantrr/edgeai-tidl-tools/models/public/ssd_mobilenet_v2_300_float.tflite
TIDL Meta PipeLine (Proto) File  :   

Number of OD backbone nodes = 0 
Size of odBackboneNodeIds = 0 
Warning : concat requires 4D input tensors - only 3 dims present..  Ignore if object detection network

 Number of subgraphs:1 , 107 nodes delegated out of 107 nodes 
 
Warning : concat requires 4D input tensors - only 3 dims present..  Ignore if object detection network
WARNING: Batch Norm Layer scale_logits's coeff cannot be found(or not match) in coef file, Random bias will be generated! Only for evaluation usage! Results are all random!
Warning : Requested Output Data Convert Layer is not Added to the network, It is currently not Optimal
Warning : Requested Output Data Convert Layer is not Added to the network, It is currently not Optimal
Warning : Requested Output Data Convert Layer is not Added to the network, It is currently not Optimal
Warning : Requested Output Data Convert Layer is not Added to the network, It is currently not Optimal

 ************** Frame index 1 : Running float import ************* 
/home/yantrr/git-repos/edgeai-tidl-tools/tidl_tools/tidl_graphVisualiser.out: error while loading shared libraries: libcgraph.so.6: cannot open shared object file: No such file or directory
WARNING: [TIDL_E_DATAFLOW_INFO_NULL] ti_cnnperfsim.out fails to allocate memory in MSMC. Please look into perfsim log. This model can only be used on PC emulation, it will get fault on target.
****************************************************
**          1 WARNINGS          0 ERRORS          **
****************************************************
 0.0s:  VX_ZONE_INIT:Enabled
 0.9s:  VX_ZONE_ERROR:Enabled
 0.10s:  VX_ZONE_WARNING:Enabled
 0.351s:  VX_ZONE_INIT:[tivxInit:178] Initialization Done !!!

 ************ Frame index 1 : Running float inference **************** 
Process Process-3:
Traceback (most recent call last):
  File "/usr/lib/python3.8/multiprocessing/process.py", line 315, in _bootstrap
    self.run()
  File "/usr/lib/python3.8/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "tflrt_delegate.py", line 179, in run_model
    imgs, output, proc_time, sub_graph_time, ddr_write, ddr_read, new_height, new_width  = infer_image(interpreter, input_images, config)
  File "tflrt_delegate.py", line 109, in infer_image
    copy_time, proc_time, sub_graphs_proc_time, ddr_write, ddr_read  = get_benchmark_output(interpreter)
  File "tflrt_delegate.py", line 50, in get_benchmark_output
    benchmark_dict = interpreter.get_TI_benchmark_data()
AttributeError: 'Interpreter' object has no attribute 'get_TI_benchmark_data'
^CTraceback (most recent call last):
  File "tflrt_delegate.py", line 247, in <module>
    nthreads = join_one(nthreads)
  File "tflrt_delegate.py", line 229, in join_one
    sem.acquire()
KeyboardInterrupt

yantrr@yantrr-ulnx-ws6:~/edgeai-tidl-tools$

What would be the problem here? How to resolve this issue?

Testing on x86_64 to port to AARCH_64

Hello,

Is there a way to build this repo easily? I have tried w/ building it in many, different ways, e.g. make, cmake, w/ build dirs, and w/ docker.

I am not making any headway. The https://github.com/TexasInstruments/edgeai-tidl-tools/tree/master/dockers/dependency_build files here are not working or have been moved.

Seth

P.S. I do not know if people are still interested in these libs. but I have been trying over the course of two months to build them. I have been highly unsuccessful so far. I need hints or ideas at most. Send guidance.

Unable to benchmark compiled models on SoC

SoC = am68a
Tag used: 08_06_00_03

I have followed the steps mentioned in the Readme file to compile the model and generate binaries. While following the instructions to benchmark the model on SoC, I ran the following command:
cmake ../examples && make -j && cd ..

This leads to the following issue:
image

I also noticed that the folder tidl_tools is also missing on the SoC where the file is located (checked this on x86_64 PC).

Whether TDA4VM's DSP supports 3D convolution

Hi

I tested my onnx pose model inference speed on the TDA4VM board, which has generated artifacts files using edgeai-tidl-tools tools.

I found that the inference speed of the CPU and DSP on the board was similar, about 1.4 seconds, but other models I tested would have about 70 to 90 times the inference speed of the CPU in the DSP.

I observed the differences between my pose model and other models and found that my model uses 3D convolution, and other models use 2D convolution. Is my model infering slow because of 3D convolution or not?

BTW, I want to know, which operators are supported by the DSP of the TDA4VM board now? And does the DSP support transformer operator calculation?

And my model is shown as below:
pose

Thanks!!!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.