TexasInstruments / edgeai-tidl-tools

Edgeai TIDL Tools and Examples - This repository contains Tools and example developed for Deep learning runtime (DLRT) offering provided by TI’s edge AI solutions.
Other
121 stars 27 forks source link

How can I get the results of per layer traces? #69

Open alright1117 opened 6 months ago

alright1117 commented 6 months ago

Hi, I use the ort example to convert my model. When I set debug_level=4, I don't see any trace result folder as https://github.com/TexasInstruments/edgeai-tidl-tools/blob/09_00_00_06/docs/images/fm_trace_files.png. Could you give me some advise?

spivakoa commented 3 months ago

Hi, the traces are stored under /tmp folder

beetle2069 commented 2 months ago

Encountered the same problem as you, Have you solved the problem?

spivakoa commented 2 months ago

Hi @beetle2069 ,

If you would like to get the traces of the dequantized floating point data, you should set debug_level=4 in the compilation options and run the inference in tidl emulation environment. You should run your model inference in 2 modes - 32 bits and 16/8/mixed (depending on your quantization). Each time you will find the traces under the /tmp folder in your Linux machine. Copy them elsewhere. There will per layer traces files with .bin extension - you should use them and not the files with the .y extension. The difference is that the .bin files are binary files representing the dequantized output per-layer in floating point representation. The .y files are useless as they represent quantized fixed point data and you need to use a scale to dequantize them, but you already have this in .bin files. In order to visualize the data, use the functions from here https://github.com/TexasInstruments/edgeai-tidl-tools/blob/master/docs/tidl_osr_debug.md with 32 bit data vs. fixed point data from your 2 previously collected .bin files. Pay attention that there will not be always exact match between layer indices in 32 and fixed models as fixed point model might also include some data convert layers. Hope I explained it for you.