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.

TDA2EXEVM: Where can I modify the code of this usecase TI-DL in OpenVX Tutorial?

Part Number: TDA2EXEVM

Hi,

I am now use PROCESSOR_SDK_VISION_03_07_00_00, And I want to modify the usecase TI-DL in OpenVX to test my trained caffemodel's run time and results.

but I modify the file : PROCESSOR_SDK_VISION_03_07_00_00\ti_components\open_compute\tiovx_01_05_01_00\tutorial\ch05_tidl\vx_tutorial_tidl.c, it didn't work? Did I modify the correct path?

Usecases is shown below:

[IPU1-0]  OPENVX Usecases
[IPU1-0]  ---------------
[IPU1-0]  1: OpenVX v1.1 Conformance Test
[IPU1-0]  2: OpenVX Tutorials
[IPU1-0]  3: VIP Single Channel Capture + OpenVX + Display
[IPU1-0]  5: OpenVx TIDL Object Classification
[IPU1-0]  7: OpenVx TIDL Object Detection

[IPU1-0]     19.472366 s:  ===============
[IPU1-0]     19.472457 s:  OpenVX Tutorial
[IPU1-0]     19.472518 s:  ===============
[IPU1-0]     19.472579 s:
[IPU1-0]     19.472610 s:  1: Image
[IPU1-0]     19.472671 s:  2: Graph
[IPU1-0]     19.472762 s:  3: Graph Pipeline
[IPU1-0]     19.472823 s:  4: TI-DL

  • Hello,

    That is the correct path to modify.  However, after modifying that file, you will have to build the tiovx package prior to rebuilding the vision sdk.  You can build the tiovx package from the tiovx_01_05_01_00 directory, then rebuild the vision sdk as you have.  At this point, your changes should take effect.

    Regards,

    Lucas

  • Hi Lucas,

    I have successful modify the file in the Tutorial.

    But when I use my caffemodel, the output result is  incorrect. My model outputs 16 floating point Numbers.

    However, I used the default classification bin file and OD bin file to output the correct results.

    The content in function of displayOutput in vx_tutorial_tidl.c I modified is as follows:

          if (operation_mode == 0)
          {
            uint8_t *pOut;
            uint8_t score[5];
            vx_uint32 classid[5];
            pOut = (uint8_t *)output_buffer + (ioBufDesc->outPadT[id] * output_sizes[0]) + ioBufDesc->outPadL[id];
           typedef struct {
            float result1;
            float result2;
            float result3;
            float result4;
            float result5;
            float result6;
            float result7;
            float result8;
            float result9;
            float result10;
            float result11;
            float result12;
            float result13;
            float result14;
            float result15;
            float result16;
            } APALayerObjInfo;
            APALayerObjInfo *pObjInfo;
            pObjInfo = (APALayerObjInfo *)pOut;

            APALayerObjInfo * pObj = pObjInfo;

            printf("%5.2f|%5.2f|%5.2f|%5.2f|%5.2f|%5.2f|%5.2f|%5.2f|%5.2f|%5.2f|%5.2f|%5.2f|%5.2f|%5.2f|%5.2f|%5.2f|\n", pObj->result1, pObj->result2, pObj->result3, pObj->result4, pObj->result5, pObj->result6, pObj->result7, pObj->result8, pObj->result9, pObj->result10, pObj->result11, pObj->result12, pObj->result13, pObj->result14, pObj->result15, pObj->result16);

    the result is incorrect,but I use the tidl_param_jdetNet_ssd.bin is OK. Is this demo just suit tidl_net_imagenet_jacintonet11v2.bin and tidl_net_jdetNet_ssd.bin?

    My tidl_model_import.out.exe on PC conversion is correct!

  • Hi,

    If the output of the model is incorrect, I advice you to test first with the reference version of TI-DL, not at openVX level. Since you are able to use the import tools, are you familiar with the TI-DL package in ti_components\algorithms\REL.TIDL.XX.XX.XX.00 ? The user's guide in ti_components\algorithms\REL.TIDL.XX.XX.XX.00\modules\ti_dl\docs has step to build the reference executable. See paragraph 3.6.3 . The inference config file allows you to specify the output file in which the output layer is dumped to so you can examine it using a hex viewer such as Neo, which understands floating point format.  

    So I think these would be the first steps to troubleshoot the issues. Let me know how it goes.

  • Yes, I know this infer tools, and I also get the eve-release-infer.exe tool from my local FAE .

    But there is still problem. My model can run on the tda2x evm, and it can dump each layer‘s data on the sd card using the modified TIDL I/O file usecase.

    The output result of my model with the import tool and the result on the evm board are same and correct.But the result on the infer tools is still 0. I can't understand.

    And I chose this openVX TI-DL usecase because it can both display the running time on DSP or EVE and print out the results, which is very helpful for us to do algorithm optimization .

  • In addition, output file is hex without dataQ , so using the Neo can not see the  floating point result. Because this is fixed point.

  • Just to get my understanding correct:

    - If you use TIDL file I/O use-case, which is not openVX based, you get correct output.

    - If you use openVX TI-DL tutorial example, which is also file I/O based, then your output is incorrect.

    Would it help if the openVX TI-DL tutorial also writes out each layer's output so you can compare with the TIDL fiel I/O use-case ?

  • - If you use TIDL file I/O use-case, which is not openVX based, you get correct output.

    ------yes this usecase on PROCESSOR_SDK_VISION_03_05_00_00, it can dump the result of each layer into sd-card !

    - If you use openVX TI-DL tutorial example, which is also file I/O based, then your output is incorrect.

    ------No , openVX TI-DL tutorial is in PROCESSOR_SDK_VISION_03_07_00_00, this demo can printf the last layer' result through the uart, As shown below.It's more convenient for our algorithm engineers. And this demo is different from the TIDL file I/O, we can just modified the displayOutput as I mentioned above。

    I suggest you run through these usecase.

    [IPU1-0]  OPENVX Usecases
    [IPU1-0]  ---------------
    [IPU1-0]  1: OpenVX v1.1 Conformance Test
    [IPU1-0]  2: OpenVX Tutorials
    [IPU1-0]  3: VIP Single Channel Capture + OpenVX + Display
    [IPU1-0]  5: OpenVx TIDL Object Classification
    [IPU1-0]  7: OpenVx TIDL Object Detection
    [IPU1-0]  
    [IPU1-0]  x: Exit
    [IPU1-0]  
    [IPU1-0]  Enter Choice:
    [IPU1-0]  
    [IPU1-0]    160.483590 s:  
    [IPU1-0]    160.483682 s:
    [IPU1-0]    160.483743 s:
    [IPU1-0]    160.483804 s:  ===============
    [IPU1-0]    160.483926 s:  OpenVX Tutorial
    [IPU1-0]    160.483987 s:  ===============
    [IPU1-0]    160.484048 s:
    [IPU1-0]    160.484109 s:  1: Image
    [IPU1-0]    160.484170 s:  2: Graph
    [IPU1-0]    160.484231 s:  3: Graph Pipeline
    [IPU1-0]    160.484322 s:  4: TI-DL
    [IPU1-0]    160.484353 s:
    [IPU1-0]    160.484414 s:  a: Run All
    [IPU1-0]    160.484475 s:
    [IPU1-0]    160.484505 s:  x: Exit
    [IPU1-0]    160.484566 s:
    [IPU1-0]    162.178277 s:  Enter Choice:
    [IPU1-0]    162.178429 s:  vx_tutorial_tidl: Tutorial Started !!!
    [IPU1-0]    162.195510 s:  Reading config file sd:test_data//tivx/tidl/tidl_infer.cfg ...
    [IPU1-0]    162.244555 s:  Reading network file sd:test_data//./tivx/tidl/tidl_net_jdetNet_ssd.bin
    [IPU1-0]  ...
    [IPU1-0]    163.090709 s:  Reading network params file sd:test_data//./tivx/tidl/tidl_param_jdetNet_ssd.bin
    [IPU1-0]  ...
    [IPU1-0]    167.286829 s:
    [IPU1-0]    167.286951 s: Thread #1: Create graph ...
    [IPU1-0]    167.287927 s: Thread #1: Create input and output tensors for node 1 ...
    [IPU1-0]    167.289178 s: Thread #1: Create node 1 ...
    [IPU1-0]    167.305343 s: Thread #1: Create output tensors for node 2 ...
    [IPU1-0]    167.305801 s: Thread #1: Create node 2 ...
    [IPU1-0]    167.321905 s:
    [IPU1-0]    167.322088 s: Thread #1: Verify graph ...
    [IPU1-0]    169.956932 s:
    [IPU1-0]    169.957115 s: Thread #1: Start graph ...
    [IPU1-0]    169.957268 s:
    [IPU1-0]    169.957390 s: Thread #1: Wait for graph ...
    [IPU1-0]    170.084304 s:
    [IPU1-0]    170.084395 s: Thread #1: Results
    [IPU1-0]    170.084487 s: ---------------------
    [IPU1-0]    170.084883 s:     0|    1| 0.54| 0.83| 0.51| 0.90| 0.88|
    [IPU1-0]    170.084975 s:
    [IPU1-0]    170.085127 s: ObjId|label|score| xmin| ymin| xmax| ymax|
    [IPU1-0]    170.085310 s: ------------------------------------------
    [IPU1-0]    170.085524 s:     0|    1| 0.54| 0.83| 0.51| 0.90| 0.88|
    [IPU1-0]    170.085737 s:     1|    1| 0.50| 0.56| 0.57| 0.58| 0.71|
    [IPU1-0]    170.085951 s:     2|    1| 0.24| 0.41| 0.56| 0.42| 0.61|
    [IPU1-0]    170.086195 s:     3|    2| 0.94| 0.30| 0.58| 0.33| 0.64|
    [IPU1-0]    170.086408 s:     4|    2| 0.74| 0.59| 0.43| 0.61| 0.49|
    [IPU1-0]    170.086622 s:     5|    3| 0.74| 0.33| 0.57| 0.35| 0.60|
    [IPU1-0]    170.086835 s:     6|    3| 0.61| 0.88| 0.56| 1.00| 0.83|
    [IPU1-0]    170.087049 s:     7|    3| 0.46| 0.02| 0.57| 0.18| 0.75|
    [IPU1-0]    170.087140 s:
    [IPU1-0]    170.087262 s: Number of detected objects: 8
    [IPU1-0]    170.087323 s:
    [IPU1-0]    170.087384 s:
    [IPU1-0]    170.087567 s: ---- Thread #1: Node 1 (EVE-1) Execution time: 119.823000 ms
    [IPU1-0]    170.087842 s: ---- Thread #1: Node 2 (DSP-1) Execution time: 6.726000 ms
    [IPU1-0]    170.088299 s: ---- Thread #1: Total Graph Execution time: 127.023000 ms
    [IPU1-0]    170.088421 s:
    [IPU1-0]    170.088635 s: Execution time of all the threads running in parallel: 127.350000 ms
    [IPU1-0]    170.096413 s:
    [IPU1-0]    170.096565 s:  vx_tutorial_tidl: Tutorial Done !!!

  • Can you share your imported network parameter files with TI so we can troubleshoot on our side ? You can pass them to your local FAE and ask him to contact me.

  • Hi

    I share my network parameter files in the attachment, you download it and leave me a message, I will delete it in time.

    In addition, after debugging these two days, the output result of import tool is consistent with the output result of infer tool and the bin result of the last layer of EVM board dump。

    But,When I use the OpenVX Tutorial - 4: TI-DL, the output result as shown below.

    [IPU1-0]     21.528060 s:  ===============
    [IPU1-0]     21.528152 s:  OpenVX Tutorial
    [IPU1-0]     21.528243 s:  ===============
    [IPU1-0]     21.528274 s:
    [IPU1-0]     21.528335 s:  1: Image
    [IPU1-0]     21.528396 s:  2: Graph
    [IPU1-0]     21.528487 s:  3: Graph Pipeline
    [IPU1-0]     21.528548 s:  4: TI-DL
    [IPU1-0]     21.528579 s:
    [IPU1-0]     21.528640 s:  a: Run All
    [IPU1-0]     21.528701 s:
    [IPU1-0]     21.528731 s:  x: Exit
    [IPU1-0]     21.528792 s:
    [IPU1-0]     23.362075 s:  Enter Choice:
    [IPU1-0]     23.362258 s:  vx_tutorial_tidl: Tutorial Started !!!
    [IPU1-0]     23.379308 s:  Reading config file sd:test_data//tivx/tidl/tidl_infer.cfg ...
    [IPU1-0]     23.427926 s:  Reading network file sd:test_data//./tivx/tidl/tidl_net.bin
    [IPU1-0]  ...
    [IPU1-0]     24.187183 s:  Reading network params file sd:test_data//./tivx/tidl/tidl_param.bin
    [IPU1-0]  ...
    [IPU1-0]     26.431769 s:
    [IPU1-0]     26.431891 s: Thread #1: Create graph ...
    [IPU1-0]     26.432928 s: Thread #1: Create input and output tensors for node 1 ...
    [IPU1-0]     26.433752 s: Thread #1: Create node 1 ...
    [IPU1-0]     26.449948 s:
    [IPU1-0]     26.450344 s: Thread #1: Verify graph ...
    [IPU1-0]     27.027084 s:
    [IPU1-0]     27.027237 s: Thread #1: Start graph ...
    [IPU1-0]     27.027389 s:
    [IPU1-0]     27.027511 s: Thread #1: Wait for graph ...
    [IPU1-0]     27.046788 s:
    [IPU1-0]     27.046910 s: Thread #1: Results
    [IPU1-0]     27.047093 s: ---------------------
    [IPU1-0]     27.048252 s:  0.00| 0.00|-162885426901083803176879882812500000.00|-41503148742861950397491455078125.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00| 0.00|
    [IPU1-0]     27.049106 s:     0|    0|-162885426901083803176879882812500000.00|-41503148742861950397491455078125.00| 0.00| 0.00| 0.00|
    [IPU1-0]     27.049228 s:
    [IPU1-0]     27.049319 s: Image classifier Top-5 results:
    [IPU1-0]     27.049472 s:  brambling, class-id: 10, score: 250
    [IPU1-0]     27.049624 s:  house finch, class-id: 12, score: 250
    [IPU1-0]     27.049777 s:  hen, class-id: 8, score: 249
    [IPU1-0]     27.049960 s:  goldfinch, Carduelis carduelis, class-id: 11, score: 249
    [IPU1-0]     27.050387 s:  ostrich, Struthio camelus, class-id: 9, score: 246
    [IPU1-0]     27.050509 s:
    [IPU1-0]     27.050692 s: ---- Thread #1: Node 1 (EVE-1) Execution time: 19.043000 ms
    [IPU1-0]     27.050936 s: ---- Thread #1: Total Graph Execution time: 19.402000 ms
    [IPU1-0]     27.051027 s:
    [IPU1-0]     27.051271 s: Execution time of all the threads running in parallel: 19.728000 ms
    [IPU1-0]     27.056518 s:

  • Hi,

    I downloaded the file. It may take up to 1 week before I get can back to you on this issue. Is that ok ?

  • That is OK. Thank you for your great support!

    Happy National Day!!

  • Hi Victor,

    Have you tested my model?

  • Hi,

    Yes I tested the model in host emulation on Linux and the content of the output buffer is correct. The printf will display garbage because your output doesn't follow the same format as TI's SSD. You should probably rewrite the lines #1007-#1012 in displayOutput() of file vx_tutorial_tidl.c to fit your need:

    if ((int32_t)(pObj->objId)!=-1) {
    printf("%5d|%5d|%5.2f|%5.2f|%5.2f|%5.2f|%5.2f|\n", (int32_t)pObj->objId, (uint32_t)pObj->label, pObj->score, pObj->xmin, pObj->ymin, pObj->xmax, pObj->ymax);
    }
    else {
    break;
    }

    Please see the snapshot of my screen showing the correct outputs in the memory browser of Eclipse:


  • Hi Victor,

    I've tested it before The number of fixed points in the pObjInfo result is correct, I dump the last layer is same as your show.

    I also rewrited the lines #1007-#1012 in displayOutput() of file vx_tutorial_tidl.c to fit my need, but it didn't work!

    Can you rewrite the correct output for me? My result is easy, just 16 floating point Numbers, please!

    Thank you .

  • My modified:

          if (operation_mode == 0)
          {
            uint8_t *pOut;
            uint8_t score[5];
            vx_uint32 classid[5];
            pOut = (uint8_t *)output_buffer + (ioBufDesc->outPadT[id] * output_sizes[0]) + ioBufDesc->outPadL[id];
           typedef struct {
            float result1;
            float result2;
            float result3;
            float result4;
            float result5;
            float result6;
            float result7;
            float result8;
            float result9;
            float result10;
            float result11;
            float result12;
            float result13;
            float result14;
            float result15;
            float result16;
            } APALayerObjInfo;
            APALayerObjInfo *pObjInfo;
            pObjInfo = (APALayerObjInfo *)pOut;

            APALayerObjInfo * pObj = pObjInfo;

            printf("%5.2f|%5.2f|%5.2f|%5.2f|%5.2f|%5.2f|%5.2f|%5.2f|%5.2f|%5.2f|%5.2f|%5.2f|%5.2f|%5.2f|%5.2f|%5.2f|\n", pObj->result1, pObj->result2, pObj->result3, pObj->result4, pObj->result5, pObj->result6, pObj->result7, pObj->result8, pObj->result9, pObj->result10, pObj->result11, pObj->result12, pObj->result13, pObj->result14, pObj->result15, pObj->result16);

  • It looks like the issue is with printf: %f doesn't work when the number is too small or too big. Instead use %g:

    printf("%5.2g|%5.2g|%5.2g|%5.2g|%5.2g|%5.2g|%5.2g|%5.2g|%5.2g|%5.2g|%5.2g|%5.2g|%5.2g|%5.2g|%5.2g|%5.2g|\n", pObj->result1, pObj->result2, pObj->result3, pObj->result4, pObj->result5, pObj->result6, pObj->result7, pObj->result8, pObj->result9, pObj->result10, pObj->result11, pObj->result12, pObj->result13, pObj->result14, pObj->result15, pObj->result16);

    Also the operation mode should be '1', not '0''.

  • Hi ,

    My infer tools 16 float numbers result output on PC is just like this:

    135.6581
    25.1624
    36.1026
    25.1624
    35.0085
    59.0769
    134.5641
    59.0769
    -8.7521
    -16.4103
    -8.7521
    -14.2222
    -9.8462
    -16.4103
    4.3761
    -16.4103
    I have change it to use %g, but it is still not work. can you help me try this again?

  • Hi, 

    I want to know your tested the model in host emulation on Linux, is use the ccs tool environment on linux?

  • Hi,

    For Linux host emulation on PC, I am using eclipse IDE (https://www.eclipse.org) since host emulation is built with gcc. You can build host emulation version of openVX by going to the directory PROCESSOR_SDK_VISION_XX_0XX_00_00/ti_components/open_compute/tiovx and type 'make'. Before also make sure that you have this line #13 in PROCESSOR_SDK_VISION_XX_0XX_00_00/ti_components/open_compute/tiovx/build_flags_vsdk.mak:

    BUILD_EMULATION_MODE?=yes

    'make' will generate the executable  PROCESSOR_SDK_VISION_XX_0XX_00_00/ti_components/open_compute/tiovx/out/PC/X86/LINUX/debug/vx_tutorial_exe

    If you execute it for the first time, you will see a menu:

    ===============
    OpenVX Tutorial
    ===============

    1: Image
    2: Graph
    3: Graph Pipeline
    4: TI-DL

    a: Run All

    x: Exit

    Enter Choice:


    If you select '4', you will likely see an error:

    vx_tutorial_tidl: Tutorial Started !!!
    Reading config file (null)/tivx/tidl/tidl_infer.cfg ...
    # ERROR: Unable to open config file [(null)/tivx/tidl/tidl_infer.cfg]
    # ERROR: Please make sure that the environment variable VX_TEST_DATA_PATH is set to .../conformance_tests/test_data

    vx_tutorial_tidl: Tutorial Done !!!


    To fix it, exit the tutorial (key 'x') and type in the shell:

    export VX_DATA_PATH='/home/..../PROCESSOR_SDK_VISION_XX_0XX_00_00/ti_components/open_compute/tiovx/tiovx/conformance_tests/test_data'

    You can edit the file tiovx/tidl/tidl_infer.cfg located in the above path to point to your model.

    Then you should be able to run vx_tutorial_exe again without any errorYou can use eclipse IDE to set breakpoint, set through the code, look at the memory, variables, etc. Please refer to: https://help.eclipse.org/kepler/index.jsp?topic=%2Forg.eclipse.cdt.doc.user%2Ftasks%2Fcdt_t_debug_prog.htm

  • This list of numbers:

    135.6581
    25.1624
    36.1026
    25.1624
    35.0085
    59.0769
    134.5641
    59.0769
    -8.7521
    -16.4103
    -8.7521
    -14.2222
    -9.8462
    -16.4103
    4.3761
    -16.4103

    Is this what your expect or is it wrong ? If it is wrong, is this from the output on the hyperterminal when you run your openVX application on the EVM ? Or is it from host emulation ?

    I have not tested on the EVM as I observed that the results are OK in host emulation.

  • Hi Victor,

    This list of numbers is my expect . And I can get this result from import tools (in tempDir files) and the infer tools.

    And I'm also apply this model to tidl file I/O usecase. the result is correct in fixed point.

    however this openVX application still can't show the correct result(its fixed point result is right as you show before).

    Can you test on an EVM?

  • Hi,

    The list generated by the import tools and infer tools is wrong. I think it is the same problem: they probably use '%f' to display the list, instead of '%g'. The correct output is:

    2.1e-24

    6.1e-05

    -9.8e+30

    -2.7e+30

    If you open the file output_16x1.y in an hexadecimal viewer, you will see that 0x1824177f gets translated to 2.12e-24, please see below:

    How did you obtain the sequence of numbers :

    135.6581
    25.1624
    36.1026

    ..

    Was it directly output in a particular file ?

  • Hi, In TIDeepLearningLibrary_UserGuide.pdf

    10. What is Q format of output?
    The output is 8 bit fixed point representation with the scaling factor. The 8 bit value can be divided by scaling factor to get the floating point value. The scaling factor (in Q8 format) is available in dataQ of (sTIDL_DataParams_t). Import tool also prints this information for sample data as “Out Q : X”.
    Related E2E query : https://e2e.ti.com/support/arm/automotive_processors/f/1021/t/642684

    I think we just get the correct  8 bit fixed point, in the vx_tutorial_tidl.c , I didn't find the fixed-point conversion floating point code,don't these two demos - Image classification and detected objects need to be converted?

    I get the dataQ from my infer tools:

    Not belongs to this group!
    inPtrs 0x1605528
     Layer    1 : Out Q :      433 , TIDL_BatchNormLayer  , PASSED  #MMACs =     0.05,     0.05, Sparsity :   0.00
     Layer    2 : Out Q :     8614 , TIDL_ConvolutionLayer, PASSED  #MMACs =    10.50,     3.96, Sparsity :  62.25
     Layer    3 : Out Q :    10594 , TIDL_ConvolutionLayer, PASSED  #MMACs =    10.76,     6.09, Sparsity :  43.38
     Layer    4 :TIDL_PoolingLayer,     PASSED  #MMACs =     0.01,     0.01, Sparsity :   0.00
     Layer    5 : Out Q :    14452 , TIDL_ConvolutionLayer, PASSED  #MMACs =     8.13,     4.39, Sparsity :  45.96
     Layer    6 : Out Q :    12247 , TIDL_ConvolutionLayer, PASSED  #MMACs =     4.06,     2.44, Sparsity :  39.84
     Layer    7 :TIDL_PoolingLayer,     PASSED  #MMACs =     0.01,     0.01, Sparsity :   0.00
     Layer    8 : Out Q :    11734 , TIDL_ConvolutionLayer, PASSED  #MMACs =     8.92,     8.92, Sparsity :   0.00
     Layer    9 : Out Q :    15668 , TIDL_ConvolutionLayer, PASSED  #MMACs =     4.46,     4.46, Sparsity :   0.00
     Layer   10 :TIDL_PoolingLayer,     PASSED  #MMACs =     0.00,     0.00, Sparsity :   0.00
     Layer   11 : Out Q :    12691 , TIDL_ConvolutionLayer, PASSED  #MMACs =    10.62,    10.62, Sparsity :   0.00
     Layer   12 : Out Q :    12361 , TIDL_ConvolutionLayer, PASSED  #MMACs =     5.31,     5.31, Sparsity :   0.00
     Layer   13 : Out Q :    21468 , TIDL_ConvolutionLayer, PASSED  #MMACs =     5.31,     5.31, Sparsity :   0.00
     Layer   14 : Out Q :    11816 , TIDL_ConvolutionLayer, PASSED  #MMACs =     1.33,     1.33, Sparsity :   0.00
     Layer   15 : Out Q :    53712 , TIDL_PoolingLayer,     PASSED  #MMACs =     0.00,     0.00, Sparsity :   0.00
     Layer   16 : Out Q :    24791 , TIDL_InnerProductLayer,     PASSED  #MMACs =     0.00,     0.00, Sparsity :   0.00
     Layer   17 : Out Q :     5616 , TIDL_InnerProductLayer,     PASSED  #MMACs =     0.00,     0.00, Sparsity :   0.00
     Layer   18 : Out Q :      234 , TIDL_InnerProductLayer,     PASSED  #MMACs =     0.00,     0.00, Sparsity :   0.00

    so 135.6581 = 7c/(234/256)  7C or 7F are all OK.

    you also can get it in trace_dump_18_16x1.y_float.txt or trace_dump_18_16x1.y

  • for tidl_OD usecase ,when get the fixed point after reading net, this application will call tidl_tb.c. some code listed blew:

           if (dataBuffParam->elementType == 0)
            {
              uint8_t * src, *dst;
              int32_t k;
              src = (uint8_t *)(ptr + j*chPitch + i*linePitch + TIDL_MAX_PAD_SIZE*linePitch + TIDL_MAX_PAD_SIZE);
              dst = (uint8_t *)(outPtr + offset);
              for (k = 0; k < dataBuffParam->dimValues[3]; k++)
              {
                dst[k]     = src[k];
                floatPtr[offset+k] = ((float)src[k]) / (dataBuffParam->dataQ/256.0);
              }
            }
            else
            {
              int8_t * src, *dst;
              int32_t k;
              src = (ptr + j*chPitch + i*linePitch + TIDL_MAX_PAD_SIZE*linePitch + TIDL_MAX_PAD_SIZE);
              dst = (outPtr + offset);
              for (k = 0; k < dataBuffParam->dimValues[3]; k++)
              {
                floatPtr[k+ offset] = ((float)src[k]) / (dataBuffParam->dataQ / 256.0);
                dst[k] = src[k] + 128;
              }
            }

    I didn't see the fixed point convert to float point  in these openvx_OD?

  • Hi Victor,

    Are you still there? Can you help me solve this problem once and for all?

    Thanks!

  • Hi,

    Please try this:

    pOut = (uint8_t *)output_buffer + (ioBufDesc->outPadT[id] * output_sizes[0]) + ioBufDesc->outPadL[id];

    typedef struct {
    int8_t result[16];
    } APALayerObjInfo;
    APALayerObjInfo *pObjInfo;

    pObjInfo = (APALayerObjInfo *)pOut;
    APALayerObjInfo * pObj = pObjInfo;

    uint8_t dataQ;
    vxQueryTensor(output_tensors[id], TIVX_TENSOR_SCALING_DIVISOR, &dataQ, sizeof(dataQ));
    float result_float[16];
    for(i=0;i<16;i++) {
    result_float[i]= ((float)pObj->result[i])/(dataQ/256.0);
    printf("%f|", result_float[i]);
    }
    printf("\n");

  • Hi Victor,

    Thank you for your great support!I've got the right answer now。

    But I still don't understand why OpenVX_OD and Openvx_classification demo does not need to do fixed-point data conversion?I didn't find “vxQueryTensor ” in it ?

  • Hi Victor,

    The output of OD demo listed below, the xmin/xmax * 768 and ymin/ymax *320 can get the right result !

    How do I normalize to get the right result without dataQ ?

    [IPU1-0]     30.487220 s: ObjId|label|score| xmin| ymin| xmax| ymax|
    [IPU1-0]     30.487372 s: ------------------------------------------
    [IPU1-0]     30.487616 s:     0|    1| 0.54| 0.83| 0.51| 0.90| 0.88|
    [IPU1-0]     30.487891 s:     1|    1| 0.50| 0.56| 0.57| 0.58| 0.71|
    [IPU1-0]     30.488135 s:     2|    1| 0.24| 0.41| 0.56| 0.42| 0.61|
    [IPU1-0]     30.488348 s:     3|    2| 0.94| 0.30| 0.58| 0.33| 0.64|
    [IPU1-0]     30.488562 s:     4|    2| 0.74| 0.59| 0.43| 0.61| 0.49|
    [IPU1-0]     30.488989 s:     5|    3| 0.74| 0.33| 0.57| 0.35| 0.60|
    [IPU1-0]     30.489233 s:     6|    3| 0.61| 0.88| 0.56| 1.00| 0.83|
    [IPU1-0]     30.489446 s:     7|    3| 0.46| 0.02| 0.57| 0.18| 0.75|

  • Hi,

    Usually the last layer is a control layer such as softmax for classification or detection output layer for OD and doesn't need fixed-point data conversion. In your model, the layer layer is concat layer, which is a computer layer. Since all the computations are done in fixed-point, they need to be converted to floating point before being consumed by the application.

    Victor

  • The output of the OD demo doesn't need to be normalized because the last layer is a detection output layer. As you pointed out, just need to multiply xmin and xmax with 768, ymin and ymax with 320.

  • Hi Victor.

    Thank you for your long time of technical support and patient answer.

    I learned a lot. Thank you very much ! 

    Thank you !