Skip to content

Builds and runs an exported image classification impulse on ESP32 Cam

License

Notifications You must be signed in to change notification settings

edgeimpulse/example-esp32-cam

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

[Deprecated] - ESP32 Cam and Edge Impulse

Update 2022/10:

ESP32 examples are now directly available in the Arduino Library deployments. This repository should no longer be used.

Update 2022/04/27:

We officially released the support for the ESP-EYE on April 27th 2022 which uses ESP-IDF instead of Arduino. You can use other boards too by changing the pins definition and recompiling your firmware. This repository is still working but there as there is no hardware acceleration available on the Arduino IDE esp32 board definition, we strongly suggest to use ESP-IDF.

How to run custom inference on a ESP32 cam using Edge Impulse.

Material

esp32-cam

This code has been tested the AI Thinker ESP32 Cam module. It should work the same with the Wrover board or an board that has PSRAM.

To use this board, please select your board in the Arduino code the following lines:

// Select camera model

#define CAMERA_MODEL_WROVER_KIT // Has PSRAM
//#define CAMERA_MODEL_ESP_EYE // Has PSRAM
//#define CAMERA_MODEL_M5STACK_PSRAM // Has PSRAM
//#define CAMERA_MODEL_M5STACK_V2_PSRAM // M5Camera version B Has PSRAM
//#define CAMERA_MODEL_M5STACK_WIDE // Has PSRAM
//#define CAMERA_MODEL_M5STACK_ESP32CAM // No PSRAM
//#define CAMERA_MODEL_AI_THINKER // Has PSRAM
//#define CAMERA_MODEL_TTGO_T_JOURNAL // No PSRAM

Steps

  • Create your Image Classification model using Edge Impulse.

Due to the board limitations, you may need to train your model with 96x96 images and use the MobileNetV1 0.01:

creat-impulse

  • Download the Arduino library under the Deployment tab in the Edge Impulse studio dl-arduino-lib

Basic Image Classification Example

Note: On Sept 9th 2021, the issue predicting always the same classes has been fixed

  • Open the Basic-Image-Classification.ino file under the /Basic-Image-Classification folder.
  • Import the .zip library you have downloaded from Edge Impulse Studio import-zip
  • Change the #include <esp32-cam_image-classification_inference.h> line according to your project name.
  • Compile and deploy the code to your board
  • Open the serial monitor and use the provided IP to capture an image and run the inference: serial-monitor inference

Advanced Image Classification Example (Deprecated)

Note: Deprecated since Basic Example has been fixed and also support bilinear interpolation technique to resize the frame.

Note 2: Here we use the ESP SDK to resize the image in RGB888 format using the bilinear interpolation technique. You can see the funtion declaration on Espressif's Github repository.

  • Open the Basic-Image-Classification.ino file under the /Advanced-Image-Classification folder.
  • Set your WIFI credentials
  • Navigate to the app_httpd.cpp tab.
  • Import the .zip library you have downloaded from Edge Impulse Studio like on the previous example: import-zip
  • Change the #include <euros_coins_classification_inference.h> line according to your project name.
  • Compile and deploy the code to your board
  • Open the serial monitor and use the provided IP to capture an image and run the inference: serial-monitor
  • On your brower navigate to the IP provided by your Serial Console
  • Use the toggle button to activate the Edge Impulse Inference (you need to select an image resolution lower or equal to QVGA).
  • Click on Run inference: inference-50c inference-1e

Ressources

Note: Theses tutorials / repositories have been used to create this project:

About

Builds and runs an exported image classification impulse on ESP32 Cam

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published