How to determine object detection position when using Micro

(This was posted under specialty Micro sub-topic without any response. I thought I would try posting to top level forum for more visibility.)

I have TF Lite working on an ESP32 using the person detection example code from tflite-micro-esp-examples/examples/person_detection at master · espressif/tflite-micro-esp-examples · GitHub

I need to be able to retrieve the person’s location from the tensor output data. I don’t see this data coming back. I only get 2 values back (person_score and no_person_score) in the output data array. Is there a configuration that I can set to enable the 2 data point locations (upper left & lower right) to be sent back within the data array?

Hi @Michael_Bester,

Please check the model has bounding box output. If so, in order to display the person location in terms of bounding box coordinates, please update the file main_functions.cc with the following code and update accordingly the related files.

TFLiteTensor* output = interpreter->output(1); #if output available at 1
float* bounding_box = output->data.f;  
# Top-left coordinates(x1,y1) and bottom right coordinates(x2, y2)
float x1 = bounding_box[0];  
float y1 = bounding_box[1];  
float x2 = bounding_box[2];  
float y2 = bounding_box[3];  

# Pass these coordinates to the RespondToDetection function( )
RespondToDetection(person_score_f, no_person_score_f, x1, y1, x2, y2);

Thank You