Machine learning used to be executed in the cloud, then the inference part moved to the edge, and we’ve even seen micro-controllers able to do image recognition with GAP8 RISC-V micro-controller.
But I’ve recently come across a white paper entitled “Resource-efficient Machine Learning in 2 KB RAM for the Internet of Things” that shows how it’s possible to perform such tasks with very little resources.
Here’s the abstract:
This paper develops a novel tree-based algorithm, called Bonsai, for efficient prediction on IoT devices – such as those based on the Arduino Uno board having an 8 bit ATmega328P microcontroller operating at 16 MHz with no native floating point support, 2 KB RAM and 32 KB read-only flash. Bonsai maintains prediction accuracy while minimizing model size and prediction costs by: (a) developing a tree model which learns a single, shallow, sparse tree with powerful nodes; (b) sparsely projecting all data into a low-dimensional space in which the tree is learnt; and (c) jointly learning all tree and projection parameters. Experimental results on multiple benchmark datasets demonstrate that Bonsai can make predictions in milliseconds even on slow microcontrollers, can fit in KB of memory, has lower battery consumption than all other algorithms while achieving prediction accuracies that can be as much as 30% higher than state-of-the-art methods for resource-efficient machine learning. Bonsai is also shown to generalize to other resource constrained settings beyond IoT by generating significantly better search results as compared to Bing’s L3 ranker when the model size is restricted to 300 bytes
The researchers actually tested it on both Arduino Uno (2KB RAM available) and BBC Micro:bit (16KB RAM available). Training is done in a laptop or the cloud, then you load the results on the development board which are able to perform inference by themselves without external help. They compare it to other algorithm that takes several megabytes instead of under 2 kilobytes for the same, and in some cases even end up with lower accuracy. Power consumption of Bonsai algorithm is also significantly lower. You’ll find all the details, including the mathematical formula of the algorithm in the white paper linked in the introduction. The source code can be found in Github, where we can find out the project was carried out by Microsoft Research India.
Via AlessandroDevs and Mininodes