1 of 64

Embedded Machine Learning�TinyML – Application Demo

​

Prof. Marcelo José Rovai

UNIFEI - Federal University of Itajubá, Brazil

TinyML4D Academic Network Co-Chair

​

1

2 of 64

Summary

  1. TinyML Applications - Introduction
  2. Sound - KWS Demo
  3. (Extra) - Vision
  4. (Extra) - Vibration
  5. To learn more
  6. Q & A

2

3 of 64

TinyML Applications�Introduction

3

4 of 64

Hardware

Software

TinyML ?

TinyML

4

5 of 64

Hardware

Software

TinyML

TinyML ?

5

6 of 64

​

Raspberry Pico (W)

Arduino Nano Sense

ESP 32

Seeed XIAO

Sense / ESP32S3

Arduino Pro

32Bits CPU

Dual-core Arm Cortex-M0+

Arm Cortex-M4F

Xtensa LX6 Dual Core

Arm Cortex-M4F (BLE)

Xtensa LX7 Dual Core

Dual Core Arm Cortex M7/M4

CLOCK

133MHz

64MHz

240MHz

64 / 240MHz

480/240MHz

RAM

264KB

256KB

520KB (part available)

256KB / 8MB

1MB

ROM

2MB

1MB

2MB

2MB / 8MB

2MB

Radio

(Yes for W)

BLE

BLE/WiFi

BLE / WiFi (ESP32S3)

BLE/WiFi

Sensors

No

Yes

No

Yes (Sense)

Yes (Nicla)

Bat. Power Manag.

No

No

No

Yes

Yes

Price

$

$$$

$

$$

$$$$$

Hardware

6

7 of 64

Power

CPU Power / Memory

Application Complexity

XIAO

Hardware vs. Apps

7

8 of 64

  • Regression
  • Classification
  • Object Detection
  • Anomaly Detection
  • Autonomous Navigation

8

9 of 64

9

10 of 64

10

11 of 64

Personal Assistant

11

12 of 64

Personal Assistant

12

13 of 64

Personal Assistant

KWS

13

14 of 64

“Cascade” Detection: multi-stage model

14

15 of 64

Digital Mic

“Yes”

MFCC Feature

Converter

Obtains an input

Pre-Process

Runs model

Post-Processes

Make things happen

16KHz / 16 bits

Sample: [1s]

Output: Image

[13, 49, 1]

Output Dim [1, 4]

  • Prob ‘Noise’
  • Prob ‘Unknown’
  • Prob ‘Yes’
  • Prob ‘No’

If Probability of YES is greater than 80%

Take actions

KeyWord Spotting (KWS) - Inference

Time-Series Raw data

1D-Image

15

16 of 64

How to Train our ML Model?

16

17 of 64

Collect

Data

Preprocess

Data

Design a

Model

Train a

Model

Evaluate

Optimize

Convert

Model

Deploy

Model

Make

Inferences

Machine Learning Workflow (“What”)

17

18 of 64

Collect

Data

Preprocess

Data

Design a

Model

Train a

Model

Evaluate

Optimize

Convert

Model

Deploy

Model

Make

Inferences

Machine Learning Workflow (“Where”)

18

19 of 64

Collect

Data

Preprocess

Data

Design a

Model

Train a

Model

Evaluate

Optimize

Convert

Model

Deploy

Model

Make

Inferences

Machine Learning Workflow (“How”)

19

20 of 64

Collect

Data

Preprocess

Data

Design a

Model

Train a

Model

Evaluate

Optimize

Convert

Model

Deploy

Model

Make

Inferences

Machine Learning Workflow (“How”)

20

21 of 64

Collect

Data

Preprocess

Data

Design a

Model

Train a

Model

Evaluate

Optimize

Convert

Model

Make

Inferences

Preprocess

Data

Design a

Model

Train a

Model

Evaluate

Optimize

Convert

Model

Deploy

Model

21

22 of 64

EI Studio - Embedded ML platform (“AutoML”)

22

23 of 64

XIAO-ESP32S3-KWS (Edge Impulse)

23

24 of 64

Speech Commands Dataset (reduced set)

24

25 of 64

1 second sample@16KHz raw data -> 16,000 features

Processed features -> 637 features (13 x 49)

49

13

Pre-Processing (MFCC)

25

26 of 64

26

27 of 64

27

28 of 64

28

29 of 64

29

30 of 64

30

31 of 64

31

32 of 64

32

33 of 64

33

34 of 64

34

35 of 64

XIAO-ESP32S3-CAM-Fruits-vs-Veggies-v1-ESP-NN (Edge Impulse)

35

36 of 64

Fruits and Vegetables Image Recognition Dataset (Kaggle)

36

37 of 64

37

38 of 64

38

39 of 64

Serial Monitor

ESP-NN

(96 x 96 x 3) – RGB

39

40 of 64

ESP - CAM Xtensa LX6 240 MHz

171 ms

ARDUINO Pro ARM H7

480 MHz

45 ms

XIAO ESP32S3 Xtensa LX7 240 MHz

135 ms

40

41 of 64

41

42 of 64

D4

D5

GND

3.3V

MPU6050 SCL  --> XIAO D5

MPU6050 SDA  --> XIAO D4

MPU6050 VCC  --> XIAO 3.3V

MPU6050 GND --> XIAO GND

42

43 of 64

43

44 of 64

XIAO-ESP32S3-Motion-Classification

(Edge Impulse)

44

45 of 64

/ WiFi

SciTinyML - 2023 - Marcelo Rovai Presentation (day 2)

45

46 of 64

46

47 of 64

Raw Data from sensor

300 Raw Features

  • RMS
  • SKEW
  • KURT
  • FFT
  • PSD

Spectral Analysis

Features

Classes

NN Classifier

Sliding Window: 200 ms

Manual Feature

Extraction

  • Lift
  • Terrestrial
  • Maritime
  • Idle

TinyML under the hood: Spectral Analysis

47

48 of 64

48

49 of 64

49

50 of 64

50

51 of 64

51

52 of 64

Preprocess

Data

units = 63

​

​

63 Features

Classes

Input Layer

  • Lift
  • Terrestrial
  • Maritime
  • Idle

Hidden Layer 1

Hidden Layer 2

​

Output Layer

​

(63x20)

  • RMS
  • SKEW
  • KURT
  • FFT
  • PSD

52

53 of 64

53

54 of 64

54

55 of 64

55

56 of 64

56

57 of 64

Maritime

Lift

57

58 of 64

To learn more …

58

59 of 64

To learn more …

On the TinyML4D website, You can find lots of educational materials on TinyML. They are all free and open-source for educational uses – we ask that if you use the material, please cite them! TinyML4D is an initiative to make TinyML education available to everyone globally.

59

60 of 64

TinyML4D Show&Tell Presentations

Date

​

August 31st, 2023

May 25th, 2023

Thread

​

TBD

Thread here

Video

​

Video here when ready

Video here when ready

April 20th, 2023

March 30th, 2023

February 23rd, 2023

January 26th, 2023

December 1st, 2022

October 27th, 2022

TinymML4D Academic Network Show and Tell Main Index.

​

The TinyML4D Academic Network Students should use this form to sign up for the latest presentations.

https://forms.gle/ic52HZMqVv4pBrkP7 2

​

The Show and Tell are typically held at 2 pm UTC on the last Thursday of each month and will take place in this Zoom room.

https://zoom.us/j/95229860797 1

Meeting ID: 952 2986 0797�Passcode: 141278

60

61 of 64

Q & A

61

62 of 64

Marcelo Rovai was born in São Paulo and holds a Master’s degree in Data Science from the Universidad del Desarrollo (UDD) in Chile and an MBA from IBMEC (INSPER) in Brazil. He graduated in 1982 as an Engineer from UNIFEI, Federal University of Itajubá, with a specialization from Polytechnic School of São Paulo University (USP), both institutions located in Brazil.

Rovai has experience as a teacher, engineer, and executive in several technology companies such as CDT/ETEP, AVIBRAS Aeroespacial, SID Informática, ATT-GIS, NCR, DELL, COMPAQ (HP), and more recently at IGT as a VP and a Senior Advisor for Latin America.

​

Marcelo Rovai publishes articles about electronics on websites such as MJRoBot.org, Hackster.io, Instructables.com, and Medium.com. Furthermore, he is a volunteer Professor at the UNIFEI in Brazil and a lecturer at several Congresses and Universities on IoT and TinyML. He is an active member and a Co-Chair of the TinyML4D group, an initiative to bring TinyML education to developing countries.

62

63 of 64

TinyML4D Academic Network

Brazil

Morocco

Panama

Ethiopia

Ethiopia

63

64 of 64

Thanks

64