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.

AM62A7: Model quantization problem

Part Number: AM62A7

Tool/software:

The model can be compiled on the pc, but the PC simulation will crash, and the quantization effect is very poor when running on the am62a board.  
What are some quantitative indicators, such as MAE?
  • Hi Zhiwei,

    It is our pleasure to help.

    There is not much information to understand the issue which you are facing. That said, please consider the following:

    If the above information did not help solving the issue, please provide the following:

    Best regards,

    Qutaiba

  • tensor_bits = 8
    ## 增加调试
    debug_level = 0
    max_num_subgraphs = 16
    accuracy_level = 1
    calibration_frames = 98
    calibration_iterations = 5
    output_feature_16bit_names_list = ""#"conv1_2, fire9/concat_1"
    params_16bit_names_list = "" #"fire3/squeeze1x1_2"
    mixed_precision_factor = -1
    quantization_scale_type = 0
    high_resolution_optimization = 0
    pre_batchnorm_fold = 1
    inference_mode = 0
    num_cores = 1
    ti_internal_nc_flag = 1601

    data_convert = 3
    SOC = os.environ["SOC"]
    if (quantization_scale_type == 3):
        data_convert = 0

    #set to default accuracy_level 1
    activation_clipping = 1
    weight_clipping = 1
    bias_calibration = 1
    channel_wise_quantization = 0

    tidl_tools_path = os.environ["TIDL_TOOLS_PATH"]
  • examples/osrt_python/model_configs.py
    'dad-3dheads_v1' : {
            'model_path' : os.path.join(models_base_path, 'desay','headpose','v1.0','HeadposeGaze_V1.1.3_20240827_am62a.onnx')                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          ,
            # 'source' : {'model_url': 'https://git.ti.com/cgit/jacinto-ai/jacinto-ai-modelzoo/plain/models/vision/classification/imagenet1k/torchvision/modified_single_eye_pplcnet_focal_triplet_size128_epoch149_acc97_20240116_modify_triplet_batch1.onnx', 'opt': True,  'infer_shape' : True},
            'mean': [123.675,116.28,103.53],
            'scale' : [0.01712475,0.017507,0.01742919],
            'num_images' : numImages,
            'num_classes': 6,
            'session_name' : 'onnxrt' ,
            'model_type': 'classification'
        },
    	
    	
    

  • Hi Zhiwei,

    Would you please explain the issue you are facing in details? The information you provided is not enough to understand the problem. 

    Best regards,

    Qutaiba

  • HI Qutaiba

      The compile process did not report an error, the quantization error on the PC is acceptable, but the effect on the board (AM62A)is very poor

       I need you to reproduce it according to my changes.

      TIDL version:09_02_06_00,   

     Attachment includes: 1. onnx Model 2. Code modification  3. Image calibration set
      
  • Hi Zhiwei, 

    Thank you for sharing the data. I will take a look at it and get back to you early next week.

    Best regards,

    Qutaib

  • Hi Zhiwei,
         The fix for this issue is available in TIDL 10.00.05.00 , this release is backword compatible with SDK 9.2 (i.e. you can easily integrate this TIDL release in your SDK 9.2 environment). The release can be downloaded from here : 

    c7x-mma-tidl (10.00.05.00) - Please refer to the readme in this link.
    https://cdds.ext.ti.com/ematrix/common/emxNavigator.jsp?objectId=28670.42872.46306.46165 

    This release needs an updated MMALIB and the same can be found here : 

    mmalib (10.00.00.09) - https://cdds.ext.ti.com/ematrix/common/emxNavigator.jsp?objectId=28670.42872.27243.5586

      Can you try this and let us know if it fixes the issue?


    Regards,

    Anshu


     

  • HI Qutaiba,

        Another issue is that the PC running the TIDL model causes a crash. How to locate the crash location?
        Run the following command
        
    python3 onnxrt_ep.py -m dad-3dheads_v3
    Attachment:  core file
  • Can I use the latest version directly? For example  10_00_06_00?

  • Hi Zhiwei, 

         What do you mean by directly? 

    Regards,

    ANshu

  • Finished quantization with TIDL 10.00.06 version, then push to the EVM board. 
    Use TIDLRT_invoke to complete the inference of the mode
  • HI Qutaiba, 

    modify the tensor_bits in common_utils in examples/osrt_python/ to 8 and debug_level to 3 and run 'python3 onnxrt_ep.py -c'

    run 'python3 onnxrt_ep.py' to run the 8bit model in PC emulation mode

    This operation will cause a crash. 
    Found missing dataid from 88

  • Hi Zhiwei,

    It seems that you started another thread regarding this last problem: https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1416554/am62a7-pc-emulator-running-model-causes-crash

    I already responded to that thread. If this is a different issue, please let me know and provide the same details I requested in the other thread. 

    Best regards,

    Qutaiba