Experienced person to help with the Edge Impulse model in an ESP32-CAM

Hello,
I want to use a ESP32-CAM to make a color sensor. There will be one cylinder that can be green or red in front of the camera and I want to classify it.

I did two steps and it doesn’t work yet.

  • Step 1. I used the mobile phone to take 25 pictures green and 25 pictures red. I trained the edge impulse with them and obtained 100% of correct classification in the edge impulse. After:

    • I deployed the edge impulse in the mobile phone using the QR code. The classification works very well with 0.90 of confidence.
    • I deployed the edge impulse in a ESP32-CAM. It doesn’t work properly and the confidence is very low.
  • Step 2. I used the ESP32-CAM to take 50 pictures green and 50 pictures red. I trained the edge impulse with them and obtained 91% of correct classification in the edge impulse. After:

    • I deployed the edge impulse in the mobile phone using the QR code. The classification works amazingly well with 1.00 of confidence.
    • I deployed the edge impulse in a ESP32-CAM. It doesn’t work properly and the confidence is very low.

My thoughts:

  • The edge impulse is well trained because it works perfectly with the mobile.
  • I used the ESP32-CAM to take the pictures to train the model. The pictures used for the classification at the deployed ESP32-CAM are very similar to the ones used for the training (light, angle…).

I need help with:

  • I don’t know how to improve the performance of the model in the ESP32-CAM.
  • I guess the camera of the ESP32-CAM is a low quality one. Can it be improved?

Thank you!!

What does it doesn't work properly mean in this context?

Just because the model is making predictions with a low confidence value doesn’t mean the model is performing poorly. If your False Positive Rate and False Negative Rate are zero, then a prediction with 0.01 confidence on a True Positive is perfectly fine.

What are your False Positive Rate and False Negative Rate values?

Thank you MMarcial!
The issue I have it is not the confidence it is the False Positives.
When I use the mobile phone it detects the colors perfectly (very near to 100% of true positives) but when I use the ESP-32 it clasifies allmost all the photos as GREEN. I would say that it classifies the 75% of RED photos as GREEN.

I don’t think the resolution of the camera matters in your use case of classifying different colored cylinders. If the Edge Impulse Studio Feature Explorer chart is showing good separation of classes, then the model should work well when deployed to the ESP hardware.

So at this point I cannot offer any further advice :frowning:

Hello @Mikel,

Could you share here an image example from your training dataset and one taken from the ESP32?
Maybe the angles, brightness, shadows, colors, etc… are different?

Could you use pictures taken from the esp32 device to train your model and see if there is any improvements?

Best,

Louis