Code for MobiCom'22 paper 'TinyML-CAM: 80 FPS Image Recognition in 1 Kb RAM'
Go to file
Bharath Sudharsan, PhD 83be1ce907
2022-10-18 18:02:44 +01:00
ESP32-image-object-classification-live-demo.mp4 Added demo video 2022-07-18 05:57:39 +01:00
LICENSE Initial commit 2022-07-18 05:31:50 +01:00 Update 2022-10-18 18:02:44 +01:00
[h]-HogClassifier.h Updated code 2022-07-23 04:16:33 +01:00
[h]-HogPipeline.h Updated code 2022-07-23 04:16:33 +01:00
[ino]-CameraWebServer.ino Update [ino]-CameraWebServer.ino 2022-07-23 04:26:24 +01:00
[ino]-arduino-ESP32-code.ino added code 2022-07-23 04:08:11 +01:00
[ipynb]-TinyML-CAM-full-code-with-markdown.ipynb added code 2022-07-23 04:08:11 +01:00

TinyML-CAM - Image Recognition System that Runs at 80 FPS in 1 Kb RAM

Demo - HOG and Random Forest based Image Recognition on ESP32

ESP32 classifying Raspberry Pi Pico, Portenta H7, Wio Terminal from image frames


Following can be observed from the video:

  • Time. For image frames, the digital signal processing (DSP) based features extraction time is ≈ 12 ms, while classification time is ≈ < 20 𝜇𝑠 (1/1000th of DSP).

  • FPS. It is 1000/12 ms = 83.3 FPS, which is the time taken by the TinyML-CAM system for HOG features extraction (using DSP) plus classification. Since the ESP32 has a 30 FPS frame rate, just to capture frames, it takes 1000/30 = 33 ms. Since the DSP plus classification time is only ≈ 12 ms, the image recognition happens in real-time between two consecutive frames, thus not altering the ESP32 camera's FPS.

  • Accuracy. As expected during Pairplot analysis, Portenta and Pi (features overlapped) are mislabelled quite often, which can be rectified by improving dataset quality.

  • Memory. Consumes only 1 kB of RAM - difference between the RAM calculated by Arduino IDE before and after adding the TinyML-CAM image recognition system.



  • To capture images from the ESP32 with ease, install Eloquent library via Arduino IDE library manager.
  • To collect images on a PC and train an ML classifier, install EverywhereML Python package.
  • To test the TinyML-CAM pipeline, users only require an ESP32 of any variant:


Future Work

To lower the DSP time (currently 12 ms) by implementing mathematical approximation methods, which will boost the frame rate - i.e., if reduced to 6 ms, then 1000/6 ms = 166.6 FPS.

Similar to the TinyML benchmark, we plan to test the pipeline on a range of datasets, ML algorithms, and IoT boards.