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.

SK-TDA4VM: how to set the preProcObj->params.scale_val[i] and preProcObj->params.mean_pixel[i] to compatible with the trained model?

Part Number: SK-TDA4VM

Dear support:

    My sdk version: PSDK-RTOS8.0.0.01. + PSKD-linux8.0.01

    I have 2 questions:

     'mean'&'std'

    1. Does the xxxx_io.bin & xxxx_net.bin include the 'mean' and 'std' values which needed for model inference after using python-version script onnxrt_ep.py to offload model layers?

    2. if not, how do i set these values while evaluating accuracy and performance of ourself model base on vision_apps demo,like app_tild_seg

    in main.c -> set_pre_proc_defaults( ):

    {

        preProcObj->params.scale_val[i] = xxx

        preProcObj->params.mean_pixel[i] = xxx

    }

    cause we found these two variable strongly affecting the model inference result. we got very different result while running 2 images from same model, it seems very unstable.

Best Regards!

  • it seems onnxrt_ep.py can not validate the mean&std value in the "xxxx_net.bin" & "xxxx_io.bin", so we did not get expectation output from the model.

    i don't know why i don't get reply from the TI support??

  • Hello Lee,

    Apologies for the late reply, I am gathering information from our TIDL experts on this matter.

    So far what I have gathered is:

    • Values such as 'mean' and 'scale' are set in the preprocessing stage before the input goes into the model.
    • *net.bin contains information about the imported network and *io.bin contains input output information. Of the two, *net.bin would most likely have mean&std values but I need a day or two more to confirm this is the case for sure.

    When using onnxrt_ep.py, a better demo to reference when setting preprocessing values would be in Edge AI Academy as this is also in Python. It also talks about each step in the development cycle to go from running your application on a PC to running it on the SK-TDA4VM, and it includes the step to preprocess the input using mean and scale.

    Edge AI Academy: https://dev.ti.com/tirex/explore/node?node=AH1AEldx9VjDs1NBgfxdVw__Y9QU2Ei__LATEST

    Regards,

    Takuma

  • Hi Takuma Fujiwara, thank you for ur reply so much.

        Before, we use xxx_net.bin & xxx_io.bin offloaded by python version script onnxrt_ep.py&utils.py as the input of vision_apps/vx_app_tidl_seg.out. But getting so bad segmentation result.

        Later, i directly use tidl importer from PSDK-RTOS and setting the 'mean' and 'std' value like below(must set inDataNorm 1):

    inDataNorm  = 1
    inMean = 128.00 128.00 128.00
    inScale = 0.015625 0.015625 0.015625

        then use the xxx_net.bin & xxx_io.bin as input, then i get similar result compare with PC emulation.

        So, i wonder if onnxrt_ep.py could set the inDataNorm=1 ?

    or i can just use tidl importer if i work on PSDK-Linux + PSDK+RTOS?

    -----------------------------------------------------------------------------

        segmentation result with tidl importer:

    Best wishes!

  • Hello Lee,

    TIDL Model Importer is for running standalone TIDL applications without use of runtimes, whereas onnxrt_ep.py is the python script for open source runtimes, such as TVM, TFlite RT and ONNX RT, which loads TIDL import and inference libraries as part of runtime execution.

    When referencing the vision apps demo to build your applications, I think TIDL Model Importer is the tool to use since vision apps uses OpenVX to delegate the deep learning models to the hardware accelerator instead of runtimes.

    Regards,

    Takuma

  • Ok, I gotta the logic from your description.

    Thank you so much!

    Best!