Ever wandered how fast are the major microcontroller boards to run Tensorflow Lite neural networks? In this post we'll find it out for the case of Fully Connected networks.
** 11 April 2021: added Raspberry Pi Pico with Arduino Mbed Core **
In a previous post about TinyML benchmarks for traditional Machine Learning models I benchmarked many different classifiers from the scikit-learn package in terms of resources and execution speed.
In this post I'm going to do something very similar, except that I'll compare different boards on the task of running Tensorflow Lite Neural Networks.
The boards on the list are:
- Arduino Nano 33 BLE Sense (Cortex M4 @ 64 MHz)
- ESP32 (Xtensa dual-core @ 240 MHz)
- Feather M4 Express (Cortex M4F @ 200 MHz)
- STM32 Nucleo H743ZI2 (Cortex M7 @ 480 MHz)
- Arduino Portenta (Cortex M7 @ 480 MHz)
- Teensy 4.0 (Cortex M7 @ 600 MHz)
- Raspberry Pi Pico (Rp2040 / Cortex M0+ @ 125 MHz)
As you can see, they differ in terms of CPU and clock frequency. I discarded less powerful boards for now (Cortex M0 based), but maybe I'll add them in the future.
** update: I added the Raspberry Pi Pico to the benchmark because of the hype it created. **
The benchmarked networks topology are 3 types of full-connected networks:
- 1 layer with 10 neurons
- 2 layers, one with 10 neurons, the other with 50 neurons
- 10 layers, each with 10 neurons
Inference times
The following charts show the inference time (in microseconds) of the different networks for each board, in linear and logarithmic scale.
What's the verdict?
- Teensy 4.0 is the fastest, as you can expect from its faster clock
- Arduino Portenta and Nucleo H743ZI2 are on quite par, since they share two CPUs from the same family, but the Nucleo is faster over all the topologies
- ESP32 still has a greate performance / price ratio, if you consider that I paid mine less than 4 $
- Raspberry Pi Pico is the slowest, despite not having the slowest clock (but the Arduino Nano 33 BLE Sense has a Cortex M4 CPU)
Do these benchmarks match with your conjectures?
Are you surpised from some of these numbers?
Would you like to see other boards benchmarked?
Let me know in the comments.
Raw data
board_name | dataset | clf | inference_time |
---|---|---|---|
Arduino Nano 33 | Breast cancer | FC 1 x 10 | 138.71 |
Arduino Nano 33 | Breast cancer | FC 10 x 10 | 472.11 |
Arduino Nano 33 | Breast cancer | FC 10+50 | 286.86 |
Arduino Nano 33 | Digits | FC 1 x 10 | 390.25 |
Arduino Nano 33 | Digits | FC 10 x 10 | 719.08 |
Arduino Nano 33 | Digits | FC 10+50 | 589.75 |
Arduino Nano 33 | Iris | FC 1 x 10 | 113.61 |
Arduino Nano 33 | Iris | FC 10 x 10 | 442.75 |
Arduino Nano 33 | Iris | FC 10+50 | 266.54 |
Arduino Nano 33 | Wine | FC 1 x 10 | 130.1 |
Arduino Nano 33 | Wine | FC 10 x 10 | 460.02 |
Arduino Nano 33 | Wine | FC 10+50 | 283.82 |
Arduino Portenta M7 | Breast cancer | FC 1 x 10 | 13.75 |
Arduino Portenta M7 | Breast cancer | FC 10 x 10 | 55.16 |
Arduino Portenta M7 | Breast cancer | FC 10+50 | 31.72 |
Arduino Portenta M7 | Digits | FC 1 x 10 | 26.96 |
Arduino Portenta M7 | Digits | FC 10 x 10 | 69.54 |
Arduino Portenta M7 | Digits | FC 10+50 | 51.56 |
Arduino Portenta M7 | Iris | FC 1 x 10 | 8.71 |
Arduino Portenta M7 | Iris | FC 10 x 10 | 49.85 |
Arduino Portenta M7 | Iris | FC 10+50 | 27.35 |
Arduino Portenta M7 | Wine | FC 1 x 10 | 10.94 |
Arduino Portenta M7 | Wine | FC 10 x 10 | 52.11 |
Arduino Portenta M7 | Wine | FC 10+50 | 29.55 |
ESP32 Dev Module | Breast cancer | FC 1 x 10 | 36.31 |
ESP32 Dev Module | Breast cancer | FC 10 x 10 | 125.03 |
ESP32 Dev Module | Breast cancer | FC 10+50 | 74.86 |
ESP32 Dev Module | Digits | FC 1 x 10 | 77.25 |
ESP32 Dev Module | Digits | FC 10 x 10 | 172.94 |
ESP32 Dev Module | Digits | FC 10+50 | 130.61 |
ESP32 Dev Module | Iris | FC 1 x 10 | 20.83 |
ESP32 Dev Module | Iris | FC 10 x 10 | 109.23 |
ESP32 Dev Module | Iris | FC 10+50 | 61.17 |
ESP32 Dev Module | Wine | FC 1 x 10 | 28.89 |
ESP32 Dev Module | Wine | FC 10 x 10 | 117.95 |
ESP32 Dev Module | Wine | FC 10+50 | 69.28 |
Feather M4 Express {opt=fastest,speed=200} | Breast cancer | FC 1 x 10 | 31.81 |
Feather M4 Express {opt=fastest,speed=200} | Breast cancer | FC 10 x 10 | 132.66 |
Feather M4 Express {opt=fastest,speed=200} | Breast cancer | FC 10+50 | 79.13 |
Feather M4 Express {opt=fastest,speed=200} | Digits | FC 1 x 10 | 69.89 |
Feather M4 Express {opt=fastest,speed=200} | Digits | FC 10 x 10 | 167.29 |
Feather M4 Express {opt=fastest,speed=200} | Digits | FC 10+50 | 132.14 |
Feather M4 Express {opt=fastest,speed=200} | Iris | FC 1 x 10 | 17.79 |
Feather M4 Express {opt=fastest,speed=200} | Iris | FC 10 x 10 | 118.9 |
Feather M4 Express {opt=fastest,speed=200} | Iris | FC 10+50 | 67.17 |
Feather M4 Express {opt=fastest,speed=200} | Wine | FC 1 x 10 | 23.84 |
Feather M4 Express {opt=fastest,speed=200} | Wine | FC 10 x 10 | 124.46 |
Feather M4 Express {opt=fastest,speed=200} | Wine | FC 10+50 | 72.93 |
NUCLEO H743ZI2 {opt=o3} | Breast cancer | FC 1 x 10 | 8.5 |
NUCLEO H743ZI2 {opt=o3} | Breast cancer | FC 10 x 10 | 34.19 |
NUCLEO H743ZI2 {opt=o3} | Breast cancer | FC 10+50 | 20.18 |
NUCLEO H743ZI2 {opt=o3} | Digits | FC 1 x 10 | 18.08 |
NUCLEO H743ZI2 {opt=o3} | Digits | FC 10 x 10 | 44.16 |
NUCLEO H743ZI2 {opt=o3} | Digits | FC 10+50 | 33.8 |
NUCLEO H743ZI2 {opt=o3} | Iris | FC 10 x 10 | 31.51 |
NUCLEO H743ZI2 {opt=o3} | Iris | FC 10+50 | 17.8 |
NUCLEO H743ZI2 {opt=o3} | Wine | FC 10 x 10 | 32.57 |
NUCLEO H743ZI2 {opt=o3} | Wine | FC 10+50 | 19.06 |
Raspberry Pi Pico | Breast cancer | FC 1 x 10 | 872.85 |
Raspberry Pi Pico | Breast cancer | FC 10 x 10 | 3369.54 |
Raspberry Pi Pico | Breast cancer | FC 10+50 | 2413.44 |
Raspberry Pi Pico | Digits | FC 1 x 10 | 1982.31 |
Raspberry Pi Pico | Digits | FC 10 x 10 | 4503.25 |
Raspberry Pi Pico | Digits | FC 10+50 | 4314.19 |
Raspberry Pi Pico | Iris | FC 1 x 10 | 313.77 |
Raspberry Pi Pico | Iris | FC 10 x 10 | 2801.82 |
Raspberry Pi Pico | Iris | FC 10+50 | 1953.96 |
Raspberry Pi Pico | Wine | FC 1 x 10 | 509.76 |
Raspberry Pi Pico | Wine | FC 10 x 10 | 3021.03 |
Raspberry Pi Pico | Wine | FC 10+50 | 2176.92 |
Teensy 4.0 | Breast cancer | FC 1 x 10 | 5.16 |
Teensy 4.0 | Breast cancer | FC 10 x 10 | 20.15 |
Teensy 4.0 | Breast cancer | FC 10+50 | 12.32 |
Teensy 4.0 | Digits | FC 10 x 10 | 26.09 |
Teensy 4.0 | Digits | FC 10+50 | 21.01 |
Teensy 4.0 | Iris | FC 1 x 10 | 3.14 |
Teensy 4.0 | Iris | FC 10 x 10 | 18.12 |
Teensy 4.0 | Iris | FC 10+50 | 11.13 |
Teensy 4.0 | Wine | FC 1 x 10 | 3.86 |
Teensy 4.0 | Wine | FC 10 x 10 | 18.92 |
Teensy 4.0 | Wine | FC 10+50 | 11.43 |