How to calculate features on esp32 after exporting as an arduino sketch

I have trained an edge impulse model .But i need to copy paste the features array into arduino sketch evry time .How can the features calcuted on edge impulse calculated on esp .I used data forwarder.

You use the static buffer example. See this doc that shows how to paste features.

1 Like

i have tried it but i need to run the example solely on micro controller the microcontroller should calculate the features and run inference instead of copy paste every time

Hi @dani1122,

The link that @MMarcial posted does show how to run inference on the microcontroller. However, copying and pasting the ‚Äúraw features‚ÄĚ is just for testing to make sure that inference is working (and matches up with what you expect to see from testing in Studio).

To perform inference on the microcontroller without having to copy and past every time, you will need to run a loop that captures data from your sensor (accelerometer, microphone, camera, etc.) and fills up a buffer in the exact same way (as what you did for the static buffer). Then, pass that buffer to the run_classifier() function, which does both feature extraction (as set by the ‚Äúprocessing block‚ÄĚ in Studio) and inference (as set by the ‚Äúlearning block‚ÄĚ).

If you downloaded the Arduino library, I highly recommend looking at the nano_ble33_sense_accelerometer example to see how to do this.

@dani1122 What microcontroller are you using and what sensors are you using?

Check this doc for officially supported boards. The EdgeImpulse library will run on any microcontroller. Whereas, the officially supported boards will have supportings docs that make it easy for a beginner to get started.

I suggest starting with an EdgeImpulse example program and then enhancing for you mission.

Assuming you are using the ESP32 with a camera:

  • Install your custom EdgeImpulse Arduino library using the Ardy IDE menu:
    • Sketch
    • Include Library
    • Add .ZIP Libarary
    • Select your ZIP file, YourLibHere, downloaded from the EdgeImpulse Studio.
      Close the ardy IDE
      Open the Ardy IDE
  • See in the Ardy IDE menu:
    • File
    • Examples
    • Examples for Custom Libraries
    • :_inferencing
    • ESP32
    • ESP32_Camera.ino

The Arduino Nano Shawn mentioned is here.

1 Like