Intro to TinyML Part 1: Training a Neural Network for Arduino in TensorFlow | Digi-Key Electronics
Vložit
- čas přidán 20. 08. 2024
- In this tutorial series, Shawn introduces the concept of Tiny Machine Learning (TinyML), which consists of running machine learning algorithms on microcontrollers.
For the first part, we use TensorFlow and Google Colab to train a simple neural network model that predicts the output of the sine function. While this is an inefficient method of creating a sinewave, it allows us to play with small, functioning, and non-linear neural networks.
The example training steps shown in this video are accomplished with Google Colab (colab.research.... This web-based Python editing software allows us to play with TensorFlow without needing to install various packages on our local machine.
Once we have a functioning model, we convert itto a TensorFlow Lite (tflite) model file. We then write a quick script that reads the bytes from the tflite file and creates a C header file for us to load into our embedded program on the next episode.
Finally, we can download both the .tflite and .h header file to our computer for deployment to the Arduino, which we will cover in the next episode. Netron (github.com/lut...) can be used to examine the model in a slick GUI.
Before starting, we recommend you watch the following videos:
What is Edge AI • Intro to Edge AI: Mach...
Getting Started with Machine Learning Using TensorFlow and Keras • Getting Started with T...
Code for this video can be found here: gist.github.co...
Project Link: www.digikey.co...
Product Links:
Arduino Nano 33 BLE Sense www.digikey.co...
Related Videos:
Intro to Edge AI
• Intro to Edge AI: Mach...
Getting Started with Machine Learning Using TensorFlow and Keras
• Getting Started with T...
Intro to TensorFlow Lite Part 1: Wake Word Feature Extraction
• Intro to TensorFlow Li...
Intro to TensorFlow Lite Part 2: Speech Recognition Model Training
• Intro to TensorFlow Li...
Intro to TensorFlow Lite Part 3: Speech Recognition on Raspberry Pi • Intro to TensorFlow Li...
Low-Cost Data Acquisition (DAQ) with Arduino and Binho for Machine Learning
• Low-Cost Data Acquisit...
Related Articles:
What is Edge AI?
www.digikey.co...
Getting Started with Machine Learning Using TensorFlow and Keras
www.digikey.co...
TensorFlow Lite Tutorial Part 1: Wake Word Feature Extraction
www.digikey.co...
TensorFlow Lite Tutorial Part 2: Speech Recognition Model Training
www.digikey.co...
TensorFlow Lite Tutorial Part 3: Speech Recognition on Raspberry Pi
www.digikey.co...
Low-Cost Data Acquisition (DAQ) with Arduino and Binho for ML
www.digikey.co...
Wow. Despite the speed of the presentation, Mr Hymel talked in a manner that both caught mt attention and allowed me to follow and understand the process. Well Done.
Nice content, but why did you hide the subtitles? It is very important not only for people with disabilities, but also for non-native English speakers
Thanks Shawn...you are the bees knees; a total natural!
A simple but great example for me to quickly learn how the TF machine learning works. Thanks.
Quite inspiring and motivating. Keep going!
Thanks!
if this is standard, many youtubers are doomed, my jaw is still on the floor
Nice video, looking forward the next episode
Love this series
I tried this code but for the new tensorflow 2.2 you need to increase the number of samples to have a good result. I tried with 5000 samples and worked
Uno or BLE?
What about other ML techniques like decision trees, svm, Gaussian mixture models etc? Neural networks look like an overkill for microcontrollers.
How do we even know if neural nets will perform better than other simpler methods after all those quantizations and simplifications?
Other ML techniques are totally possible. Here's a great article on running SVMs on an ATtiny85 (!): www.hackster.io/news/machine-learning-on-an-attiny85-778e5624f544 In these episodes, I wanted to specifically show running TensorFlow Lite on microcontrollers. If a NN isn't the right tool for the job, then it probably shouldn't be used (along with TensorFlow). I'm looking at showing some other techniques in future videos that don't rely on NNs.
Xl
this dude is a legend
I think I need this information for my study. Could you share the project information? Thank you
This is really a cool tutorial, I just find the discussion too fast that I had to rewind several times to fully grasp some points. I've been following this channel for a few years now and still having hard time following your tutorials. Sorry, just a slow learner here.
awesome video.
Thanks a lot! But can you PLEASE go a LITTLE SLOWER... I will appreciate it. Thank you again.
Hello Syed, to slow down the video simply select "settings" on the video by clicking on the little gear icon. Then select playback speed and finally select a speed slower than "normal" which is the default.
Thanks for the tutorial. Can we implement same thing on raspberry pi?
Again way over my level but I'm like it's an example. IRL I might use a sin table with radian/2^10 so I have a digital value to use with 0-1023.
Agreed, if you need a sinewave for a real microcontroller project, it's MUCH better to use a lookup table. No need to create a NN for that :)
Nice...
Maybe a microcontroller-based protocol analyzer!?!
Colab+arduino+tensorflow
where is the training dataset path given
Very good content, but I get kinda stress because all breathing pauses between sentences have been cut out in the editing. :-D
Hi, thank for the video, can you do the same video but using microphyton?
Most microcontrollers don’t have the processing power required to train a model, a micro Python version of this would be the exact same but as you can’t run this on a microcontroller there is no point, look at the other videos where they put a trained model into a microcontroller
A grown up richie rich
It's python --version or python -V
Hello, How xan we get data from a sensor and use it to train a model
Can we do it in Arduino Uno ? if not any idea how long till they add support for Uno ?
While you could possibly get a very small neural network to run in an UNO, you're going to run out of flash and RAM very quickly. As a result, most of the TensorFlow Lite for Microcontrollers is generally written with the intention of running on much more powerful 32-bit ARM microcontrollers.
@@ShawnHymel would it be possible with an ESP32? Yes or?
@@tamgaming9861 yes, I've had good luck getting TensorFlow Lite to run on the ESP32. That chip has a lot of memory and speed.
@@ShawnHymel waow thank you a lot for your answer :-) You have a great channel!
Hiii! I have a question. My I program My ml project in arduino nano ble IoT?
I think the IoT version of arduino nano is not supported by tensorflow lite
Training a neural network is easier than tracing yo mama not to fart.
Thanks for the tutorial, but an errors\ come out, please help!
in minute 3:40
---> 14 print('Keras ' + tf.keras.__version__)
AttributeError: module 'tensorflow.keras' has no attribute '__version__'
I think is related to:
from tensorflow.keras import layers
Thanks in advance.
When trying to generate noise using "y_samples = np.sin(x_samples) + 0.1*(np.random.randn(y_samples.size[0]))"
I get error : TypeError: 'int' object is not subscriptable
Because it's `y_samples = np.sin(x_samples) + (0.1 * np.random.randn(x_samples.shape[0]))`