Intro to TinyML Part 1: Training a Neural Network for Arduino in TensorFlow | Digi-Key Electronics

  Рет қаралды 137,827

DigiKey

DigiKey

4 жыл бұрын

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.google.com/). 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/lutzroeder/netron) 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.com/ShawnHymel/79...
Project Link: www.digikey.com/en/maker/proj...
Product Links:
Arduino Nano 33 BLE Sense www.digikey.com/product-detai...
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.com/en/maker/proj...
Getting Started with Machine Learning Using TensorFlow and Keras
www.digikey.com/en/maker/proj...
TensorFlow Lite Tutorial Part 1: Wake Word Feature Extraction
www.digikey.com/en/maker/proj...
TensorFlow Lite Tutorial Part 2: Speech Recognition Model Training
www.digikey.com/en/maker/proj...
TensorFlow Lite Tutorial Part 3: Speech Recognition on Raspberry Pi
www.digikey.com/en/maker/proj...
Low-Cost Data Acquisition (DAQ) with Arduino and Binho for ML
www.digikey.com/en/maker/proj...

Пікірлер: 46
@stuartbruff8786
@stuartbruff8786 3 жыл бұрын
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.
@hansellwilliams1564
@hansellwilliams1564 3 жыл бұрын
Thanks Shawn...you are the bees knees; a total natural!
@quimmorera
@quimmorera 4 жыл бұрын
Quite inspiring and motivating. Keep going!
@ShawnHymel
@ShawnHymel 4 жыл бұрын
Thanks!
@jnthas
@jnthas 3 жыл бұрын
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
@gongmingwei
@gongmingwei 4 жыл бұрын
A simple but great example for me to quickly learn how the TF machine learning works. Thanks.
@4ia06_ridhomuhammad6
@4ia06_ridhomuhammad6 2 жыл бұрын
Love this series
@bonadio60
@bonadio60 4 жыл бұрын
Nice video, looking forward the next episode
@teamgallenide8577
@teamgallenide8577 4 жыл бұрын
this dude is a legend
@mozartantonio1919
@mozartantonio1919 2 жыл бұрын
awesome video.
@swipekonme
@swipekonme 3 жыл бұрын
if this is standard, many youtubers are doomed, my jaw is still on the floor
@bonadio60
@bonadio60 4 жыл бұрын
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
@harshmirdhwal
@harshmirdhwal 3 жыл бұрын
Uno or BLE?
@gayathri135
@gayathri135 6 ай бұрын
Thanks for the tutorial. Can we implement same thing on raspberry pi?
@harishhanchinal2838
@harishhanchinal2838 Жыл бұрын
Nice...
@user-bn3gz8vs6m
@user-bn3gz8vs6m 5 ай бұрын
I think I need this information for my study. Could you share the project information? Thank you
@ncroc
@ncroc 4 жыл бұрын
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?
@ShawnHymel
@ShawnHymel 4 жыл бұрын
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.
@jenbrown2060
@jenbrown2060 4 жыл бұрын
Xl
@wizzardofwizzards
@wizzardofwizzards 3 жыл бұрын
Maybe a microcontroller-based protocol analyzer!?!
@miguelburgoslopez
@miguelburgoslopez 3 жыл бұрын
Hi, thank for the video, can you do the same video but using microphyton?
@conorstewart2214
@conorstewart2214 3 жыл бұрын
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
@shabkhan-tp4nn
@shabkhan-tp4nn Жыл бұрын
where is the training dataset path given
@danny117hd
@danny117hd 4 жыл бұрын
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.
@ShawnHymel
@ShawnHymel 4 жыл бұрын
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 :)
@syedmurtazajaffar8833
@syedmurtazajaffar8833 3 жыл бұрын
Thanks a lot! But can you PLEASE go a LITTLE SLOWER... I will appreciate it. Thank you again.
@digikey
@digikey 3 жыл бұрын
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.
@kymcainday6677
@kymcainday6677 Жыл бұрын
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.
@aindatenhoconta
@aindatenhoconta Жыл бұрын
It's python --version or python -V
@wayneyue1662
@wayneyue1662 3 жыл бұрын
Colab+arduino+tensorflow
@MSuriyaPrakaashJL
@MSuriyaPrakaashJL 4 жыл бұрын
Hello, How xan we get data from a sensor and use it to train a model
@harshmirdhwal
@harshmirdhwal 3 жыл бұрын
A grown up richie rich
@fahmif.6301
@fahmif.6301 3 жыл бұрын
Hiii! I have a question. My I program My ml project in arduino nano ble IoT?
@mariafrancescaala
@mariafrancescaala 3 жыл бұрын
I think the IoT version of arduino nano is not supported by tensorflow lite
@knight3775
@knight3775 4 жыл бұрын
Can we do it in Arduino Uno ? if not any idea how long till they add support for Uno ?
@ShawnHymel
@ShawnHymel 4 жыл бұрын
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.
@tamgaming9861
@tamgaming9861 3 жыл бұрын
@@ShawnHymel would it be possible with an ESP32? Yes or?
@ShawnHymel
@ShawnHymel 3 жыл бұрын
@@tamgaming9861 yes, I've had good luck getting TensorFlow Lite to run on the ESP32. That chip has a lot of memory and speed.
@tamgaming9861
@tamgaming9861 3 жыл бұрын
@@ShawnHymel waow thank you a lot for your answer :-) You have a great channel!
@PiotrCzarny
@PiotrCzarny 4 жыл бұрын
Very good content, but I get kinda stress because all breathing pauses between sentences have been cut out in the editing. :-D
@billyfulks5587
@billyfulks5587 4 жыл бұрын
Training a neural network is easier than tracing yo mama not to fart.
@hija_del_cacao
@hija_del_cacao 8 ай бұрын
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.
@sushrutdhiman1776
@sushrutdhiman1776 2 жыл бұрын
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
@aindatenhoconta
@aindatenhoconta Жыл бұрын
Because it's `y_samples = np.sin(x_samples) + (0.1 * np.random.randn(x_samples.shape[0]))`
Small Brain, Big Think: AI on the Edge
12:40
Zack Freedman
Рет қаралды 454 М.
Was ist im Eis versteckt? 🧊 Coole Winter-Gadgets von Amazon
00:37
SMOL German
Рет қаралды 39 МЛН
路飞被小孩吓到了#海贼王#路飞
00:41
路飞与唐舞桐
Рет қаралды 70 МЛН
Who has won ?? 😀 #shortvideo #lizzyisaeva
00:24
Lizzy Isaeva
Рет қаралды 62 МЛН
Does size matter? BEACH EDITION
00:32
Mini Katana
Рет қаралды 18 МЛН
How TinyML Gives us Spider-Man Powers | Emelie Eldracher | TEDxMIT
10:23
Neural Network Robot With Arduino
9:33
Nikodem Bartnik
Рет қаралды 229 М.
What is TinyML?
6:12
Arm®
Рет қаралды 16 М.
I trained an AI to decode Morse code messages on an ESP32!
12:30
Playful Technology
Рет қаралды 8 М.
Sensors - which one to use
17:06
Electronoobs
Рет қаралды 1,3 МЛН
Как распознать поддельный iPhone
0:44
PEREKUPILO
Рет қаралды 1,7 МЛН
Clicks чехол-клавиатура для iPhone ⌨️
0:59
Сколько реально стоит ПК Величайшего?
0:37
Samsung Galaxy 🔥 #shorts  #trending #youtubeshorts  #shortvideo ujjawal4u
0:10
Ujjawal4u. 120k Views . 4 hours ago
Рет қаралды 6 МЛН