TensorFlow Lite for Microcontrollers is a massively streamlined version of full-blown TensorFlow. Designed to be portable to “bare metal” systems, it doesn’t need either standard C libraries, or dynamic memory allocation. The core runtime fits in just 16KB on a Cortex-M3, and with enough operators to run a speech keyword detection model, takes up a total of 22KB.
Since the release of TensorFlow Lite for Microcontrollers, Adafruit has invested a lot of time into making the new machine learning platform for embedded hardware a lot more useable, iterating the tooling around the original speech demo to make it easy to build and deploy new models.
Available as both a standalone board and as a Raspberry Pi HAT, the Braincraft board was conceived by Adafruit along with Pete Warden, part of the TensorFlow Lite team at Google, who was also involved in the design of the SparkFun Edge board.
“…and here’s a first look! We’ve started to design a BrainCraft HAT for Raspberry Pi and other linux computers. It has a 240×240 TFT display for inference output, slot for Camera connector cable for imaging projects, a 5 way joystick and button for UI input, left and right microphones, stereo headphone, stereo speaker out, three RGB dotstar LEDs, two 3 pin STEMMA connectors on PWM pins so they can drive NeoPixels or servos, and grove/stemma/qwiic I2C port. This should let people build a wide range of audio/video AI projects while also allowing easy plug in of sensors and robotics! Most importantly, there’s an On/Off switch that will disable the audio codec so that when its off there’s no way its listening to you!”
The new board will work out of the box doing machine vision, using a pre-trained model that can recognise around 1,000 different common objects.
Things are continuing to move fast with embedded machine learning, it hasn’t really been that long since the Raspberry Pi was really struggling with being able to run TensorFlow locally.
However, as my most recent benchmarking shows, the new Raspberry Pi 4 is more than capable of running TensorFlow Lite, let alone the even more stripped down TensorFlow Lite for Microcontrollers which is really intended for more low-powered boards, like SparkFun’s new Artemis modules.
Right now, the Raspberry Pi 4 is probably the cheapest, most affordable, most accessible way to get started with embedded machine learning right now. Use it on its own with TensorFlow Lite for competitive performance, or with the Coral USB Accelerator from Google for ‘best in class’ performance, and the addition of Adafruit’s new Braincraft board is going to make it really easy to get started.
UPDATE: While we’re waiting for the new Braincraft board, Adafruit has put together a guide on how to do automatic object detection on the Raspberry Pi using TensorFlow Lite.