How can I modify the code of Edge Impulse?"

Question/Issue:“I have trained a model that runs on an ESP32-CAM. I want to add two servos to the program so that when objects are recognized, they perform certain movements. I am confused about which part of the code to use.”

**Project ID:**object detection

Context/Use case:

Hi @tepes,

After calling run_classifier(), your inference results will be stored in an ei_impulse_result_classification_t struct (you can read the API docs for that struct here). From there, you need to access the classification values and find the maximum value to determine the class. See this code example for how to access the classification values.

For example, if your ei_impulse_result_classification_t is named result, then you can do something like the following (assuming class 0 is “idle” and class 1 is “my_movement”):

if result.classification[1].value >= 0.5 {
  // Do servo movement

Hope that helps!