This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TDA4VM: Generating binaries from onnx model

Part Number: TDA4VM

I trained an object detection model using pytorch-mmdetection and got the onnx model. I am trying to convert the model to binaries to deploy on the TDA4VMXEVM board using the app_tidl_od app. I am using the 07_00_00_11 version of the SDK. I have already run the app with the default peele network without any problem. I have created a config file for the onnx model. When I try to create the binaries I get the following error:

autoai@autoai-ThinkPad-P50:~/ADAS/KTM/07_00_00/psdk_7_0/psdk_rtos_auto_j7_07_00_00_11/tidl_j7_01_02_00_09/ti_dl/utils/tidlModelImport/out$ ./tidl_model_import.out ../../../test/testvecs/config/import/public/onnx/tidl_import_retinanet.txt 
Couldn't open inputNetFile file: ../../test/testvecs/models/public/onnx/model.onnx  

I then gave the complete paths in the config file and I got the following error:

autoai@autoai-ThinkPad-P50:~/ADAS/KTM/07_00_00/psdk_7_0/psdk_rtos_auto_j7_07_00_00_11/tidl_j7_01_02_00_09/ti_dl/utils/tidlModelImport/out$ ./tidl_model_import.out ../../../test/testvecs/config/import/public/onnx/tidl_import_retinanet.txt 
ONNX Model (Proto) File  : /home/autoai/ADAS/KTM/07_00_00/psdk_7_0/psdk_rtos_auto_j7_07_00_00_11/tidl_j7_01_02_00_09/ti_dl/test/testvecs/models/public/onnx/model.onnx  
TIDL Network File      : /home/autoai/ADAS/KTM/07_00_00/psdk_7_0/psdk_rtos_auto_j7_07_00_00_11/tidl_j7_01_02_00_09/ti_dl/test/testvecs/config/tidl_models/onnx/tidl_net_retinanet.bin  
TIDL IO Info File      : /home/autoai/ADAS/KTM/07_00_00/psdk_7_0/psdk_rtos_auto_j7_07_00_00_11/tidl_j7_01_02_00_09/ti_dl/test/testvecs/config/tidl_models/onnx/tidl_io_retinanet.bin  
Current ONNX OpSet Version   : 9  
INFO : Couldn't open inData file: ../../test/testvecs/config/imageNet_sample_val.txt  , Skipping Range Collection for Quantization 
INFO : Couldn't open perfSimConfig file: ../../test/testvecs/config/import/device_config.cfg , Skipping Performance Simulation 
INFORMATION : 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 
INFORMATION : Example a 8x8 resize will be replaced by 4x4 resize followed by 2x2 resize 
INFORMATION : 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 
INFORMATION : Example a 8x8 resize will be replaced by 4x4 resize followed by 2x2 resize 
ERROR  : [TIDL_E_QUANT_STATS_NOT_AVAILABLE] tidl_quant_stats_tool.out fails to collect dynamic range. Please look into quant stats log. This model will get fault on target.
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          1 ERRORS          **
****************************************************

I then gave the complete path to inData and perfSimConfig as well which led to the following error:

autoai@autoai-ThinkPad-P50:~/ADAS/KTM/07_00_00/psdk_7_0/psdk_rtos_auto_j7_07_00_00_11/tidl_j7_01_02_00_09/ti_dl/utils/tidlModelImport/out$ ./tidl_model_import.out ../../../test/testvecs/config/import/public/onnx/tidl_import_retinanet.txt 
ONNX Model (Proto) File  : /home/autoai/ADAS/KTM/07_00_00/psdk_7_0/psdk_rtos_auto_j7_07_00_00_11/tidl_j7_01_02_00_09/ti_dl/test/testvecs/models/public/onnx/model.onnx  
TIDL Network File      : /home/autoai/ADAS/KTM/07_00_00/psdk_7_0/psdk_rtos_auto_j7_07_00_00_11/tidl_j7_01_02_00_09/ti_dl/test/testvecs/config/tidl_models/onnx/tidl_net_retinanet.bin  
TIDL IO Info File      : /home/autoai/ADAS/KTM/07_00_00/psdk_7_0/psdk_rtos_auto_j7_07_00_00_11/tidl_j7_01_02_00_09/ti_dl/test/testvecs/config/tidl_models/onnx/tidl_io_retinanet.bin  
Current ONNX OpSet Version   : 9  
Couldn't open tidlStatsTool file: ../../test/PC_dsp_test_dl_algo.out  
Couldn't open perfSimTool file: ../../utils/perfsim/ti_cnnperfsim.out  
INFORMATION : 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 
INFORMATION : Example a 8x8 resize will be replaced by 4x4 resize followed by 2x2 resize 
INFORMATION : 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 
INFORMATION : Example a 8x8 resize will be replaced by 4x4 resize followed by 2x2 resize 
ERROR  : [TIDL_E_QUANT_STATS_NOT_AVAILABLE] tidl_quant_stats_tool.out fails to collect dynamic range. Please look into quant stats log. This model will get fault on target.
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          1 ERRORS          **
****************************************************

The binaries were generated but as it is mentioned in the error above, there was an error when deploying on the board. Is there something that I am missing? I shouldn't have to give the complete path in the config file right?

Let me know if you need further information from me.

Thanks,

Prithvi

  • Hi Prithvi,

    One thought would be to try launching the application one directory level higher, than what is shown  the logs provided:

    Current:

    ~/ADAS/KTM/07_00_00/psdk_7_0/psdk_rtos_auto_j7_07_00_00_11/tidl_j7_01_02_00_09/ti_dl/utils/tidlModelImport/out$ ./tidl_model_import.out ../../../test/testvecs/config/import/public/onnx/tidl_import_retinanet.txt 

    Suggested:

      ~/ADAS/KTM/07_00_00/psdk_7_0/psdk_rtos_auto_j7_07_00_00_11/tidl_j7_01_02_00_09/ti_dl/utils/tidlModelImport/$ ./out/tidl_model_import.out <... etc ... >


    This may allow the relative paths to pick up the correct directories, and align with the example in the TIDL User Guide.

    Regards,

    kb




  • Thank you for the response. I was able to create the binaries successfully but I still get the segmentation fault when I try to run the vx_app_tidl_od on the board. 

    root@j7-evm:/opt/vision_apps# ./vx_app_tidl_od.out --cfg app_od.cfg 
    APP: Init ... !!!
    MEM: Init ... !!!
    MEM: Initialized DMA HEAP (fd=4) !!!
    MEM: Init ... Done !!!
    IPC: Init ... !!!
    IPC: Init ... Done !!!
    REMOTE_SERVICE: Init ... !!!
    REMOTE_SERVICE: Init ... Done !!!
    APP: Init ... Done !!!
      2196.879166 s:  VX_ZONE_INIT:Enabled
      2196.879178 s:  VX_ZONE_ERROR:Enabled
      2196.879182 s:  VX_ZONE_WARNING:Enabled
      2196.879706 s:  VX_ZONE_INIT:[tivxInit:71] Initialization Done !!!
      2196.879881 s:  VX_ZONE_INIT:[tivxHostInit:48] Initialization Done for HOST !!!
    Computing checksum at 0x0000FFFF7E15F340, size = 942584
    Segmentation fault (core dumped)

    I have included the binaries in /opt/vision_apps/test_data/psdkra/tidl_models folder. My app_od.cfg files contents are:

    # location of conifg
    tidl_config   /opt/vision_apps/test_data/psdkra/tidl_models/tidl_io_retinanet_1.bin
    
    # location of network
    tidl_network  /opt/vision_apps/test_data/psdkra/tidl_models/tidl_net_retinanet.bin
    
    # location of input files
    input_file_path   /opt/vision_apps/test_data/psdkra/tidl_demo_images
    
    # location of output files
    output_file_path ./app_tidl_od_out
    
    # start frame Number
    start_frame 500
    
    # number of frames
    num_frames  400
    
    # input size (width height)
    in_size   512 512
    
    # size given to DL network (width height)
    # This should should not be less than 4x of input width or height
    dl_size   512 512
    
    # size given for display (width height)
    # This should should not be less than 4x of input width or height
    out_size  512 512
    
    # vizualization threshold
    viz_th    0.95
    
    # Maximum number of Object Detection classes
    num_classes 90
    
    # delay in milli seconds (max 2000ms)
    delay_in_msecs 0
    
    # Enable or disable output image writing. 1 Enables it , 0 disables it
    en_out_img_write    0
    
    # If 1 - Enable display 0 - Disable display
    display_option      1
    
    # number of iterations to loop the inputs
    num_iterations      1
    
    # interactive input mode 1: yes, 0: no
    is_interactive      1
    

  • Hi Prithvi,

    In SDK 7.0 there was a bug in the pre-processing module. Can try applying this patch and check?

  • Hi Shyam,

    I used the patch which resolved the PC simulation issue but we still get the segmentation fault when running on TDA4 board. I regenerated the binaries after make 'vision_apps'. We are using SDK 7.0.

    Regards,

    Prithvi

  • Can you turn on APP_DEBUG in below path and send the log?

    vision_apps/apps/dl_demos/app_tidl_od_cam/app_common.h

    Regards,
    Shyam