Compilation Failures running Object Detection Model on Arduino IDE for ESP32CAM board

Hi,
This is in relation to my EI project - anupamguptacal-project-1

I’ve been trying to use Edge Impulse to train an object detection model. I have a trained model and translated it to an Arduino Library for deployment. I’m deploying to an ESP32 CAM and have already validated that the example from here: https://github.com/edgeimpulse/example-esp32-cam works correctly post deployment and provides good accuracy.

All I’m doing post this point, is replacing their included library with the Arduino Library I created for my project but I keep facing this problem with some of the fields of the structs not being recognized(during compilation). Specifically the following:

Basic-Image-Classification:164:42: error: 'struct ei_impulse_result_t' has no member named 'classification'
     ei_printf("    %s: \t%f\r\n", result.classification[ix].label, result.classification[ix].value);

and

anupamguptacal-project-1_inferencing\src/edge-impulse-sdk/classifier/ei_run_classifier.h:588:93: error: 'post_process_classes' is not a member of 'tflite'
     fill_result_struct_f32(result, tflite::post_process_boxes, tflite::post_process_scores, tflite::post_process_classes, debug);

and

anupamguptacal-project-1_inferencing\src/edge-impulse-sdk/classifier/ei_run_classifier.h:588:64: error: 'post_process_scores' is not a member of 'tflite'
     fill_result_struct_f32(result, tflite::post_process_boxes, tflite::post_process_scores, tflite::post_process_classes, debug);

My understanding of Object Detection is that it does both Bounding Boxes as well as Classification (I’ve validated this is as expected under the Live Classification Section of the website).

I did some digging around and it seems that in the file ei_classifier_types.cpp in the library, ei_impulse_result_classification_t classification[EI_CLASSIFIER_LABEL_COUNT] is not set if the EI_CLASSIFIER_OBJECT_DETECTION flag is set as 1. I also see that in my model_metadata file, I have the following flags set:

#define EI_CLASSIFIER_OBJECT_DETECTION           1
#define EI_CLASSIFIER_OBJECT_DETECTION_COUNT     10
#define EI_CLASSIFIER_OBJECT_DETECTION_THRESHOLD 0.5
#define EI_CLASSIFIER_TFLITE_OUTPUT_LABELS_TENSOR 1
#define EI_CLASSIFIER_TFLITE_OUTPUT_SCORE_TENSOR  2

I haven’t dived into the tensor flow errors but maybe it’s something similar. I guess my question is: What am I doing wrong? Is there an example I can follow that defines how to use object detection models with the Arduino IDE? Or did I deploy my model incorrectly in the first place itself and I need to undo something?

Any advice in this regard would be really helpful. Thank you!

I’m getting the same error as above when using the unedited model from here: https://docs.edgeimpulse.com/docs/object-detection as an arduino library. Compilation on Arduino IDE fails with the error that there is no post_process_boxes, post_process_classes and post_process_scores defined for tflite and 'struct ei_impulse_result_t' has no member named 'classification'. So maybe this is not specific to my library only?

Hello @anupamguptacal,

Object Detection models cannot fit at the moment on the ESP32 CAM. We are working on smaller models at the moment as it has been announced on the opening keynote during our Imagine event (https://youtu.be/jTDjO1xf-yc?t=3025 around min 50).

Regards,

Louis

1 Like