Abstract
Advances in deep learning have revolutionized machine learning by solving complex tasks such as image, speech, and text recognition. However, training and inference of deep neural networks are resource-intensive. Recently, researchers made efforts to bring inference to IoT edge and sensor devices which have become the prime data sources nowadays. However, running deep neural networks on low-power IoT devices is challenging due to their resource-constraints in memory, compute power, and energy. This paper presents a benchmark to grasp these trade-offs by evaluating three representative deep learning frameworks: uTensor, TF-Lite-Micro, and CMSIS-NN. Our benchmark reveals significant differences and trade-offs for each framework and its tool-chain: (1) We find that uTensor is the most straightforward framework to use, followed by TF-Micro, and then CMSIS-NN. (2) Our evaluation shows large differences in energy, RAM, and Flash footprints. For example, in terms of energy, CMSIS-NN is the most efficient, followed by TF-Micro and then uTensor, each with a significant gap.
Introduction
In the world of the Internet of Things (IoT), data is everywhere, but the "brains" to process it are often stuck in the cloud. Moving deep learning (DL) from massive data centers to tiny, battery-powered sensors—a field known as TinyML—is the next great frontier. But for an engineer standing at the edge, the choice of tools is overwhelming.
A recent study by researchers at Chalmers University of Technology and Kiel University provides a much-needed roadmap for this landscape, benchmarking three major TinyML frameworks—uTensor, TensorFlow Lite Micro (TF-Micro), and CMSIS-NN—on resource-constrained ARM hardware.
The Challenge of Edge Inference
IoT devices are the primary sources of data today, but they are notoriously "resource-poor," typically featuring memory in the kilobyte range and strict power budgets. Traditionally, data is offloaded to the cloud, but this raises concerns regarding privacy and bandwidth.
Bringing inference directly onto the device solves these issues. However, developers face the tedious task of manually managing memory and computation. There is a lack of clear benchmarks comparing how different software frameworks handle the brutal constraints of low-power hardware.
Methodology
The researchers evaluated three representative frameworks:
- uTensor: Built for rapid prototyping on Mbed-OS. It’s highly automated but relies on dynamic memory allocation.
- TensorFlow Lite Micro: The industry heavyweight from Google, designed to run as a stand-alone library.
- CMSIS-NN: An ARM-specific library providing low-level, hand-optimized kernels. It requires manual network definition in C.
The team used a standardized pipeline: they trained Convolutional Neural Networks (CNNs) in Keras, applied quantization (converting 32-bit floating-point weights into 8-bit integers), and deployed them on an nRF52840-DK (ARM Cortex-M4, 256 KB RAM, 1 MB Flash).
The frameworks were tested against two classic computer vision benchmarks, scaled by varying the number of convolution kernels (16 to 128): MNIST (handwritten digits) and CIFAR-10 (color images).
Key Insights
- The Usability-Efficiency Paradox: There is a stark trade-off between developer productivity and runtime performance. uTensor is easy to use but the least efficient; CMSIS-NN is hard to implement but dominates performance.
- Hardware Acceleration: CMSIS-NN’s lead is due to its use of on-board DSP (Digital Signal Processor) instructions. Other frameworks use more generic C++ code.
- Memory Management: CMSIS-NN uses static memory allocation. While predictable, it is "greedy." For the largest models, CMSIS-NN can exceed device RAM limits because it allocates all buffers upfront.
Results
The quantitative differences are significant:
- Execution Time: For the largest MNIST model, CMSIS-NN finished inference in 8.4 seconds, while TF-Micro took 43.4 seconds and uTensor took 139 seconds.
- Energy Consumption: CMSIS-NN consumed 230 mJ, compared to 860 mJ for TF-Micro and 3,203 mJ for uTensor.
- Memory Footprint: RAM usage scales with the number of kernels. As shown in the benchmarking results, larger models quickly approach the physical limits of the IoT hardware.
Conclusion
The study highlights that while frameworks like uTensor and TF-Micro offer ease of use, CMSIS-NN remains the superior choice for performance-critical, battery-powered applications. Future work should explore other architectures like RNNs and additional optimization techniques like weight pruning to further push the boundaries of what is possible at the edge.
Summary updated