The Power of TinyML: How does TinyML work? The internal workings, Part — 2
TinyML, an appealing acronym for “Tiny Machine Learning,” emerged in the ever-expanding realm of Machine Learning. This discipline of machine learning was committed to an admirable goal: to develop algorithms and models that were not only strong but also incredibly compact. Their ultimate objective was to be able to install these small miracles on embedded devices such as microcontrollers. These small intelligence warriors aimed to bring the miracles of ML to the very core of ordinary electronics, guaranteeing that intelligence could be discovered in even the most insignificant of areas. Wearables, sensors, and mobile phones emerge as the protagonists in the arena of technological breakthroughs, attempting to harness the potential of deploying task-specific models. These models, which are meant to excel in areas like voice recognition, object recognition, and gesture recognition, have the potential to transform the capabilities of these edge devices. Wearables, sensors, and mobile phones may unleash a new level of efficiency and effectiveness by merging these customized models, driving them to unprecedented heights in the arena of technical capability.
Training TinyML Models:
There were two separate paths in the same field of machine learning: training conventional ML models and training TinyML models. These pathways, while similar in nature, had a few notable differences that distinguished them over their training journeys. When trying to design models that strike a careful balance between compactness and precision in the area of microcontrollers, a daunting task arises. These little gadgets, with limited memory and processing power, necessitate a one-of-a-kind strategy to ensure maximum operation. The trick is to create models that are small enough to fit inside these constraints while yet being accurate enough to achieve their goals.
In order to achieve this objective, a plethora of techniques are employed, encompassing a wide array of methodologies and approaches. These techniques serve as the building blocks for the successful execution of the task at hand.
By harnessing the power of these diverse techniques, the desired outcome can be attained with precision and efficiency. The utilization of this multifaceted approach ensures that all aspects of the process are thoroughly addressed, leaving no room for error or oversight.
The utilization of the below techniques is crucial in navigating the complex landscape of this endeavour, ensuring that each step is executed.
1. Quantization
In the realm of Digital Signal Processing, there exists a powerful technique known as Quantization. This technique, akin to a wizard’s spell, possessed the ability to transform the precision of the weights and biases of a model. Just as a skilled alchemist would distil a potent potion, quantization would distil the numerical values of these parameters, reducing their precision. This process, like a master craftsman chiselling away excess material, would strip away unnecessary details, resulting in a more streamlined and efficient model. Thus, through the enchanting process of quantization, the model’s weights and biases gained a newfound simplicity to the model, ready to embark on their journey towards making the model more suitable for deployment on edge devices.
2. Pruning
Machine Learning models possess an intricate network of connections, which allow them to make sense of the vast amount of data. However, as time goes models begin to accumulate unnecessary connections that hinder their efficiency. In order to restore the model’s optimal performance, a technique known as Pruning was employed. Pruning is a meticulous process of removing unimportant connections in the model. By removing these connections, the model becomes compact and efficient, without sacrificing accuracy.
3. Knowledge Distillation
In the pursuit of efficiency and practicality, a group of ingenious researchers devised a brilliant solution known as knowledge distillation. This process involved training a smaller model, aptly named the smaller model, to learn from and mimic the outputs of the larger model. The essence of knowledge distillation lay in the transfer of wisdom from the larger model to its smaller counterpart. By carefully observing and analyzing the intricate patterns and predictions made by the larger model, the smaller model embarked on a journey of learning and growth.
Moving ahead let's explore how TinyML algorithms are implemented using frameworks like TensorFlow Lite and how No Code tools like Google’s Teachable Machine are revolutionizing the accessibility of AI.
TinyML: Efficiency at Its Core
TinyML algorithms are engineered with a singular focus: to be lean and mean, packing AI power into tiny packages. This translates to low memory and processing requirements, allowing them to run seamlessly on resource-constrained devices. The efficiency of TinyML algorithms plays a pivotal role in expanding the horizons of AI, especially in scenarios where traditional cloud-based AI might fall short.
TensorFlow Lite: Optimizing for the Edge
One of the key enablers of TinyML is TensorFlow Lite. This open-source framework is specifically optimized for microcontrollers and other small devices. It allows developers to seamlessly deploy machine learning models on edge devices with limited computational resources. TensorFlow Lite achieves this through techniques like quantization, which reduces the precision of model parameters, and pruning, which trims unnecessary connections in neural networks as mentioned previously.
The result? Models that can execute sophisticated AI tasks locally, without relying on the cloud. This not only minimizes latency but also conserves power, making it an ideal choice for applications like autonomous robots, wearable health devices, and more.
No Code Tools: Democratizing AI
But what if you’re not a seasoned AI programmer? What if you lack the coding prowess to dive into the intricacies of TensorFlow Lite? This is where No Code tools like Google’s Teachable Machine come into play.
Teachable Machine is a web-based tool that empowers users to build and export image, audio, and pose-based AI models with minimal effort and zero prior AI programming experience. It democratizes AI by making it accessible to a broader audience, ranging from artists and hobbyists to educators and entrepreneurs.
Tiny Sorter: A Real-World Example
To illustrate the power of TinyML and No Code tool: Teachable Machine, let’s dive into a captivating real-world project: the Tiny Sorter. This do-it-yourself experiment brings together Arduino and a Teachable Machine Image Classification model.
The challenge? To classify cereals and marshmallows.
With a basic hardware setup involving a camera module, the Tiny Sorter captures images of incoming objects (cereals and marshmallows). These images are then sent to the tensorflow.js model exported from Teachable Machine, which has been trained to distinguish between the two.
Using the model’s predictions, the Tiny Sorter sorts the objects into separate containers. What’s truly remarkable here is that this AI-driven sorting process happens entirely at the edge, without any reliance on cloud resources.
Finally, As the demand for edge computing continues to rise, TinyML is poised to become increasingly essential in driving the development of innovative and efficient technologies that have the potential to transform the world.
Resources:
- https://upcommons.upc.edu/bitstream/handle/2117/353756/160036.pdf
- https://news.mit.edu/2021/tiny-machine-learning-design-alleviates-bottleneck-memory-usage-iot-devices-1208
- https://experiments.withgoogle.com/tiny-sorter
- https://www.engineersgarage.com/what-is-tinyml/
TinyML vs. Cloud-Based AI: The Battle for the Future of Edge Computing!
Coming Up Next…………………………………………!
Reach out to me on LinkedIn https://www.linkedin.com/in/saijeevanpuchakayala/ if you want to know more about TinyML.