Getting incorrect inference time in tensorflow sdk example

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Getting incorrect inference time in tensorflow sdk example

2,105 Views
Ramson
Contributor IV

Hi team,

I'm running evkmimxrt1170_tensorflow_lite_micro_label_image_cm7 on the RT1170 EVK kit. 

The inference time calculated using the systick timer in the example is incorrect when matched with the system time. 

The inference time printed is as below. 

Ramson_0-1644211109461.png

which shows approximately 530ms for inferencing, which is not correct. 

To check that if we put prints before and after run inference function as shown below:

Ramson_2-1644211360375.png

which results in the below output:

Ramson_3-1644211788320.png

If we check the time difference, it is 270ms. 

I have also tried using pit timer which is provided as an example. It doesn't work properly when other process is running. 

Can you please look into this issue and provide a solution.

Thanks & Regards,

Ramson Jehu K

0 Kudos
3 Replies

1,980 Views
david_piskula
NXP Employee
NXP Employee

Hello Ramson,

I tried using the tool you suggested. Unlike you, I get a longer time difference between the prints (about 770 ms) than I get from subtracting startTime from endTime (around 530 ms). I'm not sure how reliable the the Docklight application is for measuring on-chip time this way. I assume the timestamps are logged at the time of receiving data in Docklight from the board, not at the time of sending the data from the board. Therefore they don't really represent how much time passed between them on the board itself.

Nevertheless, it is indeed interesting that the time difference is smaller for you. Have you tried keeping the original outputs together with the before/after prints? Like so:

david_piskula_0-1646315550178.png

Additionally, when using a release build, the difference is only about 2 ms when using this code to read both time measurements:

printf("Before" EOL);
auto startTime = TIMER_GetTimeInUS();
MODEL_RunInference();
auto endTime = TIMER_GetTimeInUS();
printf("After" EOL);

 Can you try a release build as well?

Best Regards,

David

0 Kudos

2,043 Views
david_piskula
NXP Employee
NXP Employee

Hello Ramson,

can you let me know what kind ouf serial output terminal you are using? I usually use PuTTY, which doesn't show timestamps and I'm not sure what terminal actually supports this feature.

Thanks,

David

0 Kudos

2,039 Views
Ramson
Contributor IV

Hi david,

There is application called docklight. To enable timestamp go to tools > Options > date/time stamps.

Ramson_0-1645506028404.png

This is the settings I use.

Thanks,

Ramson 

0 Kudos