Introduction to TinyML: What is it and Why does it matter?

Published  October 19, 2021   0
Introduction to TinyML

TinyML introduces Machine Learning to the scene by incorporating Artificial Intelligence into small hardware components. You’ll need some knowledge of machine learning and embedded software development to build a TinyML project. Neither of these abilities is common, and only a few people are proficient in both. So, to make you familiar with TinyML and its applications, we are building a TinyML tutorial series by assuming that you have no experience with machine learning and embedded software development. Using examples like simple voice recognition, identifying motions using a motion sensor, and detecting individuals with a camera sensor, we'll show you some practical uses of machine learning on embedded devices.

Introduction to TinyML

Tiny machine learning is a rapidly growing field of machine learning technologies and applications that includes hardware (dedicated integrated circuits), algorithms, and software capable of performing on-device sensor (camera / color vision, audio, IMU, biomedical) data analytics at extremely low power, typically in the mW range and below, enabling a variety of always-on use-cases and targeting battery-powered devices. TinyML is a branch of machine learning and embedded systems research that looks into the types of models that can be run on small, low-power devices like microcontrollers. It delivers low-latency, low-power, and low-bandwidth model inference at edge devices. A typical microcontroller consumes electricity in the milliwatts or microwatts range, whereas a typical consumer CPU consumes between 65 and 85 watts and a typical consumer GPU consumes between 200 and 500 watts. This equates to a thousand-fold reduction in power use. Because of their low power consumption, TinyML devices can run on batteries for weeks, months, or even years while running machine learning applications.

Why we need TinyML?

Now a days, we are listening about AI Camera, AI washing machine and AI electronic devices. In these devices, Machine Learning is used to make sense of noisy sensor data. But the challenge with embedded devices is that they are tiny and most of them run on battery. As Machine Learning models consume a lot of processing power, it is not suitable for creating models on battery powered devices. This is where the TinyML comes into play. In TinyML, we can run neural network model in any board by using less than 1mW Energy. It means that a device powered by a coin battery will last a year. As a result, the device is tiny enough to fit into any setting and is capable of running for an extended period of time without the need for human interaction.

TinyML makes it possible to run machine learning models on small microcontrollers. We have used many devices like Raspberry PI, ESP32. These are great devices, but even the tiniest Pi draws hundreds of milliwatts, similar to a mobile phone's main CPU. It takes a battery similar to that of a smartphone to keep one running for even a few days, making it challenging to create completely untethered experiences. TinyML is defined as having an energy consumption of less than 1 mW, so we must go to the realm of embedded devices for our hardware platforms. We will use such devices for TinyML which consumes very less power and able to run machine learning algorithms.

Hardware for TinyML

Now we have basic understanding of TinyML, let’s discuss about the hardware that we can use to run TinyML models. To test your programs, you'll also need an embedded development board with some sensors such as microphone, accelerometers, or a camera attached to perform something interesting, and you'll need something tiny enough to build into a practical prototype project, as well as a battery. So, for this series we are going to use Arduino Nano 33 BLE Sense embedded board. You can follow our previous article on Arduino Nano 33 BLE Sense Review - What's New and How to Get Started? for basic understanding of Arduino Nano 33 BLE.

Arduino Nano 33 BLE Sense Board 

It is very small AI enabled board in 45*18mm size. It is powerful version of the regular Arduino Nano, with the nRF52840 from Nordic Semiconductors, a 32-bit ARM CortexTM-M4 CPU running at 64 MHz. It will allow you to write larger programs (it has 1MB of programme memory, which is 32 times greater than the Uno) and with a lot more variables than with the Arduino Uno (the RAM is 128 times bigger). Other remarkable features of the main processor include Bluetooth pairing via NFC and super low power consumption modes. It has inbuilt embedded sensors:

  • 9 axis inertial sensor: what makes this board ideal for wearable devices
  • humidity, and temperature sensor: to get highly accurate measurements of the environmental conditions
  • barometric sensor: you could make a simple weather station
  • microphone: to capture and analyze sound in real time
  • gesture, proximity, light color and light intensity sensor: estimate the room’s luminosity, but also whether someone is moving close to the board

Arduino Nano 33 BLE Sense Board

Apart from the outstanding selection of sensors, the key feature of this board is the ability to run Edge Computing applications (AI) on it using TinyML. TensorFlow Lite may be used to develop machine learning models, which can then be uploaded to your board using the Arduino IDE.

Arduino Nano 33 BLE Sense Board

Software for TinyML

The TensorFlow Lite for Microcontrollers framework will be used in all of the projects in the TinyML tutorial series. This is a modified version of the TensorFlow Lite framework that is meant to run on embedded devices with only a few tens of kilobytes of memory.                                             

TensorFlow Lite 

TesnsorFlow Lite

TensorFlow Lite is TensorFlow's mobile and embedded device lightweight solution. It allows you to execute machine-learned models on mobile devices with minimal latency, allowing you to use them for classification, regression, and other tasks without having to make a round trip to a server. TensorFlow Lite and TensorFlow Mobile differ in the following ways: It is the latest TensorFlow mobile version. TensorFlow Lite applications will typically have better performance and smaller binary file sizes than TensorFlow mobile apps.

Advantage of Tiny ML

  • Low power consumption is one of the main advantages of TinyML. We will use microcontrollers here which consumes very less power (less than 1mW). This allows to run devices for an extended period of time without needing to be recharged.
  • It requires very less bandwidth for TinyML project because data does not need to be transferred to the server on a regular basis, less internet bandwidth is consumed.
  • Using TinyML we can develop number of smart sensors and smart devices. TinyML will be widely used in a variety of industries. Retail, healthcare, transportation, wellness, agriculture, fitness, and manufacturing are just a few of the industries that will be affected. By adding the data acquisition and selecting the sensors, such as the accelerometer sensor to sample the phone's movements, our phones can become the edge device that gathers data. This enables it to execute advanced learning models based on artificial neural networks (ANN), which can access and sample tiny sensors and low-power microcontrollers.

Conclusion

Microcontrollers are everywhere, and with the help of sensors attached to them, they collect a vast amount of data. Adding TinyML with these microcontrollers will open up a series of possibilities for applications in IoT devices, such as TVs, cars, coffee machines, watches, and other devices so that they have intelligence that are only restricted to computers and smartphones.

This was a basic introduction tutorial. In our next tutorials in this series, we will develop many TinyML projects for example, wake-word detection, person detection, magic wand and many more.  If you have any questions, please leave them in the comment section below or use our forum to start a discussion on this.

Have any question realated to this Article?

Ask Our Community Members