SlideShare a Scribd company logo
1 of 26
TinyML
Embedded Machine Learning
Pre-flight checklist:
● Solder headers to mic breakout board
● Install STM32CubeIDE
● Install serial terminal program (e.g.
PuTTY)
● Create Gmail and Edge Impulse
accounts
Worksheet: github.com/ShawnHymel/ei-
keyword-spotting
These slides are released under the CC BY 4.0 license.
Find them here: bit.ly/remoticon-tinyml-slides
● Running machine learning algorithms on embedded systems
● Why do we need this?
○ Classification, prediction, decision making with little or no Internet connection
○ Voice activation, object detect, anomaly detection, etc.
What is embedded machine learning?
● Worksheet: https://github.com/ShawnHymel/ei-keyword-spotting
● Work through together (feel free to work ahead)
● Describe concepts during pauses (downloading, compiling, running, etc.)
● Not a canned demo
○ OK, it’s kinda canned
○ Edge Impulse: graphical ML training tool (vs. running Colab script for training)
○ Use auto-generated library to create embedded ML project
Syllabus
Data Collection
Steps
● Worksheet: https://github.com/ShawnHymel/ei-keyword-spotting
● Run Colab script through downloading/unzipping Google Speech Commands
Dataset
Google Speech Commands Dataset
● About: https://ai.googleblog.com/2017/08/launching-speech-commands-
dataset.html
● Collection of 1-second snippets of spoken words
● Use as a starting point
● Select 1 or 2 words from this set to recognize
Data Curation
Steps
● Make account and new project on https://www.edgeimpulse.com/
● Copy in API key
● Run script through curation
google_speech_commands
backward (1664 files)
bed (2014 files)
bird (2064 files)
cat (2031 files)
...
_background_noise_ (6 files)
_noise (1500 files)
_unknown (1500 files)
down (1500 files)
up (1500 files)
keywords_curated
dataset_curation.py
target
keywords
Data Augmentation
+
“up” (google_speech_commands) “up” (keywords_curated)
doing_the_dishes (_background_noise_)
See for yourself! Download samples from Colab
What is “Artificial Intelligence?”
John McCarthy coined the term “artificial intelligence” in 1956
“[AI] is the science and engineering of making intelligent machines, especially
intelligent computer programs...Intelligence is the computational part of the ability
to achieve goals in the world.” --John McCarthy, 2007
What is “Machine Learning?”
Arthur Samuel coined the term “machine learning” in 1959
"A computer program is said to learn from experience E with respect to some
class of tasks T and performance measure P, if its performance at tasks in T, as
measured by P, improves with experience E." --Tom Mitchell, 1997
What is “Deep Learning?”
Rina Dechter coined the term “deep learning” in 1986
“Deep learning is a class of machine learning algorithms that uses multiple layers
to progressively extract higher-level features from the raw input.” --Wikipedia
Check-in! Any questions or issues?
Upload Data
Steps
● Run final cell in Colab script to automatically upload data to Edge Impulse
20%
80%
Set aside for testing after training
Used for training
Dataset is randomly shuffled
Why? Models can “overfit”
training data, so we test with
unseen data
Extract Features
Steps
● Create Impulse: Audio (MFCC) > Neural Network (Keras)
● Generate MFCC Features
Mel-frequency cepstral coefficients (MFCCs)
LOLWUT?
- MFCCs mimic how our ears/brain interpret sound
- Give an idea of “overall shape” of sound signature
- Ignore finer details
- Popular in automatic speech recognition (ASR)
- I wanna learn more! bit.ly/practical-cryptography-
mfccs
Train Neural Network
Steps
● Keep default training settings
● Start training
Reshape to 49x13 array
1D Convolution
MaxPooling 1D
1D Convolution
MaxPooling 1D
Flatten to vector
Softmax
P_noise P_unknownPdown Pup
MFCCs
Convolutional Neural Network (CNN)
Finds “features”
in the image
Classifier
LOLWUT?
- CNNs are common in deep learning
for image classification
- I wanna know how to design this!
coursera.org/learn/machine-learning
Evaluate on Test Set
Steps
● Examine confusion matrix for training set
● Perform inference on (unseen) test set
Check-in! Any questions or issues?
Download and Add Model Files
Steps
● Deployment > Download auto-
generated C++ library with model
● Follow guide in Nucleo-L476 demo
project: bit.ly/ei-nucleo-l476
● Import project and model files
1. Import project from GitHub repo
2. Replace model-parameters and tflite-model
folders with ones downloaded from Edge Impulse
Run It!
Steps
● Set build configuration to “Release”
● Compile (Flash: text + data, RAM: data + bss)
● Create Run Configuration
● Upload to board (“Run”)
● Connect serial terminal
○ 115,200 baud rate
○ 8-N-1
● If “buffer overrun”
○ Up baud rate to 256,000
Check-in! Any questions or issues?
Modify Code
STM32L476 Resources
● Datasheet:
bit.ly/stm32l476-datasheet
● HAL API: bit.ly/stm32l4-
hal-api
Core > Src > main.cpp > int
main(void)
Run > Run to compile and
upload
Twitter: @ShawnHymel
Instagram: shawn_hymel
LinkedIn:
linkedin.com/in/ShawnHymel/
Hang out: bit.ly/remoticon-tinyml

More Related Content

Similar to Remoticon - TinyML Workshop.pptx

Yann le cun
Yann le cunYann le cun
Yann le cun
Yandex
 

Similar to Remoticon - TinyML Workshop.pptx (20)

Introduction to Machine Learning with TensorFlow
Introduction to Machine Learning with TensorFlowIntroduction to Machine Learning with TensorFlow
Introduction to Machine Learning with TensorFlow
 
OpenPOWER Workshop in Silicon Valley
OpenPOWER Workshop in Silicon ValleyOpenPOWER Workshop in Silicon Valley
OpenPOWER Workshop in Silicon Valley
 
Intermediate Intel® Distribution of OpenVINO™ toolkit for Computer Vision Ap...
 Intermediate Intel® Distribution of OpenVINO™ toolkit for Computer Vision Ap... Intermediate Intel® Distribution of OpenVINO™ toolkit for Computer Vision Ap...
Intermediate Intel® Distribution of OpenVINO™ toolkit for Computer Vision Ap...
 
Rrw02 Week 1 Assignment
Rrw02 Week 1 AssignmentRrw02 Week 1 Assignment
Rrw02 Week 1 Assignment
 
Chapter_01_Introduction_to_Computer.pptx
Chapter_01_Introduction_to_Computer.pptxChapter_01_Introduction_to_Computer.pptx
Chapter_01_Introduction_to_Computer.pptx
 
Chapter_01_Introduction_to_Computer.pptx
Chapter_01_Introduction_to_Computer.pptxChapter_01_Introduction_to_Computer.pptx
Chapter_01_Introduction_to_Computer.pptx
 
Machine learning in cybersecutiry
Machine learning in cybersecutiryMachine learning in cybersecutiry
Machine learning in cybersecutiry
 
Deep Dive on Deep Learning (June 2018)
Deep Dive on Deep Learning (June 2018)Deep Dive on Deep Learning (June 2018)
Deep Dive on Deep Learning (June 2018)
 
Deep Learning And Business Models (VNITC 2015-09-13)
Deep Learning And Business Models (VNITC 2015-09-13)Deep Learning And Business Models (VNITC 2015-09-13)
Deep Learning And Business Models (VNITC 2015-09-13)
 
An introduction to Machine Learning (and a little bit of Deep Learning)
An introduction to Machine Learning (and a little bit of Deep Learning)An introduction to Machine Learning (and a little bit of Deep Learning)
An introduction to Machine Learning (and a little bit of Deep Learning)
 
A Developer's Guide To Machine Learning
A Developer's Guide To Machine LearningA Developer's Guide To Machine Learning
A Developer's Guide To Machine Learning
 
Machine Learning Overview: How did we get here ?
Machine Learning Overview: How did we get here ?Machine Learning Overview: How did we get here ?
Machine Learning Overview: How did we get here ?
 
Open source ai_technical_trend
Open source ai_technical_trendOpen source ai_technical_trend
Open source ai_technical_trend
 
Machine learning the next revolution or just another hype
Machine learning   the next revolution or just another hypeMachine learning   the next revolution or just another hype
Machine learning the next revolution or just another hype
 
Yann le cun
Yann le cunYann le cun
Yann le cun
 
Deep Learning with CNTK
Deep Learning with CNTKDeep Learning with CNTK
Deep Learning with CNTK
 
The Andc Cluster
The Andc ClusterThe Andc Cluster
The Andc Cluster
 
Creating a Custom ML Model for your Application - Kotlin/Everywhere
Creating a Custom ML Model for your Application - Kotlin/EverywhereCreating a Custom ML Model for your Application - Kotlin/Everywhere
Creating a Custom ML Model for your Application - Kotlin/Everywhere
 
Introduction to ML.NET
Introduction to ML.NETIntroduction to ML.NET
Introduction to ML.NET
 
Ml goes fruitful
Ml goes fruitfulMl goes fruitful
Ml goes fruitful
 

Recently uploaded

The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 

Recently uploaded (20)

Towards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptxTowards a code of practice for AI in AT.pptx
Towards a code of practice for AI in AT.pptx
 
Model Attribute _rec_name in the Odoo 17
Model Attribute _rec_name in the Odoo 17Model Attribute _rec_name in the Odoo 17
Model Attribute _rec_name in the Odoo 17
 
VAMOS CUIDAR DO NOSSO PLANETA! .
VAMOS CUIDAR DO NOSSO PLANETA!                    .VAMOS CUIDAR DO NOSSO PLANETA!                    .
VAMOS CUIDAR DO NOSSO PLANETA! .
 
PANDITA RAMABAI- Indian political thought GENDER.pptx
PANDITA RAMABAI- Indian political thought GENDER.pptxPANDITA RAMABAI- Indian political thought GENDER.pptx
PANDITA RAMABAI- Indian political thought GENDER.pptx
 
OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...OS-operating systems- ch05 (CPU Scheduling) ...
OS-operating systems- ch05 (CPU Scheduling) ...
 
Wellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptxWellbeing inclusion and digital dystopias.pptx
Wellbeing inclusion and digital dystopias.pptx
 
Economic Importance Of Fungi In Food Additives
Economic Importance Of Fungi In Food AdditivesEconomic Importance Of Fungi In Food Additives
Economic Importance Of Fungi In Food Additives
 
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
Beyond_Borders_Understanding_Anime_and_Manga_Fandom_A_Comprehensive_Audience_...
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
How to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptxHow to setup Pycharm environment for Odoo 17.pptx
How to setup Pycharm environment for Odoo 17.pptx
 
21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx21st_Century_Skills_Framework_Final_Presentation_2.pptx
21st_Century_Skills_Framework_Final_Presentation_2.pptx
 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & Systems
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdfFICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
FICTIONAL SALESMAN/SALESMAN SNSW 2024.pdf
 
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
 
Play hard learn harder: The Serious Business of Play
Play hard learn harder:  The Serious Business of PlayPlay hard learn harder:  The Serious Business of Play
Play hard learn harder: The Serious Business of Play
 

Remoticon - TinyML Workshop.pptx

  • 1. TinyML Embedded Machine Learning Pre-flight checklist: ● Solder headers to mic breakout board ● Install STM32CubeIDE ● Install serial terminal program (e.g. PuTTY) ● Create Gmail and Edge Impulse accounts Worksheet: github.com/ShawnHymel/ei- keyword-spotting These slides are released under the CC BY 4.0 license. Find them here: bit.ly/remoticon-tinyml-slides
  • 2. ● Running machine learning algorithms on embedded systems ● Why do we need this? ○ Classification, prediction, decision making with little or no Internet connection ○ Voice activation, object detect, anomaly detection, etc. What is embedded machine learning?
  • 3. ● Worksheet: https://github.com/ShawnHymel/ei-keyword-spotting ● Work through together (feel free to work ahead) ● Describe concepts during pauses (downloading, compiling, running, etc.) ● Not a canned demo ○ OK, it’s kinda canned ○ Edge Impulse: graphical ML training tool (vs. running Colab script for training) ○ Use auto-generated library to create embedded ML project Syllabus
  • 4. Data Collection Steps ● Worksheet: https://github.com/ShawnHymel/ei-keyword-spotting ● Run Colab script through downloading/unzipping Google Speech Commands Dataset Google Speech Commands Dataset ● About: https://ai.googleblog.com/2017/08/launching-speech-commands- dataset.html ● Collection of 1-second snippets of spoken words ● Use as a starting point ● Select 1 or 2 words from this set to recognize
  • 5. Data Curation Steps ● Make account and new project on https://www.edgeimpulse.com/ ● Copy in API key ● Run script through curation google_speech_commands backward (1664 files) bed (2014 files) bird (2064 files) cat (2031 files) ... _background_noise_ (6 files) _noise (1500 files) _unknown (1500 files) down (1500 files) up (1500 files) keywords_curated dataset_curation.py target keywords
  • 6. Data Augmentation + “up” (google_speech_commands) “up” (keywords_curated) doing_the_dishes (_background_noise_) See for yourself! Download samples from Colab
  • 7. What is “Artificial Intelligence?” John McCarthy coined the term “artificial intelligence” in 1956 “[AI] is the science and engineering of making intelligent machines, especially intelligent computer programs...Intelligence is the computational part of the ability to achieve goals in the world.” --John McCarthy, 2007
  • 8. What is “Machine Learning?” Arthur Samuel coined the term “machine learning” in 1959 "A computer program is said to learn from experience E with respect to some class of tasks T and performance measure P, if its performance at tasks in T, as measured by P, improves with experience E." --Tom Mitchell, 1997
  • 9. What is “Deep Learning?” Rina Dechter coined the term “deep learning” in 1986 “Deep learning is a class of machine learning algorithms that uses multiple layers to progressively extract higher-level features from the raw input.” --Wikipedia
  • 10.
  • 12. Upload Data Steps ● Run final cell in Colab script to automatically upload data to Edge Impulse 20% 80% Set aside for testing after training Used for training Dataset is randomly shuffled Why? Models can “overfit” training data, so we test with unseen data
  • 13. Extract Features Steps ● Create Impulse: Audio (MFCC) > Neural Network (Keras) ● Generate MFCC Features Mel-frequency cepstral coefficients (MFCCs)
  • 14.
  • 15.
  • 16. LOLWUT? - MFCCs mimic how our ears/brain interpret sound - Give an idea of “overall shape” of sound signature - Ignore finer details - Popular in automatic speech recognition (ASR) - I wanna learn more! bit.ly/practical-cryptography- mfccs
  • 17. Train Neural Network Steps ● Keep default training settings ● Start training Reshape to 49x13 array 1D Convolution MaxPooling 1D 1D Convolution MaxPooling 1D Flatten to vector Softmax P_noise P_unknownPdown Pup MFCCs Convolutional Neural Network (CNN) Finds “features” in the image Classifier LOLWUT? - CNNs are common in deep learning for image classification - I wanna know how to design this! coursera.org/learn/machine-learning
  • 18. Evaluate on Test Set Steps ● Examine confusion matrix for training set ● Perform inference on (unseen) test set Check-in! Any questions or issues?
  • 19.
  • 20. Download and Add Model Files Steps ● Deployment > Download auto- generated C++ library with model ● Follow guide in Nucleo-L476 demo project: bit.ly/ei-nucleo-l476 ● Import project and model files 1. Import project from GitHub repo 2. Replace model-parameters and tflite-model folders with ones downloaded from Edge Impulse
  • 21.
  • 22.
  • 23.
  • 24. Run It! Steps ● Set build configuration to “Release” ● Compile (Flash: text + data, RAM: data + bss) ● Create Run Configuration ● Upload to board (“Run”) ● Connect serial terminal ○ 115,200 baud rate ○ 8-N-1 ● If “buffer overrun” ○ Up baud rate to 256,000
  • 26. Modify Code STM32L476 Resources ● Datasheet: bit.ly/stm32l476-datasheet ● HAL API: bit.ly/stm32l4- hal-api Core > Src > main.cpp > int main(void) Run > Run to compile and upload Twitter: @ShawnHymel Instagram: shawn_hymel LinkedIn: linkedin.com/in/ShawnHymel/ Hang out: bit.ly/remoticon-tinyml