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

Sdílet
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...

Komentáře • 46

  • @stuartbruff8786
    @stuartbruff8786 Před 3 lety +10

    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.

  • @jnthas
    @jnthas Před 3 lety +28

    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

  • @hansellwilliams1564
    @hansellwilliams1564 Před 3 lety +1

    Thanks Shawn...you are the bees knees; a total natural!

  • @gongmingwei
    @gongmingwei Před 4 lety +3

    A simple but great example for me to quickly learn how the TF machine learning works. Thanks.

  • @quimmorera
    @quimmorera Před 4 lety +7

    Quite inspiring and motivating. Keep going!

  • @swipekonme
    @swipekonme Před 3 lety +1

    if this is standard, many youtubers are doomed, my jaw is still on the floor

  • @bonadio60
    @bonadio60 Před 4 lety +2

    Nice video, looking forward the next episode

  • @4ia06_ridhomuhammad6
    @4ia06_ridhomuhammad6 Před 3 lety

    Love this series

  • @bonadio60
    @bonadio60 Před 4 lety +3

    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

  • @ncroc
    @ncroc Před 4 lety +3

    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 Před 4 lety +1

      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 Před 4 lety

      Xl

  • @teamgallenide8577
    @teamgallenide8577 Před 4 lety

    this dude is a legend

  • @user-bn3gz8vs6m
    @user-bn3gz8vs6m Před 6 měsíci +1

    I think I need this information for my study. Could you share the project information? Thank you

  • @kymcainday6677
    @kymcainday6677 Před rokem +2

    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.

  • @mozartantonio1919
    @mozartantonio1919 Před 2 lety

    awesome video.

  • @syedmurtazajaffar8833
    @syedmurtazajaffar8833 Před 3 lety +4

    Thanks a lot! But can you PLEASE go a LITTLE SLOWER... I will appreciate it. Thank you again.

    • @digikey
      @digikey  Před 3 lety +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.

  • @gayathri135
    @gayathri135 Před 7 měsíci

    Thanks for the tutorial. Can we implement same thing on raspberry pi?

  • @danny117hd
    @danny117hd Před 4 lety +1

    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 Před 4 lety +1

      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 :)

  • @harishhanchinal2838
    @harishhanchinal2838 Před rokem

    Nice...

  • @wizzardofwizzards
    @wizzardofwizzards Před 4 lety

    Maybe a microcontroller-based protocol analyzer!?!

  • @wayneyue1662
    @wayneyue1662 Před 3 lety

    Colab+arduino+tensorflow

  • @shabkhan-tp4nn
    @shabkhan-tp4nn Před rokem

    where is the training dataset path given

  • @PiotrCzarny
    @PiotrCzarny Před 4 lety +2

    Very good content, but I get kinda stress because all breathing pauses between sentences have been cut out in the editing. :-D

  • @miguelburgoslopez
    @miguelburgoslopez Před 3 lety

    Hi, thank for the video, can you do the same video but using microphyton?

    • @conorstewart2214
      @conorstewart2214 Před 3 lety +1

      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

  • @harshmirdhwal
    @harshmirdhwal Před 3 lety +1

    A grown up richie rich

  • @aindatenhoconta
    @aindatenhoconta Před rokem

    It's python --version or python -V

  • @MSuriyaPrakaashJL
    @MSuriyaPrakaashJL Před 4 lety

    Hello, How xan we get data from a sensor and use it to train a model

  • @knight3775
    @knight3775 Před 4 lety +1

    Can we do it in Arduino Uno ? if not any idea how long till they add support for Uno ?

    • @ShawnHymel
      @ShawnHymel Před 4 lety +2

      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 Před 3 lety +1

      @@ShawnHymel would it be possible with an ESP32? Yes or?

    • @ShawnHymel
      @ShawnHymel Před 3 lety

      @@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 Před 3 lety +1

      @@ShawnHymel waow thank you a lot for your answer :-) You have a great channel!

  • @fahmif.6301
    @fahmif.6301 Před 3 lety

    Hiii! I have a question. My I program My ml project in arduino nano ble IoT?

    • @mariafrancescaala
      @mariafrancescaala Před 3 lety

      I think the IoT version of arduino nano is not supported by tensorflow lite

  • @billyfulks5587
    @billyfulks5587 Před 4 lety

    Training a neural network is easier than tracing yo mama not to fart.

  • @hija_del_cacao
    @hija_del_cacao Před 10 měsíci

    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 Před 2 lety

    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 Před rokem

      Because it's `y_samples = np.sin(x_samples) + (0.1 * np.random.randn(x_samples.shape[0]))`