In this tutorial series, Shawn introduces the concept of Tiny Machine Learning (TinyML), which consists of running machine learning algorithms on microcontrollers and single board computers.
In the previous episode ( • Edge AI Anomaly Detect... ), we deployed our Mahalanobis Distance model and Autoencoder neural network to a Raspberry Pi, which was used to detect anomalies in a ceiling fan in real time.
Code and example dataset for this video series can be found here: github.com/Sha...
For this episode, we retrain the model using a slightly more robust method: we move the fan around during training to account for various possible states of the accelerometer. While the Mahalanobis Distance does not work well with this new model, the neural network is able to adapt and performs brilliantly.
We then convert the Mahalanobis Distance model and calculations to C code by generating a constant array in a header file for the mean and inverse covariance matrices of the training data. Next, we create a number of C functions that can calculate the Mahalanobis Distance. This is uploaded to our ESP32 using Arduino.
A piezo buzzer is connected to the ESP32, which will alert the user of an anomaly in real time. The ESP32 reads from the accelerometer, computes the median absolute deviation (MAD), and then calculates the Mahalanobis Distance (MD) between the new sample and the model’s mean. If the MD is over a set threshold, we sound the buzzer (alerting the user of a possible anomaly).
Similarly, we convert the autoencoder to a TensorFlow Lite model and create a C header file out of the FlatBuffer. The ESP32 reads data from the accelerometer, computes the MAD, and then runs the MAD values through the trained Autoencoder. The mean squared error (MSE) is computed between the input and output of the autoencoder. If the MSE is above a particular threshold, we sound the buzzer.
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...
Piezo Buzzer - 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...
Edge AI Anomaly Detection Part 3: Deploy Machine Learning Models to Raspberry Pi - • Edge AI Anomaly Detect...
Related Project Links:
Edge AI Anomaly Detection Part 4: Machine Learning on Arduino - 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 Tutorials: www.digikey.co...
Low-Cost Data Acquisition (DAQ) with Arduino and Binho for ML
www.digikey.co...
Intro to TinyML: www.digikey.co...
Edge AI Anomaly Detection: www.digikey.co...
Негізгі бет Edge AI Anomaly Detection Part 4: Deploy TinyML Model in Arduino to ESP32 | Digi-Key Electronics
No video
Пікірлер: 19