03 - Algorithms for Embedded and Edge AI
03 - Algorithms for Embedded and Edge AI
2
An overview of an embedded and edge AI system
Software
Preprocessing
Sensors
Feature Extraction
Wake-word detection
Machine and Deep
Learning Algorithm
Postprocessing
Actuators Decision making
Person detection
Hardware
Gesture recognition
3
An overview of an embedded and edge AI system
Software
Preprocessing
Previous lecture!
Sensors
Feature Extraction
Wake-word detection
Machine and Deep
Learning Algorithm
Postprocessing
Actuators Decision making
Person detection
Hardware
Gesture recognition
4
An overview of an embedded and edge AI system
Software
Preprocessing
This lecture!
Sensors
Feature Extraction
Wake-word detection
Machine and Deep
Learning Algorithm
Postprocessing
Actuators Decision making
Person detection
Hardware
Gesture recognition
5
Algorithms for embedded and edge AI
Software
Preprocessing
Feature Extraction sensors, extract windows of data, remove noise and
extract relevant features
Machine and Deep • Apply machine/deep learning algorithms on the
Learning Algorithm
preprocessed data to generate and output (e.g., for
classification, regression or prediction)
Actuators
6
1) Data preprocessing and feature extraction
7
a) Chopping streams of data
Sensors
produces
streams of data
8
1_ acquire the data
• The latency defines how fast the embedded system can process the chunk of data
• The lower the latency, the higher the amount of chunks of data that can be processed in a
given amount of time (e.g., a second or a minute)
latency in preprocessing, machine learning, and the results.
• The design choice of the algorithm has a strong effect on the computational
requirement (the latency) as well as the memory demand (see next lectures)
9
Latency and frame rate
• The rate the system is able to acquire and process the data is called frame rate
(the same holds also for images and videos streaming)
10
Latency of
the algorithm
Latency of
the algorithm
Latency of
the algorithm
The latency has a strong effect on the effectiveness of the system
Latency of
the algorithm
11
Image taken from [1]
1) Data preprocessing and feature extraction (recap)
12
Digital processing algorithms for data preprocessing
Reconstruction
Resampling Filtering
of missing data
13
Digital processing algorithms for data preprocessing
14
Digital processing algorithms for data preprocessing
15
Digital processing algorithms for data preprocessing
17
Feature Extraction in the time domain
18
Feature Extraction in the frequency domain
• Max amplitude
• Main frequency
• Variance of peaks
19
Feature Extraction in the time-frequency domain: the spectrogram
20
Feature Extraction in the radar domain
Distance
Time
21
Image feature detection
22
Combining features and sensors: sensor fusion
Ferature
Sensor 1
extraction 1
Ferature
Sensor 2 Machine and Deep
extraction 2 Learning Algorithm
Postprocessing
Decision making
Ferature
Sensor 3
extraction 3
23
Combining features and sensors: normalization and standardization
• Features with different scales might underfit the training of machine learning
• Min-Max Normalization in the range [0,1]:
𝑥𝑖 − MIN(𝑥𝑖 )
𝑖
𝑥𝑖𝑛𝑜𝑟𝑚𝑎𝑙𝑖𝑧𝑒𝑑 =
MAX( 𝑥𝑖 ) − MIN( 𝑥𝑖 )
𝑖 𝑖
𝑥𝑖 − MEAN(𝑥𝑖 )
𝑥𝑖𝑠𝑡𝑎𝑛𝑑𝑎𝑟𝑑𝑖𝑧𝑒𝑑 =
𝑆𝑇𝐷(𝑥𝑖 )
24
Algorithms for embedded and edge AI
Software
Preprocessing
Feature Extraction sensors, extract windows of data, remove noise and
extract relevant features
Machine and Deep • Apply machine/deep learning algorithms on the
Learning Algorithm
preprocessed data to generate and output (e.g., for
classification, regression or prediction)
Actuators
25
Algorithms for embedded and edge AI
26
Machine and deep learning algorithms by functionality
• Classification
• Regression
• Object detection
• Segmentation
• Anomaly detection
• Prediction
• Feature reduction
27
Machine and deep learning algorithms by functionality
28
Machine and deep learning algorithms by functionality
• Feature reduction
Person 2
29
Machine and deep learning algorithms by functionality
• Classification
• Regression
• Object detection
• Segmentation
• Anomaly detection
• Prediction
• Feature reduction
30
Machine and deep learning algorithms by functionality
• Classification
• Regression
• Object detection
• Segmentation
• Anomaly detection
• Prediction
• Feature reduction
31
Machine and deep learning algorithms by functionality
MEMS
accelerometer
Flow meters
32
Machine and deep learning algorithms by functionality
33
Machine and deep learning algorithms by functionality
• Classification
• Regression
• Object detection
• Segmentation
• Anomaly detection
• Prediction • Compress or extract features
from audio chunks to reduce
• Feature reduction
the size
34
Algorithms for embedded and edge AI
35
Machine and deep learning algorithms by implementation
• Conditional logic
• Machine Learning
• Deep Learning
36
Conditional logic
• Deterministic
• Efficient
• Do not require training data
Image taken from [1]
37
Machine Learning and Deep Learning (and AI)
Artificial Intelligence
Machine Learning
Deep Learning
38
Machine Learning and Deep Learning (this time w/o AI)
39
Software
Embedded
SW Cloud
Edge
Machine/Deep
IoT Devices Learning
40
Heterogeneous hardware platforms for ML/DL
CPU RAM
… ...
Cloud
… …
PC
41
How does TinyML work?
Image from Medium.com “Introducing cAInvas for TinyML devices”, July 2020
42
To train or not to train…. this is the problem with TinyML
43
In the next two lectures we will see how to design
machine and deep learning solutions for TinyML
44