NanoEdge AI Studio V3 - Anomaly Detection demo
Summary
TLDRThe video introduces Nano Aji Studio, a tool that enables developers to integrate machine learning into C code without prior knowledge in the field. It focuses on creating an anomaly detection project using a 3-speed USB fan and the ST Win board. The step-by-step process covers project creation, data logging, signal analysis, library benchmarking, and deployment. The system adapts to changing conditions and can detect abnormal behaviors in real time. With embedded learning, the Nano AI libraries provide efficient, adaptable solutions for various use cases.
Takeaways
- 💻 Nano Aji Studio is a search engine for machine learning libraries, enabling developers to embed smart features into C code.
- 📊 The studio offers four types of projects: anomaly detection, one-class classification, n-class classification, and extrapolation.
- 🛠️ A project example involves using the ST Win board to monitor vibration patterns on a three-speed USB fan.
- 🔧 The Data Logger feature allows for easy configuration and logging of data from sensors like accelerometers.
- 📈 Anomaly detection is demonstrated by collecting data representing normal fan behavior and using it as a baseline for comparisons.
- 🚀 The studio benchmarks Nano AI libraries, optimizing pre-processing, machine learning models, and hyperparameters to find the best fit for a use case.
- 🎛️ Nano AI libraries are adaptable and can be trained incrementally in the microcontroller to detect anomalies in real-time.
- 🔄 The learning process can be dynamic, allowing for continuous adaptation to new conditions or regimes on the machine.
- 🧠 The main focus of Nano AI libraries is embedded learning, making them highly effective in detecting anomalies that haven't been seen before.
- 📦 After benchmarking, developers can deploy their custom Nano AI library and test it on real devices like the ST Win board.
Q & A
What is Nano Aji Studio?
-Nano Aji Studio is a search engine for machine learning libraries that allows developers to easily embed smart features into C code. It provides a named AI Library optimal for a given use case with minimal data input.
What types of projects can be created with Nano Aji Studio?
-Nano Aji Studio supports four types of projects: anomaly detection, one-class classification, n-class classification, and extrapolation.
How does the anomaly detection project work?
-The anomaly detection project provides a dynamic model that learns patterns incrementally and infers directly within the target microcontroller, identifying deviations from learned patterns.
What is the purpose of the Data Logger feature in Nano Aji Studio?
-The Data Logger feature allows users to configure their STM32 boards to log sensor data easily. It simplifies the process of collecting data for machine learning model training.
What is the process for creating a new anomaly detection project in the script?
-The process involves defining general project settings, importing signals representing normal and abnormal behaviors, running a benchmark to find the best AI library for the use case, and then deploying the library to the target device.
How does the script demonstrate the use of an accelerometer with the STM32 board?
-The script demonstrates using an accelerometer by placing an STM32 board on top of a USB fan to monitor vibration patterns, capturing raw data, and using it as input for the anomaly detection project.
What is the significance of the buffer size and sampling frequency in the data logging process?
-The buffer size of 256 XYZ samples and a sampling frequency of 833 Hz ensure that each buffer represents approximately 300 milliseconds of data, which is sufficient to capture the essence of the fan's vibration patterns.
How does the script simulate abnormal behavior for the anomaly detection project?
-The script simulates abnormal behavior by changing the orientation of the fan by 90 degrees to introduce unusual vibration patterns, which are then used as input for the anomaly detection model.
What performance indicators are used to evaluate the anomaly detection library?
-The performance indicators used are balanced accuracy, which measures the library's ability to correctly classify signals as normal or abnormal, and confidence, which reflects the mathematical distance between normal and abnormal signals.
How is the final library tested before deployment?
-The final library is tested using an emulator that allows for easy testing without needing to download, link, or compile anything. It involves initializing the library, running an initial learning cycle, and then performing inference to check for anomalies.
What adaptability does the Nano AI library offer for anomaly detection?
-The Nano AI library offers adaptability through embedded learning, allowing the library to learn new patterns and adapt to changes in the operational regime of the device, making it suitable for dynamic environments.
Outlines
🔍 Introduction to Nano AI Studio and Project Overview
Nano AI Studio is a powerful tool designed for developers to easily embed machine learning features into C code. It outputs a small AI library optimized for specific use cases. This video demonstrates creating an anomaly detection project using a USB fan and the ST WIN board to monitor vibration patterns. Nano AI Studio offers four project types: anomaly detection, one-class classification, n-class classification, and extrapolation. The tutorial begins with a quick overview of the platform and its features, including use case inspirations and how the studio performs on various datasets.
⚙️ Initial Project Setup and Data Collection
In this step, the project is set up to monitor normal fan behavior at speed one using an accelerometer. The focus is on selecting the ST WIN sensor tile board and configuring it for data logging. The tutorial explains how to import data using three different methods (file, SD card, or serial). For this demo, the serial input method is used to collect normal fan vibration data. The tutorial emphasizes that for more complex applications, data representing all possible states (e.g., different fan speeds) could be logged and concatenated.
🔄 Collecting Abnormal Data and Preparing for Training
The tutorial moves on to simulate abnormal fan behavior by changing the fan's orientation. This is done to introduce abnormal vibration patterns, which are collected and imported as signal examples. Importantly, these abnormal signals are not used for training but rather to provide context for the studio's search during library creation. The tutorial highlights the adaptive nature of Nano AI libraries, which can detect unseen anomalies during real-world use.
🏁 Running Benchmarks to Find the Best Library
A benchmark is run to find the best Nano AI library for anomaly detection. The process involves testing many possible library configurations, combining signal pre-processing, machine learning models, and hyperparameters. Key performance indicators include balanced accuracy, confidence, and resource usage (RAM and Flash memory). The tutorial explains how to interpret the benchmark results, aiming for high similarity for normal signals and low similarity for abnormal ones, while optimizing for memory efficiency.
🤖 Testing the Anomaly Detection Library
The newly created library is tested using the ST WIN board and fan setup. After an initial learning phase, the library successfully detects normal and abnormal fan behavior in real time, including subtle anomalies like obstructed airflow. The tutorial highlights the library's adaptability through embedded learning, allowing it to adjust to new norms dynamically. Developers can easily implement more complex learning strategies, such as learning multiple regimes or enabling user-triggered learning.
🚀 Deploying the Nano AI Library
The final step involves deploying the Nano AI library onto a device. The tutorial demonstrates how to compile and integrate the library into an STM32CubeIDE project. Simple pseudocode is provided to illustrate how the library is used for initialization, learning, and detection in an infinite loop. The tutorial concludes by showcasing how easy it is for developers to deploy smart features into their devices without needing extensive knowledge of machine learning or data science.
Mindmap
Keywords
💡Nano Aji Studio
💡Anomaly Detection
💡STD WIN Board
💡Data Logger
💡Microcontroller
💡Accelerometer
💡Inference
💡Buffer Size
💡Sampling Frequency
💡Signal Pre-processing
💡Hyperparameters
Highlights
Nano Aji studio is introduced as a search engine for machine learning libraries, simplifying the integration of AI into C code.
The tool requires minimal data input and outputs an AI Library tailored to specific use cases.
A new anomaly detection project is demonstrated using the STD wind board to monitor a USB fan's vibration patterns.
The homepage of Nano Aji studio is showcased, highlighting the creation of new projects and available project types.
The inspiration section on the studio's homepage provides use case ideas and links to the use case explorer.
Four types of Nano AI projects are explained: anomaly detection, one class classification, n-class classification, and extrapolation.
The Data Logger feature is described, allowing for easy configuration and data logging from sensors.
A simple three-speed USB fan is used as a model to simulate an industrial vibrating machine for the project.
The process of creating a new anomaly detection project in the studio is detailed, starting with general settings.
Signals representing normal fan behavior are imported from the serial port, using a specific buffer size and sampling frequency.
Abnormal behavior signals are collected by altering the fan's orientation to introduce different vibration patterns.
The Benchmark step is explained, where the studio searches for the best AI library based on the provided normal and abnormal signals.
The Nano AI library is composed of a pre-processing algorithm, a machine learning model, and a set of hyperparameters.
The importance of providing context with abnormal signals during the Benchmark step is emphasized for the automatic search process.
The performance indicators for anomaly detection libraries, such as balanced accuracy and confidence, are discussed.
The process of testing the library using an emulator without downloading or compiling is demonstrated.
The final deployment step is shown, where the Nano AI library is compiled and ready to be integrated into the target device.
The adaptability of the Nano AI library due to embedded learning is highlighted, allowing for dynamic updates to what is considered normal behavior.
The Nano AI documentation on the ST Wiki is mentioned as a resource for further information about the studio and libraries.
Transcripts
[Music]
Nano Aji studio is a search engine for
machine learning libraries it provides
any developer with a simple way to start
embedding smart features into any c code
this tool takes as input minimal amounts
of data and as output provides a naned
AI Library which is optimal for a given
use case today we will get familiar with
the studio by creating a new anomaly
detection project from scratch we will
use the STD wind board to monitor some
vibration patterns on a three-speed USB
fan here's the studios homepage where
you can create new projects out of the
four available
types below is the list of all available
projects on the right side the
inspiration section lists many use case
ideas which link directly to st's use
case
Explorer there you will find out how nji
Studio performs on these data sets which
are all available to download for
free there are four types of Nano AI
projects anomaly detection which
provides a dynamic model that learns
patterns incrementally and infer both
directly within the target
microcontroller one class classification
which is used to detect outliers within
data and is especially useful when no
examples of abnormal behaviors can be
provided on the system
n-class classification which enables
automatic identification of a machine
State among many different possible
States and extrapolation which uses
mathematical regression models in order
to estimate a Target value using other
known
features Additionally the Data Logger
feature provides a quick and easy way to
configure your St win data loger simply
connect your STD win and STD link to
your PC as indicated and click load
binary then click configure Data Logger
and select the sensors that you wish to
use for data logging as well as their
configuration finally click download
configuration to get the device
config.js file which needs to be copied
to the root of your SD wins SD
card you're now ready to log some data
onto your s wins SD card in that format
D of course this is just one way out of
many to log some data for instance today
we will not use this feature but instead
a more standard serial Data Logger
procedure let's get started with the
creation of our smart vibration
sensor here we have a very simple
three-speed USB fan that will be used as
a basic model to simulate an industrial
vibrating
machine we also have the St winds sensor
tile board the reference is St eval St
win KT
1B this board features many different
sensor types but today we'll only use
the
accelerometer we will just place the St
win on top of the fan and secure it
using some blue
tack at the moment on the St win we have
some very basic data logging code
there's no intelligence yet the logger
reads raw accelerometer data as XY Z
instantaneous samples and then formats
it into a buffer which is nothing more
than a collection of many XYZ samples
which we also call a signal example or a
learning
example and finally it outputs this
buffer or signal example directly to the
serial port or
USB this serial stream of buffers can be
read through the terminal and of course
we will use it as an input to provide
data to the
studio here we're using a buffer size of
200 156 which means that each line is
composed of 256 XYZ
samples the sampling frequency used on
the accelerometer is 833 Herz it means
that each buffer represents a temporal
signal of approximately 300 milliseconds
which seems to be sufficient to capture
the essence of the Fan's vibration
patterns let's create a new anomaly
detection
project in the first step we Define the
general setting of our project we'll
call it fan
vibration then we select the St win in
the list of available
boards the Nano AI libraries are of
course compatible with any stm32 board
with a cortex M
microcontroller and we choose our sensor
a 3axis
accelerometer the Nano AI libraries are
completely sensor agnostic meaning that
we can use any sensor type or even a
combination of several
sensors for instance we could have used
a combination of accelerometer 3 AIS
gyroscope 3 AIS and temperature sensor
which is only one variable for a
combined total of seven axes or seven
variables for this we would have
selected a generic sensor with seven
axes we could also decide to restrict
the maximum amounts of RAM and Flash
memories that our library will use if we
have specific constraints in our
application but today it's not the case
so we'll just leave it as it is and even
increase the maximum amount of ram to 32
kiloby because we don't want to limit
the search space in any way during
Benchmark then we move on to step number
two where we will import signals
representing the normal behaviors of the
fan to add signals we can import from
three different sources from file in
text or CSV format
from an SD wins data loggers SD card in
that format as explained briefly
earlier in which case we select a sensor
we choose a buffer
size and we import the
data or finally we can choose serial
from USB which is what we'll do
today we plug the S2 in select the right
Port the B rate and and turn the fan on
at speed number
one we'll consider that the normal
behavior of the fan is when it is
running at speed number one then we can
start collecting signals we'll stop
after we've got approximately 30
buffers here for the Simplicity of the
demo we only collect data representing
one single mode of operation or regime
on Ouran which is speed number one but
of course we could gather data
representing all the different states
that we' like to consider as the norm on
our machine it could be for instance
signals representing all speeds not only
one but also number two and three in
that case we would just concatenate all
signal examples representing all the
normal regimes in one single nominal
signal
file then we click continue and make
sure that our data looks fine and click
import the signal screen summarizes the
contents of the data we've just logged
on the right hand side we have previews
of the imported data with both temporal
and frequency plots or ffts for all
sensor axes so here we have the X Y and
Z accelerometer
axes it is possible to use a manual
filter if we'd like to remove some of
the unwanted frequency components within
our
signal just click filter settings
activate the
filter then input the sampling frequency
us used here we are at 833 Herz and
choose the low and high cut off
frequency values for example we may want
to remove all frequencies above 200
Hertz like
so and we can see how our changes are
reflected on the fft
plots but today we don't want to filter
frequencies so we'll just deactivate the
filter then we move on to the third step
where we import signals representing
abnormal behaviors on our system we
follow the exact same procedure as
before but this time we'll change the
behavior of a fan so that it functions
in a way that is
unusual for Simplicity we will simulate
this abnormal behavior by changing the
orientation of the fan by 90° to
introduce abnormal vibration patterns we
turn the fan on and collect
approximately 30 signal
examples the signal examples we provide
at this point are not used to train the
library it is very important they are
only used to provide some context for
the automatic search that will happen in
the next step because all the learning
will happen later on in the
microcontroller after the library has
been embedded on the target machine the
examples of anomalies provided here
don't need to be exhaustive for a real
use case for instance they could be
collected on a faulty machine or in
conditions that are known to be
abnormal or or depending on the case
they could even be created
artificially when testing our library we
will see that in fact we are able to
detect anomalies that were never seen
before because the embedded learning is
what makes Nano AI libraries especially
for anomaly detection particularly
adaptable let's import these abnormal
signals check our graphs and
proceed here we get to the four step
Benchmark we click run new Benchmark
select our couple of signals both Normal
and abnormal the number of cores we wish
to use on the CPU and
start at this point the studio will
start working hard to find the best
possible library for our use case given
the signals that we provided the
nanoedge library is composed of three
main blocks first there's an optional
signal pre-processing algorithm this
could be very simple such as offsetting
or normalizing or more complex like fft
or PCA and so
on second we have the choice of the
machine learning model in the pool of
available models we have Classics of
machine learning such as K&N svm neuron
networks and so on but we also have more
specific models developed inhouse and
patented by STD which were designed for
microcontrollers and are therefore
extremely well
optimized and third we have a set of
hyperparameters for the machine learning
model so that it can solve the problem
at hand as effectively and efficiently
as
possible so for each Library made of
these three blocks pre-processing
machine learning model and
hyperparameters there are many
possibilities which results in millions
of possible combinations and millions of
possible
libraries during Benchmark each
candidate library is tested using the
couples of signals imported previously
we learn the normal signals and then run
inference on both the Normal and
abnormal signals this whole process
happens many times for each Library
using random subsets of the data
provided to minimize any possible
bias the results are displayed here on
this graph on the xais there's the
signal number and the Y AIS is the
percentage of similarity which is the
raw output of the inference or detection
function of course would like all the
blue points with which corresponds to
the normal signals imported in step two
to be as close to 100% similarity as
possible and would like all the red
points the abnormal signals from step
three to be close to
0% the most important performance
indicator for the anomaly detection
candidate library is the balanced
accuracy which translates the ability of
the library to correctly attribute the
input signals to the correct class
either normal or
abnormal one 100% accuracy would mean
that all the blue points are above the
90% decision boundary the gray dash line
here and all red points are
below the second performance indicator
is confidence which translates how much
mathematical distance the library is
able to put between the Normal and
abnormal
signals 100% confidence would mean that
all the blue points are at exactly 100%
similarity while all the red points are
exactly at
zero finally the amount of RAM and Flash
memories are also optimized previously
in Project settings we put a constraint
on maximum RAM at 32 kiloby but here we
see that the best Library found so far
only takes much much
less The Benchmark process can take
anywhere from a few minutes to a few
hours here we've already obtained
excellent results so we'll stop The
Benchmark
manually now we have our best Nano AGI
Library
which is the only one kept by default
but we can also access the list of the
best candidate libraries found during
Benchmark by clicking
here we may select another one for
example one which has lower memory
Footprints despite slightly worse
accuracy or
confidence before testing our library
let's have a quick look at the functions
that it
provides for anomaly detection we have
the initialization function which needs
to be run first
first then we have the learn function
which is incremental Dynamic and can be
called at any time and finally the
inference function detect which outputs
a similarity percentage which measures
how much any given signal matches with
what was learned
before now we can test our library using
the
emulator each library has its own
emulator which allows for easy testing
without the need to download link or
compile anything we first initialize our
library and then learn some basic
knowledge we'll use our serial Data
Logger turn the fan on at speed number
one and start logging data we'll take
approximately 15
signals remember that anomaly detection
libraries come untrained out of the
Benchmark that's why we need to run an
initial learning cycle first
now that we have our reference knowledge
let's go to detection to see how the
library
behaves again we'll use serial
data and here the inference results
shows 100% similarity which was expected
since our fan is still running normally
now if we start tapping on the fan the
similarity drops
instantly same if we change the fans
orientation and back to normal if we
leave it
alone our library is behaving as
expected so we can move on to the final
step
deploy here we have a few developer
options available for the S win we only
need to check the first
one and then we can click the compile
button we will get a zip file
which contains the Nano Library which is
a static precompiled C language Library
here lib ne. a as well as the header
file Nano
A.H we need to import both of these into
our favorite
IDE here I'm using stm32 Cube
IDE and I will recompile my S wi to
transform it into a smart device and
we'll be ready to test it
here's a quick overview of the code that
we've prepared for our
device these are just Snippets of pseudo
code it is not full working
code first we initialize the
library then we run the initial learning
phase with only 15
iterations each time we get fresh
accelerometer data and pass it to the
learn
function after that we have the detect
function which runs in in an infinite
loop as soon as the learning is
over here we take the inference output
similarity and if it's higher than 90%
we say that everything is normal
otherwise under 90% we say anomaly of
course this is the simplest possible
logic and we could have coded something
much more
elaborate now that the S win is flashed
and the device ready let's see how it
works we turn the fan on reset the board
learning is in
progress and
finished everything is nominal and if we
change the orientation we start getting
anomalies and back to the original
states we're back to
nominal now let's introduce a more
subtle anomaly which was never seen
before we'll simulate that with a piece
of paper obstructing the airflow of the
fan
when we approach the paper the
similarity drops instantly and we get
anomalies as
expected note that here the piece of
paper is not even touching the
fan now the most important aspect of the
Nano library is its adaptability due to
the embedded learning for instance if we
suddenly change regimes and decide that
this is the new Norm we just have to
reset the board and learn this instead
as the new
norm and we get a nominal
result if we change back to the normal
orientation which we haven't learned yet
as expected the library returns
anomalies here we could imagine more
complex learning strategies for example
learning multiple regimes or enabling
the user to start a complimentary
learning phase with the Press of a
button for example
so hopefully today we've demonstrated
how easy it is using nooi Studio for any
developer to start embedding smart
features into their devices without any
prior knowledge in machine learning or
data science and all that in less than
an hour for any information about the
studio or the libraries please refer to
the Nano AI documentation which is
available on the St Wiki
[Music]
[Music]
Посмотреть больше похожих видео
5.0 / 5 (0 votes)