Spaces:
Sleeping
Sleeping
Ticket Name: RTOS/TDA2: TIDL: How can I get DataQ value for an output tensor? | |
Query Text: | |
Part Number: TDA2 Tool/software: TI-RTOS Hi guys, I have been studying TIDL for a while and after getting some good understanding on it now I am adding a new object detector into TIDL_OD example. TIDL_OD implemented SSD detection method but I removed SSD from it and added a Yolo V2 like detector on the base network. So now I got the output tensor from it whose size is [1 x 40 x 18 x 32] and I need to parse those blob to come up with coordinates of bounding boxes. The real problem is that I need to convert those numbers into floating values. So I dig into some threads discussing this issues. In the end, the conclusion is two piece of information. one from User Guide of TIDL and one from this web site. Here is the answer. ---- 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 sampledata as “Out Q : X”. Related E2E query : e2e.ti.com/.../642684 ---- But when I print out the following variables from net structure right after running TIDL algorithm. It shows all zeros on dataQ fields. (sTIDL_DataParams_t). From the source code, vision_sdk/apps/src/rtos/alg_plugins/tidl/tidlLink_algPlugin.c At the function AlgorithmLink_tidlProcess(), I added the following printing lines: i from 0 to 28 , since I have 28 layers. Vps_printf("net->TIDLLayers[%d].outData[%d].dataQ = %d\n", i, 0, net->TIDLLayers[i].outData[0].dataQ); Vps_printf("net->TIDLLayers[%d].inData[%d].dataQ = %d\n", i, 0, net->TIDLLayers[i].inData[0].dataQ); I need to know that dataQ value to calculate a scale factor to convert those 8bit quantized values into floating values. Can you help me on how I can get those dataQ values for my last convolutional layer? And if I run a statical tool called quantStatTool (exe binary), it print out the Out Q values, basically how you to print those Out Q values? Thanks in advance! | |
Responses: | |
Please find the dataQ information as part of outArgs typedef struct { IVISION_OutArgs iVisionOutArgs; int32_t numOutBufs; int32_t dataQ[TIDL_NUM_OUT_BUFS]; } TIDL_outArgs; | |
Hi Kumar, Thanks a lot for your answer. Indeed I already checked the outArgs struct too since I guessed that it might has the dataQ values for output buffers (i.e., output tensors). I thought that it is the right answer, but when I print out dataQ[0] to dataQ[15] (since there are 16 buffers), only the first value has some output numbers all others (15) are zeros. This is fine since I have only one output buffer (convolutional layer), but dataQ[0] value begins from a value of 1402 and goes down to 42, and sometimes shows 0. 0 dataQ value is something wrong, isn't it? Anyway, thanks for confirming my hypothesis is indeed correct. What do you think about those zeros dataQ values sometimes? | |
1402 looks reasonable to me. DataQ ero mean almos all the tensor values are zero. Is the input image is dark r staurated during this Data zero case. Are you getting the expected output during import. If yes, try to run import with more images. | |