TinyML Image Classification On ESP32-CAM Development Board and Edge Impulse Studio
Recent breakthroughs in embedded machine learning have increased the demand for TinyML applications. In dealing with TinyML, there is an excellent platform to get started and build complex projects, Edge Impulse. We have also witnessed several new embedded devices coming to market primarily designed with TinyML capabilities. This is only possible because of the support from the communication in solving some of the really critical problem statements.[Marcelo Rovai] published a detailed write-up on learning image classification on embedded hardware, ESP32-CAM, and showcasing the flexibility brought in by the affordable and powerful development board. As Edge Impulse has captured the market for TinyML easy implementation, the embedded developer has decided to use Edge Impulse Studio for the software side. Circling back to the hardware, ESP32-CAM incorporates the Espressif’s ESP32-S microcontroller chip along with a highly integrated ArduCam OV2640 camera.
Supporting I2C, SPI and UART communication give the opportunity to interface external devices and sensors. Since the hardware does not have a USB-TTL serial module for programming, the maker uses a special adapter to upload the load onto the ESP32-CAM. For those unfamiliar with the ESP32-CAM module, the hacker recommends referring to some of the online resources publicly available with a highlight on the books and tutorials of Rui Santos.
Starting with the software side of the TinyML Image Classification project, the initialization of the ESP32-CAM development board onto the Arduino IDE is the same as done for other setups. The first thing for any hardware development project is to test the board by blinking the LED. For the employed hardware, the built-in LED is connected with GPIO33, which will ease the code building process. For this specific project, [Marcelo Rovai] also decides on testing the Wi-Fi wireless communication and the onboard camera.
With TinyML, a set of technics associated with machine learning inference on embedded devices, we should limit the classification to three or four categories due to limitations (mainly memory in this situation).
Training the model with Edge Impulse Studio has a dataset containing images of several fruits and vegetables with each category being split into train, test, and validation with 100, 10, and 10 images respectively. The model in this case reached an accuracy of 77%, which is decently good for the amount of RAM on the ESP32-CAM development board. Once the software is uploaded to the hardware, the setup seems to work perfectly fine, just as expected for the initial goal.
For more details on the TinyML Image Classification project, visit the complete write-up on the Hackster project.