In this tutorial series, Shawn introduces the concept of Tiny Machine Learning (TinyML), which consists of running machine learning algorithms on microcontrollers.
On the previous episode ( • Edge AI Anomaly Detect... ), we created an Internet of Things (IoT) data collection node using an Adafruit Feather Huzzah32 (ESP32) and MSA301 Triple Axis Accelerometer. We collected vibration data from a ceiling fan running at several different speeds with and without a coin attached to a fan blade (emulating an “anomaly”).
This second episode introduces feature analysis and model training. We load the accelerometer data we collected in the previous episode and examine a number of statistical features, including mean, variance, skewness, kurtosis, median absolute deviation (MAD), correlation, and the Fast Fourier Transform (FFT).
Code and example dataset for this video series can be found here: github.com/Sha...
By examining the groupings of normal vs. anomalous samples, we can determine that the MAD (in all three axes) would make for the best feature, as it offered the greatest separation between the groups of normal samples and anomalies.
Once we have chosen the feature(s), we can train our machine learning models. We first look at the Mahalanobis distance, which gives us an idea of the distance between a new sample and a group’s mean coordinates. If the Mahalanobis distance is too high, we can classify the sample as an “anomaly.”
Next, we create a different type of detection system using a neural network. Specifically, the neural network is configured as an autoencoder, which attempts to recreate any input values at its output nodes. We compute the mean squared error (MSE) between the input and output values to determine how well the autoencoder performed. If the MSE is low, we classify the input as “normal,” and if the MSE is high, we classify the input as “anomaly.”
These models are trained, tested, and saved for later use.
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...
Product Links:
Adafruit Feather Huzzah32 - www.digikey.co...
Adafruit MSA301 Triple Axis Accelerometer - www.digikey.co...
Related Videos:
Edge AI Anomaly Detection Part 1: Data Collection - • Edge AI Anomaly Detect...
Edge AI Anomaly Detection Part 2: Feature Extraction and Model Training: • Edge AI Anomaly Detect...
• Shawn Hymel presents
Related Project Links:
Edge AI Anomaly Detection Part 2: Feature Extraction and Model Training - www.digikey.co...
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...
Intro to TinyML Part 1: Training a Model for Arduino in TensorFlow
www.digikey.co...
Intro to TinyML Part 2: Deploying a TensorFlow Lite Model to Arduino
www.digikey.co...
Edge AI Anomaly Detection Part 1: Data Collection
www.digikey.co...
5 окт 2024