FOMO Deployment with Arduino Library on ESP32 Camera

Hello, I’ve uploaded my FOMO model from the Edge Impulse Studio for deployment and have already built an Arduino library. I’m planning to run this locally on an ESP32 Camera. I have this zip file of the Arduino Library that contains the folders “examples, src, and” but I don’t know where to start. How do I implement my trained model into this code (is the “esp32 cam” sketch in the example folder already all the code for running my trained model) ? And is it suggestible to use other libraries or is Arduino already a good choice?

Try following this EI tutorial. Then learn how to work with Ardy Libs here. Then feel free to ask more specific questions.

Thank you for the response, I’ve checked the ESP32 link. I’m using the ESP-32 CAM and not the ESP-EYE, they’re different variations of the ESP-32 series I think. Are there other tutorials for the ESP-32 CAM specifically?

I think only the ESP32-EYE is officially supported by EI.

The tutorial link provided above says to modify this file based on your ESP32 board.

Also check this depreciated code.

1 Like

Hello @Ceosine,

If you are using the Arduino Library deployment, you can deploy it to the ESP32-Cam, just replace in your sketch:




However, for the data collection, only ESP-EYE is officially supported, you can still use the AI-Thinker but you’ll need to recompile Edge Impulse official firmware with a couple of changes like @MMarcial mentionned.




Does the “Has PSRAM” have any affect on performance or the maximum size of the model?

I’ve found that I had to move the “ei_camera_get_data()”-Function in your example script to the beginning. Are the options
options I can change without a problem or is it fixed for these numbers? Because when I tried to load a model with more than 240 pixels in height the whole thing broke down.

@Merten What board are you selecting in the Ardy IDE?

PSRAM affects where the FrameBuffer[] is located:

static camera_config_t camera_config = {
.fb_location = CAMERA_FB_IN_PSRAM,

The #define statements should match your Impulse design.


  • Why are these #define statements here in the INO? Shouldn’t they only exist in model_metadata.h?
  • I also see #define EI_CAMERA_FRAME_BYTE_SIZE 3 is not in model_metadata.h. So is it correct that the value should be 3 is the Impulse is RGB and 1 if the Impulse is grayscale?

Thank you very much for the responses @louis and @MMarcial . It seems that I have an additional problem. The default framesize in my code is QVGA and it works properly. I’ve tried changing it to SXGA, however, it comes up with this error and my camera can’t run the model.

More so, I also tried it with 96X96 framesize but it only yielded to the camera failing to capture images or constantly giving an output of non-existent detections. There are no objects for detection in front of the camera.

Hello @Ceosine ,

Not all camera supports 96X96 and SXGA if I remember correctly. I’d recommend to use QVGA.



Oh, that’s unfortunate. I’ve tried it on another code which is the esp32 cam web server default example sketch and the camera seems to work with all resolutions including 96X96 and SXGA. But when I try it with my code, it still piles up that error. Are there are other solutions to this? Maybe like downloading required packages or installing certain drivers before running the code?