Skip to Content
All memories

Machine Learning on Micro-controllers

 — #Machine Learning#Micro-controllers#Embeded

There are lot many ML practitioners who are not having any background in Embedded Platform. And on the other hand, Embedded developers also might not be familiar with ML algorithms. But why you need to bring ML to the microcontroller like Arduino Nano Clock 64 MHz, Flash 1 MB, RAM 256 KB.

Why should we run ML on Micro-controllers.?

By running machine learning inference on microcontrollers, developers can add AI to a vast range of hardware devices without relying on network connectivity, which is often subject to bandwidth and power constraints and results in high latency. Running inference on-device can also help preserve privacy since no data has to leave the device.

So these are some of the practical reasons:

  • Accessibility — Users want smart devices to respond quickly to the local environment. Also, it should consider all the - - market scenarios such as size, availability of Internet connectivity and many more.
  • Cost — Device should be within the lowest budget hardware fulfilling all the requirements.
  • Efficiency — Battery life, functionalities, range, durability and most importantly device size. If you are running behind this Arduino Nano got this covered for you.
  • Privacy — Arduino cares about your data and takes the precautions to make sure that your data is in safe hands.

TensorFlow Lite Micro now can be used with the Arduino Nano 33 BLE Sense. This was the much-awaited announcement for all the microcontroller lovers out there.

It doesn’t require operating system support, any standard C or C++ libraries, or dynamic memory allocation. The core runtime fits in 16 KB on an Arm Cortex M3, and with enough operators to run a speech keyword detection model, takes up a total of 22 KB.

The inference examples for TensorFlow Lite for Microcontrollers are now packaged and available through the Arduino Library Manager. We can now easily run them on Arduino in a few clicks. In this section, we’ll show you how to run them. The examples are:

  • micro_speech — speech recognition using the onboard microphone
  • magic_wand — gesture recognition using the onboard IMU
  • person_detection — person detection using an external ArduCam camera

For more background on the examples, you can take a look at the source in the (TensorFlow repository)[https://github.com/tensorflow/tensorflow/tree/master/tensorflow/lite/experimental/micro].

TensorFlow Lite for Microcontrollers is designed for the specific constraints of microcontroller development. If you are working on more powerful devices (for example, an embedded Linux device like the Raspberry Pi), the standard TensorFlow Lite framework might be easier to integrate and more useful as well.

TensorFlow Lite for Microcontrollers is an experimental port of TensorFlow Lite designed to run machine learning models on microcontrollers and other devices with only kilobytes of memory. So, The following limitations should be considered:

  • Support for a limited subset of TensorFlow operations are available (compared to the standard framework)
  • Support for a limited set of devices (all Arduino boards are also not supported till the date)
  • Low-level C++ API requiring manual memory management (If you are a python developer then this might be the toughest task)

Making TensorFlow Lite for Micro-controllers available from within the Arduino environment is a big deal, and as the availability of more pre-trained models, will be a huge change in the accessibility of machine learning in the emerging edge computing market. I will try running some models on Arduino and will share the experience.

Let me know your experience if you have worked already with these tools.!

About Author

Hello! I'm Amey, a social innovator based in Pune, India who enjoys building things that impact the community. I develop exceptional products and deploy those in the community around.!