EdgeImpulse Object Detection

Project Overview

This project utilizes the ESP32-S3 AI CAM module and EdgeImpulse to recognize apples and oranges. Through this project, you will learn how to train your own model using EdgeImpulse and deploy it on the ESP32-S3 AI CAM module.

firebeetle ESP32

Data Collection

  1. Burn the "CameraWebServer" example code to the ESP32-S3 AI CAM module.
  2. Open the serial monitor to check the IP address.
  3. Access the IP address through a browser on a device within the same local network. Click the “Start” button to view the camera feed.
  4. Save images to your computer by clicking the upper-right corner of the video frame. (It is recommended to save images of different objects in separate folders for easier data labeling during training.)

Note: Collect as much image data as possible to improve model accuracy. For this project, around 50 images of apples and oranges were used.

firebeetle ESP32

Collected image dataset:

firebeetle ESP32

Data Labeling

  1. Create a new project in EdgeImpulse.
firebeetle ESP32
  1. Click “Add existing data” to upload collected images.
firebeetle ESP32
  1. Select “Upload data” and upload image files. Enter corresponding labels for the images.
firebeetle ESP32
  1. In “Data acquisition -> Labeling queue”, mark the object of interest in the images and save.
firebeetle ESP32

Example: Labeling oranges:

firebeetle ESP32

Training the Model

  1. Once all data is labeled, navigate to “Impulse design -> Create impulse” to create and save your impulse.
    Processing blocks explanation: EdgeImpulse Documentation

    firebeetle ESP32
  2. Go to the “image” page and click “Save parameters”.

    firebeetle ESP32
  3. Navigate to the “Generate features” page and click “Generate features” to extract image features.

    firebeetle ESP32
  4. Go to “Object detection”, then click “Save & train” to train the model.

    firebeetle ESP32
  5. Once training is complete, review model performance. Adjust parameters and retrain if necessary.

    firebeetle ESP32
  6. Go to the "Retrain model" page and click "Train model"

    firebeetle ESP32

Deploying the Model

  1. In the “Deployment” page:

    • Select “Arduino library” under “DEFAULT DEPLOYMENT.”
    • Choose “TensorFlow Lite” under “MODEL OPTIMIZATIONS.”
    • Click “Build” to download the library.
    firebeetle ESP32
  2. Extract the library into the “Arduino->libraries” folder.

  3. Replace the files in “src\edge-impulse-sdk\tensorflow\lite\micro\kernels” with the modified depthwise_conv.cpp and conv.cpp files.

  4. Move the edge_camera folder to the library's examples directory.

  5. Open the edge_camera example in Arduino IDE. Update the code to include the library .h file and enter your Wi-Fi credentials. Compile and upload the code to the ESP32-S3 AI CAM module.

  6. Open the serial monitor to view the IP address and recognition results. Access the camera feed through the IP address in your browser.

firebeetle ESP32