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.

[参考译文] TDA4AEN-Q1:板端部署上 DeepLab 模型的异常推理结果

Guru**** 2895600 points
请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1636668/tda4aen-q1-abnormal-inference-results-of-deeplab-model-on-board-side-deployment

器件型号: TDA4AEN-Q1

尊敬的 TI 工程师:
我在 TDA4AEN 电路板上编译的 DeepLab 模型的推理结果与 PC 端的推理结果之间遇到了显著差异。 PC 上的推理输出是正确的、但使用相同的 net.bin 和 io.bin 文件在电路板上生成的结果存在很大差异。 下面列出了我的配置参数:
inFileFormat = 1
netBinFile =“./testvecs/config/subgraph_0_tidl_net.bin
ioConfigFile =“./testvecs/config/subgraph_0_tidl_io_1.bin
inData = testvecs/input/20260108_193128_000.bin
outData = testvecs/output/20260108_193128_000_out.bin
writeOutput = 1
postProcType = 0
debugTraceLevel = 2
我使用的工具版本和 SDK 版本都是 11.01。 我已将测试结果、模型文件和输入图像作为附件附上。 您能帮助分析此问题的根本原因吗? (第一幅图像显示 PC 端 OSRT 的编译和推理结果,第二幅图像显示板端推理结果。)

py_out_deeplabv3plus_mobilenetv2_tv_edgeailite_onnxrt_AM67A_20260108_193128_000_segmentation.png20260108_193128_000_out_pc2unit8_segmentation.png input.zipdeeplabv3plus_mobilenetv2_tv_edgeailite_onnxrt.zip  

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、张:

    我们的团队已经提出了这个问题。  

    而且、似乎未正确提供输入、或者在推理过程中出现后处理错误。

    我已经测试了模型与 osrt 流在目标,它似乎工作正常。 这证实了当传递了正确的输入时、模型的输出在目标 EVM 中似乎是正确的。
       

    https://github.com/TexasInstruments/edgeai-tidl-tools/tree/11_01_06_00
    https://github.com/TexasInstruments/edgeai-tidl-tools/blob/11_01_06_00/examples/osrt_python/ort/onnxrt_ep.py

    您还可以尝试在目标 EVM 上设置 edgeai-tidl-tools 并运行模型。

    此致、
    Gokul

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    尊敬的 Gokul:
    感谢您的答复。 我已在 PC 端使用 OSRT 执行推理、模型的分割结果正确且与您的结果完全一致。 但是、在 EVM 上运行模型时、推理结果会异常。
    对于图像后处理、我使用完全相同的后处理代码解析 OSRT 生成的 output_binaries、解析的结果是正确的。 这证实了后处理方法不是问题的原因。
    在图像预处理方面、我保存了 OSRT 推理期间产生的 input_tensor、并直接用它在 EVM 上进行推理、但结果仍异常。
    因此、我怀疑中tidl_infer_config用于 EVM 推理的参数配置存在问题。 您能帮助检查我共享的配置参数是否正确吗? 如果您能与我分享您的图像预处理过程、我将不胜感激。
    我正在使用可执行文件在 EVM 上运行推理 TI_DEVICE_ARMv8_TEST_dl_algo_host_RT.out 和详细的配置参数如下所示:
    inFileFormat = 1
    netBinFile =“./testvecs/config/subgraph_0_tidl_net.bin
    ioConfigFile =“./testvecs/config/subgraph_0_tidl_io_1.bin
    inData = testvecs/input/20260108_193128_000.bin
    outData = testvecs/output/20260108_193128_000_out.bin
    writeOutput = 1
    postProcType = 0
    debugTraceLevel = 2
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    您好、张:

    如果您能与我分享您的图像预处理过程、我将不胜感激。

    我在目标 EVM 上使用相同的 edgeai-tidl-tools 来验证输出、我不会执行任何额外的处理器。

    现在、我已尝试使用  TI_DEVICE_ARMv8_TEST_dl_algo_host_RT.out  传动器中。

    您的输入.bin 文件似乎包含 uint8 数据、但测试应用程序需要 float32 数据。

    有 3 种方法可以继续。

    1.生成 float32 .bin 文件输入并使用下面给出的配置、

    inFileFormat    = 1
    postProcType = 3
    numFrames   = 1
    netBinFile      = "testvecs/models/public/onnx/deeplab/subgraph_0_tidl_net.bin"
    ioConfigFile   = "testvecs/models/public/onnx/deeplab/subgraph_0_tidl_io_1.bin"
    inData  =   testvecs/input/tidl_trace_subgraph_0_0000_0001_0001_00001_00003_00512x00512_float.bin
    outData =   testvecs/output/20260108_193128_000.bin
    writeOutput = 1
    debugTraceLevel = 0
    writeTraceLevel = 0
    


    我将在此处共享 float32 .bin 以供参考、即 e2e.ti.com/.../float_5F00_input.zip

    2.如果要使用当前的 uint8 输入,则必须重新编译  TI_DEVICE_ARMv8_TEST_dl_algo_host_RT.out  应用完成以下更改后、

    diff --git a/c7x-mma-tidl/arm-tidl/rt/test/src/tidl_tb_utils.c b/c7x-mma-tidl/arm-tidl/rt/test/src/tidl_tb_utils.c
    index 34bbd676..bb6216dc 100644
    --- a/c7x-mma-tidl/arm-tidl/rt/test/src/tidl_tb_utils.c
    +++ b/c7x-mma-tidl/arm-tidl/rt/test/src/tidl_tb_utils.c
    @@ -1452,7 +1452,7 @@ int32_t tidl_ReadNetInput(TI_FILE * fp1, tidl_net_config *params, sTIDL_IOBufDes
     
           if (params->inFileFormat == 1)
           {
    -        elementSizeBytes = tidltb_getDatElementSize(ioPrms->rawDataInElementType[numBuffs]);
    +        elementSizeBytes = tidltb_getDatElementSize(ioPrms->inElementType[numBuffs]);
             ptr = (uint8_t *)malloc(n * d1 * d2 * c * h * w * elementSizeBytes);
             TIDLTB_ASSERT_EXIT(ptr);
             int32_t raw_data_size_sufficient = readRAWData(fp1, ptr, n, d1, d2, c, w, h, elementSizeBytes);
    @@ -1460,7 +1460,7 @@ int32_t tidl_ReadNetInput(TI_FILE * fp1, tidl_net_config *params, sTIDL_IOBufDes
             {
               printf("Warning :: File read for binary data load is not suffcient in size to fill the input tensor, Filling it with zero \n");
             }
    -        inElementType = ioPrms->rawDataInElementType[numBuffs];
    +        inElementType = ioPrms->inElementType[numBuffs];
             inTensorScale = ins[numBuffs]->scale;
             inZeroPoint   = ins[numBuffs]->zeroPoint;
             if(inElementType == TIDL_SinglePrecFloat)

    更改后更改波特图。

    cd $(psdkra)/sdk_builder
    make tidl_rt
    
    # copy the c7x-mma-tidl/arm-tidl/rt/out/J722S/A53/LINUX/release/TI_DEVICE_armv8_test_dl_algo_host_rt.out to evm

    3.将.jpg 图像转换为.bmp 格式、并使用以下配置:

    inFileFormat    = 0
    postProcType = 3
    numFrames   = 1
    netBinFile      = "testvecs/models/public/onnx/deeplab/subgraph_0_tidl_net.bin"
    ioConfigFile   = "testvecs/models/public/onnx/deeplab/subgraph_0_tidl_io_1.bin"
    totNumClasses = 2
    inData  =   testvecs/input/20260108_193128_000.bmp
    outData =   testvecs/output/20260108_193128_000.bin
    writeOutput = 1
    debugTraceLevel = 0
    writeTraceLevel = 0

    此致、
    Gokul