TinyML: Getting Started with TensorFlow Lite for Microcontrollers | Digi-Key Electronics

preview_player
Показать описание
In this tutorial, Shawn shows you how to use the TensorFlow Lite for Microcontrollers library to perform machine learning tasks on embedded systems. Specifically, he uses the STM32CubeIDE, but TensorFlow Lite for Microcontrollers can be copied to almost any embedded build system.

We show you how to generate the TensorFlow Lite for Microcontrollers source code files using the Make build system. Note that for this step, you will need access to Linux or macOS. From there, you can copy the model file and TensorFlow Lite source code files to your embedded project directory.

We demonstrate how to include the necessary TensorFlow Lite source files and any changes that need to be made to them. After, we walk you through the code for running inference using the trained neural network.

Finally, we measure the required flash and RAM used to run our basic neural network as well as the time it takes to run inference. These numbers can be used to compare against other machine learning frameworks, such as X-Cube-AI.

Before starting, we recommend you watch the following videos:

Product Links:

Related Videos:
Intro to Edge AI

Getting Started with Machine Learning Using TensorFlow and Keras

Intro to TensorFlow Lite Part 1: Wake Word Feature Extraction

Intro to TensorFlow Lite Part 2: Speech Recognition Model Training

Intro to TensorFlow Lite Part 3: Speech Recognition on Raspberry Pi

Low-Cost Data Acquisition (DAQ) with Arduino and Binho for Machine Learning

Intro to TinyML Part 1: Training a Neural Network for Arduino in TensorFlow

Intro to TinyML Part 2: Deploying a TensorFlow Lite Model to Arduino

Edge AI Anomaly Detection Part 1: Data Collection

Edge AI Anomaly Detection Part 2: Feature Extraction and Model Training

Edge AI Anomaly Detection Part 3: Deploy Machine Learning Models to Raspberry Pi | Digi-Key

Edge AI Anomaly Detection Part 4: Deploy TinyML Model in Arduino to ESP32

Related Project Links:

Related Articles:
What is Edge AI?

Getting Started with Machine Learning Using TensorFlow and Keras

Low-Cost Data Acquisition (DAQ) with Arduino and Binho for ML

Рекомендации по теме
Комментарии
Автор

I feel like we just exited the Nürbergring with Sabine behind the wheel. Exhilarating, but fun. Usually, I like to walch tutorials at 1.25 or 1.5 X, but I might have to actually bump it below 1.0 in order to fully absorb all that info. And, this is from a professional C++ programmer with decades of experience on MCUs and other embedded misc. Great video. I really appreciate the honesty of those little conditional statements, like “ to my understanding”, and such. Keep it up.

anelson
Автор

This video tutorial is one of the best out there. Great, great work here Shawn!

akhaled
Автор

Thank you so much. What a great tutorial. Would probably take even experienced dudes many many hours to get to this point.

Seff
Автор

None of this works anymore in 2022, please update or take it down, I spent 2 days messing with stuff that does not work.

thauolar
Автор

The problem with these tutorials is that Tensorflow isn't a regular library but rather a moving maze. You can make a tutorial, and 5 seconds later it's completely obsolete because the entire project structure has changed.

erenoz
Автор

Thanks, Shawn, I think many people work with ESP32, will you teach us a TFLite conversion (image classification) on ESP32?

aisolutions
Автор

I'm new to the MCU world but with ML experience. I have a stupid question: is it possible to use TF Lite Micro Library, which is written in C++, in some existing C project? What should be taken care of?

haoyuren
Автор

Hi. Really pretty cool. I'm trying to reproduce this example based on TensorFlow 2.4. However, i found an error in line. I notice that it was a change in files for the 2.4 version, but i do not know how to adapt this line for the new version. Can you help me, please?

gustavodenardin
Автор

Sadly, TF is changing so fast that most of the stuff shown after 5 minutes does not work anymore. TFlite micro has since been moved to its own repo and it's file structure changed, so this doesn't work anymore. This isn't easy to get into except for the examples that treat you like an idiot - style. Maybe an update-video might be good to consider, since TFlite micro is now its own project.

jakobtschavoll
Автор

We followed the steps suggested in STM32F407G, but the program is erroring out? which version of Tensorflow is used during demonstration?

pradeepr
Автор

Hi i try this example on stm32f4 discovery but when the code is running it is stuck on the take input tensor line. What can be wrong ?. What should i do

earnMoneyMottivationn
Автор

Why not just use STM32CubeAI to import your Keras model?

Curtis
Автор

Shawn (or anyone else that might be able to help), I tried running this and ran into some issues. When I eventually got to the line

"make -f TAGS=”portable_optimized” generate_non_kernel_projects"

I got the error:

"No rule to make target Stop."

I removed that last line and tried it again and got the error:

"error: macro names must be identifiers"

I'm assuming this is an issue with the version of Tflowlite taken from the GIT directory? I ended up changing to depth from 1 and getting the whole GIT directory. What version did you use? Do you know any ways around this issue?

Any help you can give me would be greatly appreciated! Have a number of applications for this and would much prefer to use the tensorflow lite library than the Cube AI approach (the open source nature of it makes it easier to work with other teams with more Tflow experience).

Thanks!

jaybee
Автор

I'm getting an error while compiling please can you help me?

Error : No rule to make target

resatyigen
Автор

Do these video instructions still hold true 1 year later? will this still work?
thanks :)

almogstern
Автор

do *not* alias python3 to python in a .bashrc file but change the symbolic link in /usr/bin/python to point to python3 (will cause python six errors)

Mr-lmdv
Автор

This video may need an update.

tensorflow throws this error message: make -f TAGS="portable_optimized" generate_non_kernel_projects

*** The TAGS command line option is no longer supported in the TFLM Makefile.. Stop.

stoforest