EDGE-AI-STUDIO: Model compiling using edgeai-tidl-tools

Part Number: EDGE-AI-STUDIO

Tool/software:

Hello Engineer,

I am trying to do compile the trained model using pytorch, after the training generated a 6.1 MB binary .onnx file. I got the resources for compile the model. But didn't get a clarity from that. 
Steps I did:
1. Splitted the dataset into train and val.
2. Wrote a code for training that the dataset will fed into it.
3. Contains the code for export the .pth to .onnx 
4. cloned edgeai-tidl-tools
5. checkout the branch 10_01_04_00 ( Using SDK 10.01)
6. export SOC=am62a
7. source ./setup.sh
8. opened a new terminal tab the $ source ./setup_env.sh $am62a
9. created a directory named model added the .onnx file there
10. created a dictionary in examples/osrt_python/model_configs.py 
      

    "cl-ort-my_model": create_model_config(
        task_type="classification",
        source=dict(
            model_path="../../models/my_model.onnx",
        ),
        preprocess=dict(
            resize=256,
            crop=224,
            data_layout="NCHW",
            resize_with_pad=False,
            reverse_channels=False,
        ),
        session=dict(
            session_name="onnxrt",
            model_path=os.path.join(models_base_path, "my_model.onnx"),
            input_mean=[0.0, 0.0, 0.0],
            input_scale=[1.0, 1.0, 1.0],
            input_optimization=True,
            input_details={"input": [1, 3, 224, 224]},
            output_details={"output": [1, 6]},
        ),
        extra_info=dict(
            num_images=numImages,
            num_classes=6,
        )
    ),


      and models_base_path = '../../../models/'
11. python3 onnxrt_ep.py -c -m cl-ort-dms_model
      Error is below:
      
Available execution providers :  ['AzureExecutionProvider', 'CPUExecutionProvider']

Running 1 Models - ['cl-ort-my_model']


Running_Model :  cl-ort-my_model  


Running shape inference on model ../../../models/my_model.onnx 

/home/user/.local/lib/python3.10/site-packages/onnxruntime/capi/onnxruntime_inference_collection.py:121: UserWarning: Specified provider 'TIDLCompilationProvider' is not in available provider names.Available providers: 'AzureExecutionProvider, CPUExecutionProvider'
  warnings.warn(
*************** EP Error ***************
EP Error Unknown Provider Type: TIDLCompilationProvider when using ['TIDLCompilationProvider', 'CPUExecutionProvider']
Falling back to ['CPUExecutionProvider'] and retrying.
****************************************
Process Process-1:
Traceback (most recent call last):
  File "/usr/lib/python3.10/multiprocessing/process.py", line 314, in _bootstrap
    self.run()
  File "/usr/lib/python3.10/multiprocessing/process.py", line 108, in run
    self._target(*self._args, **self._kwargs)
  File "/home/user/edgeai-tidl-tools/examples/osrt_python/ort/onnxrt_ep.py", line 388, in run_model
    for j in range(batch):
TypeError: 'str' object cannot be interpreted as an integer


Can you please check and verify the steps I followed. Help me to fix the error. Anything else I need to modify to compile the model

Warm Regards,
Sajan

  • One more question should I change the code in onnxrt_ep.py
    Like

    calib_images = [
        "../../../test_data/airshow.jpg",
        "../../../test_data/ADE_val_00001801.jpg",
    ]
    class_test_images = ["../../../test_data/airshow.jpg"]
    od_test_images = ["../../../test_data/ADE_val_00001801.jpg"]
    seg_test_images = ["../../../test_data/ADE_val_00001801.jpg"]
    

    If yes, should I add some random images from dataset to this path. Anything to change in this python code

  • Hello,

    Can you please help me. Now trying docker approach.

    And the update is below log.

    /home/root/examples/osrt_python/ort# python3 onnxrt_ep.py -c -m cl-ort-my_model
    Available execution providers :  ['TIDLExecutionProvider', 'TIDLCompilationProvider', 'CPUExecutionProvider']
    
    Running 1 Models - ['cl-ort-my_model']
    
    
    Running_Model :  cl-ort-my_model  
    
    
    Running shape inference on model ../../models/my_model.onnx 
    
    ========================= [Model Compilation Started] =========================
    
    Model compilation will perform the following stages:
    1. Parsing
    2. Graph Optimization
    3. Quantization & Calibration
    4. Memory Planning
    
    ============================== [Version Summary] ==============================
    
    -------------------------------------------------------------------------------
    |          TIDL Tools Version          |              10_01_04_00             |
    -------------------------------------------------------------------------------
    |         C7x Firmware Version         |              10_01_00_01             |
    -------------------------------------------------------------------------------
    |            Runtime Version           |                1.15.0                |
    -------------------------------------------------------------------------------
    |          Model Opset Version         |                  12                  |
    -------------------------------------------------------------------------------
    
    ============================== [Parsing Started] ==============================
    
    [TIDL Import] [PARSER] WARNING: Network not identified as Object Detection network : (1) Ignore if network is not Object Detection network (2) If network is Object Detection network, please specify "model_type":"OD" as part of OSRT compilation options
    
    ------------------------- Subgraph Information Summary -------------------------
    -------------------------------------------------------------------------------
    |          Core           |      No. of Nodes       |   Number of Subgraphs   |
    -------------------------------------------------------------------------------
    | C7x                     |                       0 |                       0 |
    | CPU                     |                     141 |                       x |
    -------------------------------------------------------------------------------
    --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    |       Node        |                             Node Name                            |                                        Reason                                         |
    --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    | Conv              | /features/features.0/features.0.0/Conv                           | Layer 0 - op type Conv, Unknown input dimension, not supported by TIDL                |
    | HardSigmoid       | /features/features.0/features.0.2/HardSigmoid                    | Layer 1 - op type HardSigmoid, Unknown input dimension, not supported by TIDL         |
    | Mul               | /features/features.0/features.0.2/Mul                            | Layer 2 - op type Mul, Unknown input dimension, not supported by TIDL                 |
    | Conv              | /features/features.1/block/block.0/block.0.0/Conv                | Layer 3 - op type Conv, Unknown input dimension, not supported by TIDL                |
    | Relu              | /features/features.1/block/block.0/block.0.2/Relu                | Layer 4 - op type Relu, Unknown input dimension, not supported by TIDL                |
    | GlobalAveragePool | /features/features.1/block/block.1/avgpool/GlobalAveragePool     | Layer 5 - op type GlobalAveragePool, Unknown input dimension, not supported by TIDL   |
    | Conv              | /features/features.1/block/block.1/fc1/Conv                      | Layer 6 - op type Conv, Unknown input dimension, not supported by TIDL                |
    | Relu              | /features/features.1/block/block.1/activation/Relu               | Layer 7 - op type Relu, Unknown input dimension, not supported by TIDL                |
    | Conv              | /features/features.1/block/block.1/fc2/Conv                      | Layer 8 - op type Conv, Unknown input dimension, not supported by TIDL                |
    | HardSigmoid       | /features/features.1/block/block.1/scale_activation/HardSigmoid  | Layer 9 - op type HardSigmoid, Unknown input dimension, not supported by TIDL         |
    | Mul               | /features/features.1/block/block.1/Mul                           | Layer 10 - op type Mul, Unknown input dimension, not supported by TIDL                |
    | Conv              | /features/features.1/block/block.2/block.2.0/Conv                | Layer 11 - op type Conv, Unknown input dimension, not supported by TIDL               |
    | Conv              | /features/features.2/block/block.0/block.0.0/Conv                | Layer 12 - op type Conv, Unknown input dimension, not supported by TIDL               |
    | Relu              | /features/features.2/block/block.0/block.0.2/Relu                | Layer 13 - op type Relu, Unknown input dimension, not supported by TIDL               |
    | Conv              | /features/features.2/block/block.1/block.1.0/Conv                | Layer 14 - op type Conv, Unknown input dimension, not supported by TIDL               |
    | Relu              | /features/features.2/block/block.1/block.1.2/Relu                | Layer 15 - op type Relu, Unknown input dimension, not supported by TIDL               |
    | Conv              | /features/features.2/block/block.2/block.2.0/Conv                | Layer 16 - op type Conv, Unknown input dimension, not supported by TIDL               |
    | Conv              | /features/features.3/block/block.0/block.0.0/Conv                | Layer 17 - op type Conv, Unknown input dimension, not supported by TIDL               |
    | Relu              | /features/features.3/block/block.0/block.0.2/Relu                | Layer 18 - op type Relu, Unknown input dimension, not supported by TIDL               |
    | Conv              | /features/features.3/block/block.1/block.1.0/Conv                | Layer 19 - op type Conv, Unknown input dimension, not supported by TIDL               |
    | Relu              | /features/features.3/block/block.1/block.1.2/Relu                | Layer 20 - op type Relu, Unknown input dimension, not supported by TIDL               |
    | Conv              | /features/features.3/block/block.2/block.2.0/Conv                | Layer 21 - op type Conv, Unknown input dimension, not supported by TIDL               |
    | Add               | /features/features.3/Add                                         | Layer 22 - op type Add, Unknown input dimension, not supported by TIDL                |
    | Conv              | /features/features.4/block/block.0/block.0.0/Conv                | Layer 23 - op type Conv, Unknown input dimension, not supported by TIDL               |
    | HardSigmoid       | /features/features.4/block/block.0/block.0.2/HardSigmoid         | Layer 24 - op type HardSigmoid, Unknown input dimension, not supported by TIDL        |
    | Mul               | /features/features.4/block/block.0/block.0.2/Mul                 | Layer 25 - op type Mul, Unknown input dimension, not supported by TIDL                |
    | Conv              | /features/features.4/block/block.1/block.1.0/Conv                | Layer 26 - op type Conv, Unknown input dimension, not supported by TIDL               |
    | HardSigmoid       | /features/features.4/block/block.1/block.1.2/HardSigmoid         | Layer 27 - op type HardSigmoid, Unknown input dimension, not supported by TIDL        |
    | Mul               | /features/features.4/block/block.1/block.1.2/Mul                 | Layer 28 - op type Mul, Unknown input dimension, not supported by TIDL                |
    | GlobalAveragePool | /features/features.4/block/block.2/avgpool/GlobalAveragePool     | Layer 29 - op type GlobalAveragePool, Unknown input dimension, not supported by TIDL  |
    | Conv              | /features/features.4/block/block.2/fc1/Conv                      | Layer 30 - op type Conv, Unknown input dimension, not supported by TIDL               |
    | Relu              | /features/features.4/block/block.2/activation/Relu               | Layer 31 - op type Relu, Unknown input dimension, not supported by TIDL               |
    | Conv              | /features/features.4/block/block.2/fc2/Conv                      | Layer 32 - op type Conv, Unknown input dimension, not supported by TIDL               |
    | HardSigmoid       | /features/features.4/block/block.2/scale_activation/HardSigmoid  | Layer 33 - op type HardSigmoid, Unknown input dimension, not supported by TIDL        |
    | Mul               | /features/features.4/block/block.2/Mul                           | Layer 34 - op type Mul, Unknown input dimension, not supported by TIDL                |
    | Conv              | /features/features.4/block/block.3/block.3.0/Conv                | Layer 35 - op type Conv, Unknown input dimension, not supported by TIDL               |
    | Conv              | /features/features.5/block/block.0/block.0.0/Conv                | Layer 36 - op type Conv, Unknown input dimension, not supported by TIDL               |
    | HardSigmoid       | /features/features.5/block/block.0/block.0.2/HardSigmoid         | Layer 37 - op type HardSigmoid, Unknown input dimension, not supported by TIDL        |
    | Mul               | /features/features.5/block/block.0/block.0.2/Mul                 | Layer 38 - op type Mul, Unknown input dimension, not supported by TIDL                |
    | Conv              | /features/features.5/block/block.1/block.1.0/Conv                | Layer 39 - op type Conv, Unknown input dimension, not supported by TIDL               |
    | HardSigmoid       | /features/features.5/block/block.1/block.1.2/HardSigmoid         | Layer 40 - op type HardSigmoid, Unknown input dimension, not supported by TIDL        |
    | Mul               | /features/features.5/block/block.1/block.1.2/Mul                 | Layer 41 - op type Mul, Unknown input dimension, not supported by TIDL                |
    | GlobalAveragePool | /features/features.5/block/block.2/avgpool/GlobalAveragePool     | Layer 42 - op type GlobalAveragePool, Unknown input dimension, not supported by TIDL  |
    | Conv              | /features/features.5/block/block.2/fc1/Conv                      | Layer 43 - op type Conv, Unknown input dimension, not supported by TIDL               |
    | Relu              | /features/features.5/block/block.2/activation/Relu               | Layer 44 - op type Relu, Unknown input dimension, not supported by TIDL               |
    | Conv              | /features/features.5/block/block.2/fc2/Conv                      | Layer 45 - op type Conv, Unknown input dimension, not supported by TIDL               |
    | HardSigmoid       | /features/features.5/block/block.2/scale_activation/HardSigmoid  | Layer 46 - op type HardSigmoid, Unknown input dimension, not supported by TIDL        |
    | Mul               | /features/features.5/block/block.2/Mul                           | Layer 47 - op type Mul, Unknown input dimension, not supported by TIDL                |
    | Conv              | /features/features.5/block/block.3/block.3.0/Conv                | Layer 48 - op type Conv, Unknown input dimension, not supported by TIDL               |
    | Add               | /features/features.5/Add                                         | Layer 49 - op type Add, Unknown input dimension, not supported by TIDL                |
    | Conv              | /features/features.6/block/block.0/block.0.0/Conv                | Layer 50 - op type Conv, Unknown input dimension, not supported by TIDL               |
    | HardSigmoid       | /features/features.6/block/block.0/block.0.2/HardSigmoid         | Layer 51 - op type HardSigmoid, Unknown input dimension, not supported by TIDL        |
    | Mul               | /features/features.6/block/block.0/block.0.2/Mul                 | Layer 52 - op type Mul, Unknown input dimension, not supported by TIDL                |
    | Conv              | /features/features.6/block/block.1/block.1.0/Conv                | Layer 53 - op type Conv, Unknown input dimension, not supported by TIDL               |
    | HardSigmoid       | /features/features.6/block/block.1/block.1.2/HardSigmoid         | Layer 54 - op type HardSigmoid, Unknown input dimension, not supported by TIDL        |
    | Mul               | /features/features.6/block/block.1/block.1.2/Mul                 | Layer 55 - op type Mul, Unknown input dimension, not supported by TIDL                |
    | GlobalAveragePool | /features/features.6/block/block.2/avgpool/GlobalAveragePool     | Layer 56 - op type GlobalAveragePool, Unknown input dimension, not supported by TIDL  |
    | Conv              | /features/features.6/block/block.2/fc1/Conv                      | Layer 57 - op type Conv, Unknown input dimension, not supported by TIDL               |
    | Relu              | /features/features.6/block/block.2/activation/Relu               | Layer 58 - op type Relu, Unknown input dimension, not supported by TIDL               |
    | Conv              | /features/features.6/block/block.2/fc2/Conv                      | Layer 59 - op type Conv, Unknown input dimension, not supported by TIDL               |
    | HardSigmoid       | /features/features.6/block/block.2/scale_activation/HardSigmoid  | Layer 60 - op type HardSigmoid, Unknown input dimension, not supported by TIDL        |
    | Mul               | /features/features.6/block/block.2/Mul                           | Layer 61 - op type Mul, Unknown input dimension, not supported by TIDL                |
    | Conv              | /features/features.6/block/block.3/block.3.0/Conv                | Layer 62 - op type Conv, Unknown input dimension, not supported by TIDL               |
    | Add               | /features/features.6/Add                                         | Layer 63 - op type Add, Unknown input dimension, not supported by TIDL                |
    | Conv              | /features/features.7/block/block.0/block.0.0/Conv                | Layer 64 - op type Conv, Unknown input dimension, not supported by TIDL               |
    | HardSigmoid       | /features/features.7/block/block.0/block.0.2/HardSigmoid         | Layer 65 - op type HardSigmoid, Unknown input dimension, not supported by TIDL        |
    | Mul               | /features/features.7/block/block.0/block.0.2/Mul                 | Layer 66 - op type Mul, Unknown input dimension, not supported by TIDL                |
    | Conv              | /features/features.7/block/block.1/block.1.0/Conv                | Layer 67 - op type Conv, Unknown input dimension, not supported by TIDL               |
    | HardSigmoid       | /features/features.7/block/block.1/block.1.2/HardSigmoid         | Layer 68 - op type HardSigmoid, Unknown input dimension, not supported by TIDL        |
    | Mul               | /features/features.7/block/block.1/block.1.2/Mul                 | Layer 69 - op type Mul, Unknown input dimension, not supported by TIDL                |
    | GlobalAveragePool | /features/features.7/block/block.2/avgpool/GlobalAveragePool     | Layer 70 - op type GlobalAveragePool, Unknown input dimension, not supported by TIDL  |
    | Conv              | /features/features.7/block/block.2/fc1/Conv                      | Layer 71 - op type Conv, Unknown input dimension, not supported by TIDL               |
    | Relu              | /features/features.7/block/block.2/activation/Relu               | Layer 72 - op type Relu, Unknown input dimension, not supported by TIDL               |
    | Conv              | /features/features.7/block/block.2/fc2/Conv                      | Layer 73 - op type Conv, Unknown input dimension, not supported by TIDL               |
    | HardSigmoid       | /features/features.7/block/block.2/scale_activation/HardSigmoid  | Layer 74 - op type HardSigmoid, Unknown input dimension, not supported by TIDL        |
    | Mul               | /features/features.7/block/block.2/Mul                           | Layer 75 - op type Mul, Unknown input dimension, not supported by TIDL                |
    | Conv              | /features/features.7/block/block.3/block.3.0/Conv                | Layer 76 - op type Conv, Unknown input dimension, not supported by TIDL               |
    | Conv              | /features/features.8/block/block.0/block.0.0/Conv                | Layer 77 - op type Conv, Unknown input dimension, not supported by TIDL               |
    | HardSigmoid       | /features/features.8/block/block.0/block.0.2/HardSigmoid         | Layer 78 - op type HardSigmoid, Unknown input dimension, not supported by TIDL        |
    | Mul               | /features/features.8/block/block.0/block.0.2/Mul                 | Layer 79 - op type Mul, Unknown input dimension, not supported by TIDL                |
    | Conv              | /features/features.8/block/block.1/block.1.0/Conv                | Layer 80 - op type Conv, Unknown input dimension, not supported by TIDL               |
    | HardSigmoid       | /features/features.8/block/block.1/block.1.2/HardSigmoid         | Layer 81 - op type HardSigmoid, Unknown input dimension, not supported by TIDL        |
    | Mul               | /features/features.8/block/block.1/block.1.2/Mul                 | Layer 82 - op type Mul, Unknown input dimension, not supported by TIDL                |
    | GlobalAveragePool | /features/features.8/block/block.2/avgpool/GlobalAveragePool     | Layer 83 - op type GlobalAveragePool, Unknown input dimension, not supported by TIDL  |
    | Conv              | /features/features.8/block/block.2/fc1/Conv                      | Layer 84 - op type Conv, Unknown input dimension, not supported by TIDL               |
    | Relu              | /features/features.8/block/block.2/activation/Relu               | Layer 85 - op type Relu, Unknown input dimension, not supported by TIDL               |
    | Conv              | /features/features.8/block/block.2/fc2/Conv                      | Layer 86 - op type Conv, Unknown input dimension, not supported by TIDL               |
    | HardSigmoid       | /features/features.8/block/block.2/scale_activation/HardSigmoid  | Layer 87 - op type HardSigmoid, Unknown input dimension, not supported by TIDL        |
    | Mul               | /features/features.8/block/block.2/Mul                           | Layer 88 - op type Mul, Unknown input dimension, not supported by TIDL                |
    | Conv              | /features/features.8/block/block.3/block.3.0/Conv                | Layer 89 - op type Conv, Unknown input dimension, not supported by TIDL               |
    | Add               | /features/features.8/Add                                         | Layer 90 - op type Add, Unknown input dimension, not supported by TIDL                |
    | Conv              | /features/features.9/block/block.0/block.0.0/Conv                | Layer 91 - op type Conv, Unknown input dimension, not supported by TIDL               |
    | HardSigmoid       | /features/features.9/block/block.0/block.0.2/HardSigmoid         | Layer 92 - op type HardSigmoid, Unknown input dimension, not supported by TIDL        |
    | Mul               | /features/features.9/block/block.0/block.0.2/Mul                 | Layer 93 - op type Mul, Unknown input dimension, not supported by TIDL                |
    | Conv              | /features/features.9/block/block.1/block.1.0/Conv                | Layer 94 - op type Conv, Unknown input dimension, not supported by TIDL               |
    | HardSigmoid       | /features/features.9/block/block.1/block.1.2/HardSigmoid         | Layer 95 - op type HardSigmoid, Unknown input dimension, not supported by TIDL        |
    | Mul               | /features/features.9/block/block.1/block.1.2/Mul                 | Layer 96 - op type Mul, Unknown input dimension, not supported by TIDL                |
    | GlobalAveragePool | /features/features.9/block/block.2/avgpool/GlobalAveragePool     | Layer 97 - op type GlobalAveragePool, Unknown input dimension, not supported by TIDL  |
    | Conv              | /features/features.9/block/block.2/fc1/Conv                      | Layer 98 - op type Conv, Unknown input dimension, not supported by TIDL               |
    | Relu              | /features/features.9/block/block.2/activation/Relu               | Layer 99 - op type Relu, Unknown input dimension, not supported by TIDL               |
    | Conv              | /features/features.9/block/block.2/fc2/Conv                      | Layer 100 - op type Conv, Unknown input dimension, not supported by TIDL              |
    | HardSigmoid       | /features/features.9/block/block.2/scale_activation/HardSigmoid  | Layer 101 - op type HardSigmoid, Unknown input dimension, not supported by TIDL       |
    | Mul               | /features/features.9/block/block.2/Mul                           | Layer 102 - op type Mul, Unknown input dimension, not supported by TIDL               |
    | Conv              | /features/features.9/block/block.3/block.3.0/Conv                | Layer 103 - op type Conv, Unknown input dimension, not supported by TIDL              |
    | Conv              | /features/features.10/block/block.0/block.0.0/Conv               | Layer 104 - op type Conv, Unknown input dimension, not supported by TIDL              |
    | HardSigmoid       | /features/features.10/block/block.0/block.0.2/HardSigmoid        | Layer 105 - op type HardSigmoid, Unknown input dimension, not supported by TIDL       |
    | Mul               | /features/features.10/block/block.0/block.0.2/Mul                | Layer 106 - op type Mul, Unknown input dimension, not supported by TIDL               |
    | Conv              | /features/features.10/block/block.1/block.1.0/Conv               | Layer 107 - op type Conv, Unknown input dimension, not supported by TIDL              |
    | HardSigmoid       | /features/features.10/block/block.1/block.1.2/HardSigmoid        | Layer 108 - op type HardSigmoid, Unknown input dimension, not supported by TIDL       |
    | Mul               | /features/features.10/block/block.1/block.1.2/Mul                | Layer 109 - op type Mul, Unknown input dimension, not supported by TIDL               |
    | GlobalAveragePool | /features/features.10/block/block.2/avgpool/GlobalAveragePool    | Layer 110 - op type GlobalAveragePool, Unknown input dimension, not supported by TIDL |
    | Conv              | /features/features.10/block/block.2/fc1/Conv                     | Layer 111 - op type Conv, Unknown input dimension, not supported by TIDL              |
    | Relu              | /features/features.10/block/block.2/activation/Relu              | Layer 112 - op type Relu, Unknown input dimension, not supported by TIDL              |
    | Conv              | /features/features.10/block/block.2/fc2/Conv                     | Layer 113 - op type Conv, Unknown input dimension, not supported by TIDL              |
    | HardSigmoid       | /features/features.10/block/block.2/scale_activation/HardSigmoid | Layer 114 - op type HardSigmoid, Unknown input dimension, not supported by TIDL       |
    | Mul               | /features/features.10/block/block.2/Mul                          | Layer 115 - op type Mul, Unknown input dimension, not supported by TIDL               |
    | Conv              | /features/features.10/block/block.3/block.3.0/Conv               | Layer 116 - op type Conv, Unknown input dimension, not supported by TIDL              |
    | Add               | /features/features.10/Add                                        | Layer 117 - op type Add, Unknown input dimension, not supported by TIDL               |
    | Conv              | /features/features.11/block/block.0/block.0.0/Conv               | Layer 118 - op type Conv, Unknown input dimension, not supported by TIDL              |
    | HardSigmoid       | /features/features.11/block/block.0/block.0.2/HardSigmoid        | Layer 119 - op type HardSigmoid, Unknown input dimension, not supported by TIDL       |
    | Mul               | /features/features.11/block/block.0/block.0.2/Mul                | Layer 120 - op type Mul, Unknown input dimension, not supported by TIDL               |
    | Conv              | /features/features.11/block/block.1/block.1.0/Conv               | Layer 121 - op type Conv, Unknown input dimension, not supported by TIDL              |
    | HardSigmoid       | /features/features.11/block/block.1/block.1.2/HardSigmoid        | Layer 122 - op type HardSigmoid, Unknown input dimension, not supported by TIDL       |
    | Mul               | /features/features.11/block/block.1/block.1.2/Mul                | Layer 123 - op type Mul, Unknown input dimension, not supported by TIDL               |
    | GlobalAveragePool | /features/features.11/block/block.2/avgpool/GlobalAveragePool    | Layer 124 - op type GlobalAveragePool, Unknown input dimension, not supported by TIDL |
    | Conv              | /features/features.11/block/block.2/fc1/Conv                     | Layer 125 - op type Conv, Unknown input dimension, not supported by TIDL              |
    | Relu              | /features/features.11/block/block.2/activation/Relu              | Layer 126 - op type Relu, Unknown input dimension, not supported by TIDL              |
    | Conv              | /features/features.11/block/block.2/fc2/Conv                     | Layer 127 - op type Conv, Unknown input dimension, not supported by TIDL              |
    | HardSigmoid       | /features/features.11/block/block.2/scale_activation/HardSigmoid | Layer 128 - op type HardSigmoid, Unknown input dimension, not supported by TIDL       |
    | Mul               | /features/features.11/block/block.2/Mul                          | Layer 129 - op type Mul, Unknown input dimension, not supported by TIDL               |
    | Conv              | /features/features.11/block/block.3/block.3.0/Conv               | Layer 130 - op type Conv, Unknown input dimension, not supported by TIDL              |
    | Add               | /features/features.11/Add                                        | Layer 131 - op type Add, Unknown input dimension, not supported by TIDL               |
    | Conv              | /features/features.12/features.12.0/Conv                         | Layer 132 - op type Conv, Unknown input dimension, not supported by TIDL              |
    | HardSigmoid       | /features/features.12/features.12.2/HardSigmoid                  | Layer 133 - op type HardSigmoid, Unknown input dimension, not supported by TIDL       |
    | Mul               | /features/features.12/features.12.2/Mul                          | Layer 134 - op type Mul, Unknown input dimension, not supported by TIDL               |
    | GlobalAveragePool | /avgpool/GlobalAveragePool                                       | Layer 135 - op type GlobalAveragePool, Unknown input dimension, not supported by TIDL |
    | Flatten           | /Flatten                                                         | Layer 136 - op type Flatten, Unknown input dimension, not supported by TIDL           |
    | Gemm              | /classifier/classifier.0/Gemm                                    | Layer 137 - op type Gemm, Unknown input dimension, not supported by TIDL              |
    | HardSigmoid       | /classifier/classifier.1/HardSigmoid                             | Layer 138 - op type HardSigmoid, Unknown input dimension, not supported by TIDL       |
    | Mul               | /classifier/classifier.1/Mul                                     | Layer 139 - op type Mul, Unknown input dimension, not supported by TIDL               |
    | Gemm              | /classifier/classifier.3/Gemm                                    | Layer 140 - op type Gemm, Unknown input dimension, not supported by TIDL              |
    --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
    ============================= [Parsing Completed] =============================
    
    Process Process-1:
    Traceback (most recent call last):
      File "/usr/lib/python3.10/multiprocessing/process.py", line 314, in _bootstrap
        self.run()
      File "/usr/lib/python3.10/multiprocessing/process.py", line 108, in run
        self._target(*self._args, **self._kwargs)
      File "/home/root/examples/osrt_python/ort/onnxrt_ep.py", line 388, in run_model
        for j in range(batch):
    TypeError: 'str' object cannot be interpreted as an integer
     

    Regards,
    Sajan

  • Hi Sajan,

    From the error logs, it looks like your model was not exported with static dimensions, e.g. [1, 3, 224, 224] for batch, channels, height, and width dimensions. Model export from Pytorch to ONNX should supply statically set dimensions [0].

    This is why you see that your batch dimension was interpreted as a string and why you see many instances of " Unknown input dimension, not supported by TIDL" in the model-parsing log.

    [0] https://docs.pytorch.org/tutorials/beginner/onnx/export_simple_model_to_onnx_tutorial.html  

  • Hello Reese,

    Okay I did this and the log of compilation seems like below.

    ~/edgeai-tidl-tools/examples/osrt_python/ort$ python3 onnxrt_ep.py -m cl-ort-my_model -c
    Available execution providers :  ['TIDLExecutionProvider', 'TIDLCompilationProvider', 'CPUExecutionProvider']
    
    Running 1 Models - ['cl-ort-my_model']
    
    
    Running_Model :  cl-ort-my_model  
    
    
    Running shape inference on model ../../../models/public/my_model.onnx 
    
    ========================= [Model Compilation Started] =========================
    
    Model compilation will perform the following stages:
    1. Parsing
    2. Graph Optimization
    3. Quantization & Calibration
    4. Memory Planning
    
    ============================== [Version Summary] ==============================
    
    -------------------------------------------------------------------------------
    |          TIDL Tools Version          |              10_01_04_00             |
    -------------------------------------------------------------------------------
    |         C7x Firmware Version         |              10_01_00_01             |
    -------------------------------------------------------------------------------
    |            Runtime Version           |                1.15.0                |
    -------------------------------------------------------------------------------
    |          Model Opset Version         |                  12                  |
    -------------------------------------------------------------------------------
    
    ============================== [Parsing Started] ==============================
    
    [TIDL Import] [PARSER] WARNING: Network not identified as Object Detection network : (1) Ignore if network is not Object Detection network (2) If network is Object Detection network, please specify "model_type":"OD" as part of OSRT compilation options
    
    ------------------------- Subgraph Information Summary -------------------------
    -------------------------------------------------------------------------------
    |          Core           |      No. of Nodes       |   Number of Subgraphs   |
    -------------------------------------------------------------------------------
    | C7x                     |                     140 |                       2 |
    | CPU                     |                       1 |                       x |
    -------------------------------------------------------------------------------
    ----------------------------------------------------------------------------------------------------------------------------------------
    |       Node        |                           Node Name                          |                      Reason                       |
    ----------------------------------------------------------------------------------------------------------------------------------------
    | GlobalAveragePool | /features/features.1/block/block.1/avgpool/GlobalAveragePool | Kernel size (0x0) with stride (1x1) not supported |
    ----------------------------------------------------------------------------------------------------------------------------------------
    ============================= [Parsing Completed] =============================
    
    ==================== [Optimization for subgraph_0 Started] ====================
    
    ----------------------------- Optimization Summary -----------------------------
    --------------------------------------------------------------------------------
    |         Layer         | Nodes before optimization | Nodes after optimization |
    --------------------------------------------------------------------------------
    | TIDL_BatchNormLayer   |                         0 |                        1 |
    | TIDL_ReLULayer        |                         1 |                        0 |
    | TIDL_EltWiseLayer     |                         1 |                        1 |
    | TIDL_HardSigmoidLayer |                         1 |                        0 |
    | TIDL_ConvolutionLayer |                         2 |                        2 |
    --------------------------------------------------------------------------------
    
    =================== [Optimization for subgraph_0 Completed] ===================
    
    The soft limit is 10240
    The hard limit is 10240
    MEM: Init ... !!!
    MEM: Init ... Done !!!
     0.0s:  VX_ZONE_INIT:Enabled
     0.7s:  VX_ZONE_ERROR:Enabled
     0.9s:  VX_ZONE_WARNING:Enabled
     0.1444s:  VX_ZONE_INIT:[tivxInit:190] Initialization Done !!!
    ============= [Quantization & Calibration for subgraph_0 Started] =============
    
    ==================== [Optimization for subgraph_1 Started] ====================
    
    ----------------------------- Optimization Summary -----------------------------
    ---------------------------------------------------------------------------------
    |          Layer         | Nodes before optimization | Nodes after optimization |
    ---------------------------------------------------------------------------------
    | TIDL_BatchNormLayer    |                         0 |                       27 |
    | TIDL_InnerProductLayer |                         2 |                        2 |
    | TIDL_EltWiseLayer      |                        33 |                       33 |
    | TIDL_HardSigmoidLayer  |                        27 |                        0 |
    | TIDL_ReLULayer         |                        13 |                        0 |
    | TIDL_FlattenLayer      |                         1 |                        0 |
    | TIDL_ConvolutionLayer  |                        50 |                       50 |
    | TIDL_PoolingLayer      |                         9 |                        9 |
    ---------------------------------------------------------------------------------
    
    =================== [Optimization for subgraph_1 Completed] ===================
    
    ============= [Quantization & Calibration for subgraph_1 Started] =============
    
    
    -------- Running Calibration in Float Mode to Collect Tensor Statistics --------
    [=============================================================================] 100 %
    
    ------------------ Fixed-point Calibration Iteration [1 / 5]: ------------------
    [=============================================================================] 100 %
    
    ------------------ Fixed-point Calibration Iteration [2 / 5]: ------------------
    [=============================================================================] 100 %
    
    ------------------ Fixed-point Calibration Iteration [3 / 5]: ------------------
    [=============================================================================] 100 %
    
    ------------------ Fixed-point Calibration Iteration [4 / 5]: ------------------
    [=============================================================================] 100 %
    
    ------------------ Fixed-point Calibration Iteration [5 / 5]: ------------------
    [=============================================================================] 100 %
    
    ==================== [Quantization & Calibration Completed] ====================
    
    ========================== [Memory Planning Started] ==========================
    
    
    ------------------------- Network Compiler Traces ------------------------------
    Successful Memory Allocation
    Successful Workload Creation
    
    ========================= [Memory Planning Completed] =========================
    
    Rerunning network compiler...
    ========================== [Memory Planning Started] ==========================
    
    
    ------------------------- Network Compiler Traces ------------------------------
    Successful Memory Allocation
    Successful Workload Creation
    
    ========================= [Memory Planning Completed] =========================
    
    ======================== Subgraph Compiled Successfully ========================
    
    
    
    
    -------- Running Calibration in Float Mode to Collect Tensor Statistics --------
    [=============================================================================] 100 %
    
    ------------------ Fixed-point Calibration Iteration [1 / 5]: ------------------
    [=============================================================================] 100 %
    
    ------------------ Fixed-point Calibration Iteration [2 / 5]: ------------------
    [=============================================================================] 100 %
    
    ------------------ Fixed-point Calibration Iteration [3 / 5]: ------------------
    [=============================================================================] 100 %
    
    ------------------ Fixed-point Calibration Iteration [4 / 5]: ------------------
    [=============================================================================] 100 %
    
    ------------------ Fixed-point Calibration Iteration [5 / 5]: ------------------
    [=============================================================================] 100 %
    
    ==================== [Quantization & Calibration Completed] ====================
    
    ========================== [Memory Planning Started] ==========================
    
    
    ------------------------- Network Compiler Traces ------------------------------
    Successful Memory Allocation
    Successful Workload Creation
    
    ========================= [Memory Planning Completed] =========================
    
    Rerunning network compiler...
    ========================== [Memory Planning Started] ==========================
    
    
    ------------------------- Network Compiler Traces ------------------------------
    Successful Memory Allocation
    Successful Workload Creation
    
    ========================= [Memory Planning Completed] =========================
    
    ======================== Subgraph Compiled Successfully ========================
    
    
    
    
     
    Completed_Model :     1, Name : cl-ort-my_model                                  , Total time :    3185.77, Offload Time :      74.22 , DDR RW MBs : 0, Output Image File : py_out_cl-ort-my_model_ADE_val_00001801.jpg, Output Bin File : py_out_cl-ort-my_model_ADE_val_00001801.bin
     
     
    MEM: Deinit ... !!!
    MEM: Alloc's: 53 alloc's of 56449398 bytes 
    MEM: Free's : 53 free's  of 56449398 bytes 
    MEM: Open's : 0 allocs  of 0 bytes 
    MEM: Deinit ... Done !!!
    


    Seems below error when running the model in EVM

    root@am62axx-evm:/opt/edgeai-gst-apps# ./apps_python/app_edgeai.py configs/my_config.yaml                                                                                                            
    Traceback (most recent call last):
      File "/opt/edgeai-gst-apps/./apps_python/app_edgeai.py", line 71, in <module>
        main(sys.argv)
      File "/opt/edgeai-gst-apps/./apps_python/app_edgeai.py", line 50, in main
        demo = EdgeAIDemo(config)
               ^^^^^^^^^^^^^^^^^^
      File "/opt/edgeai-gst-apps/apps_python/edge_ai_class.py", line 105, in __init__
        model_obj = ModelConfig(model_path,enable_tidl,core_id)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/usr/lib/python3.12/site-packages/edgeai_dl_inferer.py", line 286, in __init__
        if 'formatter' in params['postprocess']:
                          ~~~~~~^^^^^^^^^^^^^^^
    KeyError: 'postprocess'
    root@am62axx-evm:/opt/edgeai-gst-apps# vi configs/my_config.yaml 
    root@am62axx-evm:/opt/edgeai-gst-apps# ./apps_python/app_edgeai.py configs/my_config.yaml                                                                                                            
    Traceback (most recent call last):
      File "/opt/edgeai-gst-apps/./apps_python/app_edgeai.py", line 71, in <module>
        main(sys.argv)
      File "/opt/edgeai-gst-apps/./apps_python/app_edgeai.py", line 50, in main
        demo = EdgeAIDemo(config)
               ^^^^^^^^^^^^^^^^^^
      File "/opt/edgeai-gst-apps/apps_python/edge_ai_class.py", line 105, in __init__
        model_obj = ModelConfig(model_path,enable_tidl,core_id)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/usr/lib/python3.12/site-packages/edgeai_dl_inferer.py", line 286, in __init__
        if 'formatter' in params['postprocess']:
                          ~~~~~~^^^^^^^^^^^^^^^
    KeyError: 'postprocess'
    

    Help me to fix the issue.

    Note: Tried to run cl-tfl-mobilenet_v1_1.0_224 seems same issue.

    Warm Regards,
    Sajan

  • Hello Sajan,

    The error indicates that there is an expected "params['postprocess']" that is not set. This is supposed to be in your param.yaml file within your model artifacts, which edgeai-tidl-tools will create when finished compiling the model. This file encodes various settings (generally for preprocessing and postprocessing) that are otherwise not held within the model file itself. 

    I see in our model_zoo models, e.g. /opt/model_zoo/ONR-CL-6360-regNetx-200mf, that there is a param.yaml with field "postprocess:{}" (empty) 

    It looks like there was a bug in 10.1 where if you did not set a postprocess, then this field would not be present in param.yaml. 

    You can do one of the following:

    • Edit your param.yaml, add a line for "postprocess:{}"
    • Edit your model_configs.py for your model such that it includes " 'postprocess':dict() "

    BR,
    Reese

  • Hello Reese,

    Edit your model_configs.py for your model such that it includes " 'postprocess':dict() "

    Can you please help me to add that dict.
    Existing config is:

            "cl-ort-my_model": create_model_config(
            task_type="classification",
            source=dict(
                model_path=os.path.join(models_base_path, "my_model.onnx"),
            ),
            preprocess=dict(
                resize=256,
                crop=224,
                data_layout="NCHW",
                resize_with_pad=False,
                reverse_channels=False,
            ),
            session=dict(
                session_name="onnxrt",
                model_path=os.path.join(models_base_path, "my_model.onnx"),
                input_mean=[0.485, 0.456, 0.406],
                input_scale=[1 / 0.229, 1 / 0.224, 1 / 0.225],
                input_optimization=True,
                input_details={
                    "name": "input",
                    "shape": [1, 3, 224, 224]
                },
                output_details={
                    "name": "output",
                    "shape": [1, 6]
                },
            ),
            extra_info=dict(
                num_images=numImages,
                num_classes=6,
            )
        ),




    Note: I tried simply adding postprocess: {} to param.yaml. It worked, But only print else part  in post_process. If it is not like I did, Please correct me.

    Above mentioned else part, it is not goes into if part
            for idx in topN_classes:                                       
                idx += self.model.label_offset                         
                class_name = self.model.dataset_info.get(idx, None)           
                if class_name:                                     
                    name = class_name.name                
                    if class_name.supercategory:                   
                        name = f"{class_name.supercategory}/{name}"    
                else:                                              
                    name = "Normal"                      
                class_list.append(name)      


    Warm Regards,
    Sajan

  • Your model-config would include (at the end):

            ),
            extra_info=dict(
                num_images=numImages,
                num_classes=6,
            ),
            postprocess=dict(),
        ),

    Above mentioned else part, it is not goes into if part

    Okay, this is a different part, if I'm interpreting the (vague) comments correctly. This is about finding the name of the classes for your model. 

    self.model.dataset_info.get(idx, None) 

    • This line is probably not finding your dataset info, which would be in your model-artifacts/dataset.yaml. Does this file exist?
      • The default contents of dataset.yaml may not be informative when compiled with edgeai-tidl-tools. This is because it does not know what your dataset includes. edgeai-modelmaker and Model Composer supply a version of this for your dataset. For edgeai-tidl-tools, you may need to either write that dataset.yaml file yourself, or copy from corresponding outputs of modelmaker/Composer. 
    • I would suggest printing the output of the line I copied above and using that to diagnose why it isn't finding your class name(s). 
  • Hello Reese,

    Added the postprocess dict in model_config.py and recompiled. No change.

    printing the output of the line I copied above and using that to diagnose why it isn't finding your class name(s). 

    When trying printing class_name is None.


    Does this file exist

    info:
      description: classification dataset
    categories:
    - id: 1
      supercategory: classification
      name: category_1
    - id: 2
      supercategory: classification
      name: category_2
    - id: 3
      supercategory: classification
      name: category_3
    - id: 4
      supercategory: classification
      name: category_4
    - id: 5
      supercategory: classification
      name: category_5
    - id: 6
      supercategory: classification
      name: category_6
    color_map:
    - - 0
      - 0
      - 0
    - - 0
      - 0
      - 255
    - - 0
      - 255
      - 0
    - - 0
      - 255
      - 255
    - - 255
      - 0
      - 0
    - - 255
      - 0
      - 255
    - - 255
      - 255
      - 0
    - - 255
      - 255
      - 255
      
      
      =============================================================================================
      
      I tried changing this with respective class names
      
    info: {}
    categories:
    - id: 1
      name: Class1
    - id: 2
      name: Class2
    - id: 3
      name: Class3
    - id: 4
      name: Class4
    - id: 5
      name: Class5
    - id: 6
      name: Class7
    color_map:
    - - 0
      - 0
      - 0
    - - 0
      - 0
      - 255
    - - 0
      - 255
      - 0
    - - 0
      - 255
      - 255
    - - 255
      - 0
      - 0
    - - 255
      - 0
      - 255
    - - 255
      - 255
      - 0
    - - 255
      - 255
      - 255
      




      • The default contents of dataset.yaml may not be informative when compiled with edgeai-tidl-tools. This is because it does not know what your dataset includes. edgeai-modelmaker and Model Composer supply a version of this for your dataset. For edgeai-tidl-tools, you may need to either write that dataset.yaml file yourself, or copy from corresponding outputs of modelmaker/Composer. 

    I didn't get that.

    Help me to fix the issue.

    Warm Regards,
    Sajan

  • Hi Sajan,

    Looks like a valid dataset.yaml to me.

    Added the postprocess dict in model_config.py and recompiled. No change.

    Does this mean that your newest compiled model still doesn't have a 'postprocess:{}' in the param.yaml?

    I would suggest printing of the 'idx', 'classname', and 'self.model.label_offset' to  track down what's happening here. If the label_offset is some non-numeric value like None, it would cause idx to also be None

    What might be happening is a missing setting in param.yaml like so: 

    metric:
      label_offset_pred: -1

    If that's missing, create and assign to '0'. Otherwise provide your whole param.yaml so I can analyze.

  • Hello Reese,

    Does this mean that your newest compiled model still doesn't have a 'postprocess:{}' in the param.yaml?

    No, the newest compiled model has postprocess:{} in param.yaml

    I would suggest printing of the 'idx', 'classname', and 'self.model.label_offset' to  track down what's happening here.

    idx : 0
    self.model.label_offset: 0
    class_name : None
    idx : 0
    self.model.label_offset: 0
    class_name : None
    idx : 0
    self.model.label_offset: 0
    class_name : None
    idx : 0
    self.model.label_offset: 0
    class_name : None
    idx : 0
    self.model.label_offset: 0
    class_name : None
    idx : 0
    self.model.label_offset: 0
    class_name : None
    idx : 0
    self.model.label_offset: 0
    class_name : None
    idx : 0
    self.model.label_offset: 0
    class_name : None

    What might be happening is a missing setting in param.yaml like so:

    task_type: classification
    preprocess:
      resize:
      - 256
      - 256
      crop:
      - 224
      - 224
      data_layout: NCHW
      resize_with_pad: false
      reverse_channels: false
      add_flip_image: false
    session:
      session_name: onnxrt
      model_path: model/my_model.onnx
      input_mean:                     
      - 0.485                         
      - 0.456    
      - 0.406
      input_scale:
      - 4.366812  
      - 4.464286  
      - 4.444444
      input_optimization: true
      input_details:          
      - name: input           
        shape:      
        - 1        
        - 3   
        - 224
        - 224
        type: tensor(float)
      output_details:      
      - name: input        
        shape:       
        - 1        
        - 6   
        type: tensor(float)
      artifacts_folder: artifacts
      input_data_layout: NCHW    
      target_device: AM62A       
    postprocess: {}    

    Tried adding metric: in param.yaml. Print is 

    idx : -1
    self.model.label_offset: -1
    class_name : None
    idx : -1
    self.model.label_offset: -1
    class_name : None
    idx : -1
    self.model.label_offset: -1
    class_name : None
    idx : -1
    self.model.label_offset: -1
    class_name : None
    idx : -1
    self.model.label_offset: -1
    class_name : None


    When the value is -1 or 0 it goes into else part of postprocess classification.

    Warm Regards,
    Sajan

  • The full param.yaml may be what I needed to see. The problem may not be with postprocessing, but instead the inputs not being preprocessed the same way as they were during training. Where did you train your model?

      input_mean:                     
      - 0.485                         
      - 0.456    
      - 0.406
      input_scale:
      - 4.366812  
      - 4.464286  
      - 4.444444

    These values look like the mean and 1/stdev for the imagenet dataset. This is commonly used as preprocessing parameters on many models, since imagenet is often used to train backbones/feature extractors. 

    However, those assume your data is loaded on the interval [0,1] -- this is not the case in our tools. It is loaded with as uint8's (so interval [0,255]).

    Try multiplying your mean by 255 and divide the input_scale's by 255. They will likely be same as the values for other classification models in our model_zoo[0]. If you trained with edgeai-modelmaker or Model Composer in Edge Studio, the param.yaml that was included with those artifacts probably used these same values. 

    When you were compiling with edgeai-tidl-tools, a good step would be to run your network as classification on your dataset images and check that the outputs are reasonable. You can do that such that it runs with ONNX model version (run on CPU). If the CPU version's outputs are not good, it's often a result of incorrect preprocessing parameters.

    BR,
    Reese

    [0] https://github.com/TexasInstruments/edgeai-tidl-tools/blob/19ac4e61b40890537ab67fb3036780f41a7ade3a/examples/osrt_python/model_configs.py#L60 

  • Where did you train your model?

    Trained using pytorch.

    I am new to model training using pytorch. In the data transforms and loader section. Used transform.normalize, is that the input mean.

    transforms.Normalize(mean=[0.485, 0.456, 0.406], std=[0.229, 0.224, 0.225])


    Can you please verify the config dict I wrote.
            "cl-ort-my_model": create_model_config(
            task_type="classification",
            source=dict(
                model_path=os.path.join(models_base_path, "my_model.onnx"),
            ),
            preprocess=dict(
                resize=256,
                crop=224,
                data_layout="NCHW",
                resize_with_pad=False,
                reverse_channels=False,
            ),
            session=dict(
                session_name="onnxrt",
                model_path=os.path.join(models_base_path, "my_model.onnx"),
                input_mean=[0.485, 0.456, 0.406],
                input_scale=[1 / 0.229, 1 / 0.224, 1 / 0.225],
                input_optimization=True,
                input_details={
                    "name": "input",
                    "shape": [1, 3, 224, 224]
                },
                output_details={
                    "name": "output",
                    "shape": [1, 6]
                },
            ),
            extra_info=dict(
                num_images=numImages,
                num_classes=6,
            ),
            postprocess=dict(),
        ),
    



    Note: I tried by removing fraction( input_scale=[0.229, 0.224, 0.225] ) and recompiled. Seems tidl related error when running the model
    Warning : Couldn't find corresponding ioBuf tensor for onnx tensor with matching name 
    Invoke  : ERROR: Unable to allocate memory for TIDL RT in[] out [] tensor struct
    2025-08-11 09:06:39.843151013 [E:onnxruntime:, sequential_executor.cc:514 ExecuteKernel] Non-zero status code returned while running TIDL_1 node. Name:'TIDLExecutionProvider_TIDL_1_1' Status Message: TIDL Compute Invoke Failed.
    Exception in thread Thread-1 (pipeline):
    Traceback (most recent call last):
      File "/usr/lib/python3.12/threading.py", line 1075, in _bootstrap_inner
        self.run()
      File "/usr/lib/python3.12/threading.py", line 1012, in run
        self._target(*self._args, **self._kwargs)
      File "/opt/edgeai-gst-apps/apps_python/infer_pipe.py", line 137, in pipeline
        result = self.run_time(input_img)
                 ^^^^^^^^^^^^^^^^^^^^^^^^
      File "/usr/lib/python3.12/site-packages/edgeai_dl_inferer.py", line 198, in __call__
        return self.interpreter.run(None, {self.input_name: input_img})
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      File "/usr/lib/python3.12/site-packages/onnxruntime/capi/onnxruntime_inference_collection.py", line 217, in run
        return self._sess.run(output_names, input_feed, run_options)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    onnxruntime.capi.onnxruntime_pybind11_state.Fail: [ONNXRuntimeError] : 1 : FAIL : Non-zero status code returned while running TIDL_1 node. Name:'TIDLExecutionProvider_TIDL_1_1' Status Message: TIDL Compute Invoke Failed.


    Regards,
    Sajan

  • Hi Sajan, 

    Okay, this is what I suspected. You are not the first to run into this detail on preprocessing

    Replace your input_mean and input_scale to use values like the ones at this link. 

    BR,
    Reese

  • Hi Reese,

    Replace your input_mean and input_scale to use values like the ones at this link. 

    I tried model compiling after replacing input_mean and input_scale. No change in it. Code goes through the else part in post_process.py.

    Should I need to train the model (transforms.Normalize) with the values in above mentioned repo.

    Warm Regards,
    Sajan

  • Hi Sajan,

    Let's keep the testing within edgeai-tidl-tools at this point, and move back to a more basic portion of the model development flow. We will use edgeai-tidl-tools/examples/osrt_python/ort/onnxrt_ep.py

    If you run your model with onnxrt_ep.py using -d tag to disable TIDL and instead use CPUExecutionProvider, what are the results? You should use an image from your dataset.

    Does the highest-confidence index then correspond to the expected class? If not, then the issue is likely still preprocessing. If the result is good, then run again without -d, so that TIDLExecutionProvider is used instead for your model artifacts

    • Not that using -d tag may delete the existing model artifacts and require you rerun compile (-c)

    Should I need to train the model (transforms.Normalize) with the values in above mentioned repo.

    No, there is no need to retrain with different preprocessing parameters. 

    Please copy in your model_config entry and your param.yaml again

  • Hi Sajan,

    Let's keep the testing within edgeai-tidl-tools at this point, and move back to a more basic portion of the model development flow. We will use edgeai-tidl-tools/examples/osrt_python/ort/onnxrt_ep.py

    If you run your model with onnxrt_ep.py using -d tag to disable TIDL and instead use CPUExecutionProvider, what are the results? You should use an image from your dataset.

    Does the highest-confidence index then correspond to the expected class? If not, then the issue is likely still preprocessing. If the result is good, then run again without -d, so that TIDLExecutionProvider is used instead for your model artifacts

    • Not that using -d tag may delete the existing model artifacts and require you rerun compile (-c)

    Should I need to train the model (transforms.Normalize) with the values in above mentioned repo.

    No, there is no need to retrain with different preprocessing parameters. 

    Please copy in your model_config entry and your param.yaml again

  • Hi Reese,

    If you run your model with onnxrt_ep.py using -d tag to disable TIDL and instead use CPUExecutionProvider, what are the results?

    Tried python3 onnxrt_ep.py -d -m cl-ort-my_model. Model is generated but artifacts folder contains nothing.
    I checked to run the model in apps_python. It will open, then frame rate is about 8 fps. In the config I given as 24 frames.

    Warning when starting the app is:

    ******** WARNING ******* : Could not open /opt/model_zoo/cl-ort-my_model/artifacts/allowedNode.txt for reading... Entire model will run on ARM without any delegation to TIDL !


    Dataset.yaml contains the class as 
      supercategory: classification
      name: category_1
     

    So it will output as category_1 or something. Also it is not accurate. I found category_4's respective name by assumption.


    Warm Regards,
    Sajan

  • I checked to run the model in apps_python

    Please stay within edgeai-tidl-tools at this stage. We are trying to understand if the input preprocessing is the root cause of your inaccurate outputs. If preprocessing is wrong, your output will be wrong.

    Using -d will delete your artifacts yes, but will also run the baseline .onnx on CPUExecutionProvider. No TIDL artifacts are required to run this. This is used to check that .ONNX model on its own is behaving correctly. -d means "disable_offload". This will run slowly, but will also run in the models' native datatype with ONNX's implementation. 

    When the model runs with edgeai-tidl-tools python scripts, it will write an output file into edgeai-tidl-tools/output_images that shows the post-processed output of your model. We want to make sure that this is accurate for your model.  Again, if you run with -d tag, it will run on CPU. If you omit this tag, it will try to accelerate with TIDL (either emulated on x86 or accelerated w/ HW on target processor)

    If you want to see the actual output of the model, common_utils.py includes the postprocessing code for classification task -- you can add some additional code to printout these results.

    Please copy in your model_config entry and your param.yaml again

    By this, I mean please attach to this thread. 

  • Hello Reese,

    please attach to this thread. 

    # model_config
    
            "cl-ort-my_model": create_model_config(
            task_type="classification",
            source=dict(
                model_path=os.path.join(models_base_path, "my_model.onnx"),
            ),
            preprocess=dict(
                resize=256,
                crop=224,
                data_layout="NCHW",
                resize_with_pad=False,
                reverse_channels=False,
            ),
            session=dict(
                session_name="onnxrt",
                model_path=os.path.join(models_base_path, "my_model.onnx"),
                input_mean=[123.675, 116.28, 103.53],
                input_scale=[0.017125, 0.017507, 0.017429],
                input_optimization=True,
                input_details={
                    "name": "input",
                    "shape": [1, 3, 224, 224]
                },
                output_details={
                    "name": "output",
                    "shape": [1, 6]
                },
            ),
            extra_info=dict(
                num_images=numImages,
                num_classes=6,
            ),
            postprocess=dict(),
        ),
    


    # param.yaml
    
    task_type: classification
    preprocess:
      resize:
      - 256
      - 256
      crop:
      - 224
      - 224
      data_layout: NCHW
      resize_with_pad: false
      reverse_channels: false
      add_flip_image: false
    session:
      session_name: onnxrt
      model_path: model/my_model.onnx
      input_mean:
      - 123.675
      - 116.28
      - 103.53
      input_scale:
      - 0.017125
      - 0.017507
      - 0.017429
      input_optimization: true
      input_details:
      - name: input
        shape:
        - 1
        - 3
        - 224
        - 224
        type: tensor(float)
      output_details:
      - name: input
        shape:
        - 1
        - 6
        type: tensor(float)
      artifacts_folder: artifacts
      input_data_layout: NCHW
      target_device: AM62A
    postprocess: {}



    actual output of the model, common_utils.py includes the postprocessing code for classification task -- you can add some additional code to printout these results.

    Can you please help to do it. Also I checked the code. Can't find anything related to output names. 
    How can I pass the images to validate and get the output file at edgeai-tidl-tools/output_images?

    Warm Regards,
    Sajan

  • The param.yaml and model_config look correct. 

    Within onnxrt_ep.py, You can change the class_test_images to point to your own image. get_class_labels [1] is where you would look for postprocessing in common_utils.py. It is also referenced from onnxrt_ep.py. It will assume there are some 'classes' variable in python. 

    What are the results for running your model with -d tag from onnxrt_ep.py in the resulting image in edgeai-tidl-tools/output_images? Does this look reasonable? I would recommend using an image from your dataset. You can also look at the output from inference and see which index has the highest value -- this would be your recognized class. 

    Can you please help to do it.

    I'm asking you to add a print statement. I cannot hand-feed you every debugging step detail. If you cannot add a few lines of code to debug this component, I do not know how you will build an actual application. You are pushing the boundaries of our free support. I expect you to debug some of this yourself, and take directions on how to do so. 

    Output names, labels, classes are all effectively the same idea. It is a text-name or an integer index that correspond to your classification. 

    If you pass me the model and a test image, I can probably verify this myself, but expect it to take several days.

    [1] https://github.com/TexasInstruments/edgeai-tidl-tools/blob/95ba2c7ec62bbedeb637d7a5c0273fcede21cac9/examples/osrt_python/common_utils.py#L332 

    BR,
    Reese