Warning
- This documentation is obsolete.
- Please visit the STMicroelectronics Wiki page.
Frequently Asked Questions¶
I. NanoEdge AI Studio¶
A. Input data and formatting¶
Input files contain m lines each composed of n numerical values per line, which are separated by a uniform separator. Each line represents an independent signal example. The number of values per line is specific to each project, but always depends on the number of axes of the sensor used, and its buffer size (number of samples per axis).
Mono-sensor
Here is an example for a 3-axis sensor. We have a collection on m signals (lines) with a buffer size of 256 on each axis, which results in 256x3 = 768 values per line.
![]()
Warning
We have
NUMBER_OF_AXES * BUFFER_LENGTH
values per line. A line represents a signal snapshot consisting of several samples.
Multi-sensor
Here is an example for a 3-axis accelerometer, 3-axis magnetometer, 3-axis gyroscope coupled with a temperature sensor (10 variables in total).
![]()
Warning
We only have
NUMBER_OF_VARIABLES
values per line (effectively, a buffer length of 1). A line represents a single sample of the signal, not a full signal snapshot anymore.
Note
If your input files contain formatting errors, or suspicious data, you will see warnings or errors in NanoEdge AI Studio. You can click on those warnings/errors for more information and advice.
For more information, see Studio: input file format.
Neither the Studio nor the Library will explicitly take signal overlapping into account, as each line of the input files is independent.
Signal overlapping may still be included if you have good reasons to use it, but be aware that it might hurt performances (e.g. by “diluting” useful signal features).
Each line of an input file (normal/abnormal signals for anomaly detection, or classes for classification )represents an independent signal example.
Each of these lines will be passed independently to the NanoEdge AI functions: learn/detect (AD), or classify (Cl). These signal examples will be seen one by one by the algorithms, and used to establish a model and/or enrich its knowledge.
Warning
Please check the following section from the Studio documentation: Which signals to put in which files.
n
: buffer sizef
: sampling frequencyL
: signal lengthThey are linked together via:
n = f * L
. In other words, by choosing two (according to your use case), the third one will be constrained.
Here are general recommendations. Make sure that:
the sampling frequency is high enough to catch all desired signal features. To sample a 1000 Hz phenomenon, you must at least double the frequency (i.e. sample at 2000 Hz at least).
your signal is long (or short) enough to be coherent with the phenomenon to be sampled. For example, if you want your signals to be 0.25 seconds long (
L
), you must haven / f = 0.25
. For example, choose a buffer size of 256 with a frequency of 1024 Hz, or a buffer of 1024 with a frequency of 4096 Hz, and so on.For more information, see Studio: sampling frequency.
Note
For best performances, always use a buffer size n
that is a power of two (e.g. 128, 512…).
Of course not. If would defeat the purpose, and be almost impossible to do in practice.
The “abnormal signals” file doesn’t have to be exhaustive. Just include examples of some anomalies that you’ve already encountered, or that you suspect could happen. If needed, don’t hesitate to create “anomalies” manually.
Note
In order for the selected nanoEdge AI Library to detect very “subtle anomalies”, we recommend that the data provided as abnormal signals includes at least some examples of subtle anomalies as well, and not only very gross, obvious ones.
NanoEdge AI Studio’s purpose is to search for the best possible NanoEdge AI Library for your application, among millions of possibilities. The “abnormal signals” are only provided to give some context context, to narrow down the scope of this search.
After the best Library is found, this Library will be able to learn behaviors, specific to your use case, but will have no knowledge yet. All knowledge must be acquired in-situ, by running some learning iterations after the Library is embedded on the microcontroller.
No information is learned regarding anomalies. The Library only learns what is normal, and figures out what is an anomaly by itself. As such, when embedded, the learning is completely unsupervised.
Let’s consider that you have several data sources, i.e. multiple input files for both “regular signals” or “abnormal signals”.
- Should you concatenate all nominal data into the “regular signals” file, and all abnormal data into the “abnormal signals” file?
- Or instead, should you keep multiple “regular” and “abnormal” files, and select multiple signal couples via the benchmark window just before starting it?
There are two possibilities:
- When considering different regimes/behaviors on a single machine, or several anomaly types on a single machine, then you should CONCATENATE.
- When considering different machines that all have the same behavior (the data will slightly differ, because the two machine can never be 100% identical), then you should ADD SIGNAL COUPLES.
Note
- For more information and examples, please check Studio: which signals to put in which files.
- In case you are not sure which option to choose, go with option 1: concatenate all regular data in one file, and all abnormal data in another file.
B. Performance issues¶
Click here for a list of tips to try to improve your benchmark performances.
Also bear in mind that additional procedures may be implemented outside of the NanoEdge AI Library (e.g. in the main C code), such as confirmation mechanisms (based on counters, averages, or other), to limit the number of false positives, etc.
Click here for a list of suggestions to try to improve your emulator / library performances.
Also check this section about signal verification / confirmation using the emulator with serial data. Although it is about classification, it may be applied to anomaly detection in the same manner.
During benchmark, our search algorithms test tens of thousands of libraries, in order to find the best possible candidate among millions of possibilities. Please be patient and let the process finish properly.
Benchmarks may be paused / resumed.
You may speed up the benchmark process by:
- increasing the number of CPU cores dedicated to the search (just before clicking “Validate” and starting the benchmark).
- reducing the amount of data provided in both “regular” and “abnormal” signals files (which may severely hurt performances).
Note
At any point during benchmark, even if it is still running, you may jump right to the Emulator step (Step 5 in Anomaly Detection, or Step 4 in Classification) to test the performances of the best Library found up to this point.
After starting a benchmark (Step 4: Optimize and Benchmark), the progress bar goes to 5% and some graphs start appearing. If nothing is happening within a minute (no plot, or axes with no data points) please stop the benchmark, and start a new benchmark.
If the same issue keeps happening, please quit and relaunch the Studio. Then, start a new benchmark.
C. Errors and bugs¶
Sometimes the installer has troubles intalling NanoEdge AI Studio, or at launch, the Studio is stuch on an endless loading screen. This can happen when the connection between the Studio’s API and the internet is being blocked by something.
First, close the Studio / Installer (make sure all tasks have ended via Task manager), and relaunch.
In case the issues persist, here is a list of the most common causes:
- antivirus silently blocking connections (try to deactivate them)
- firewall (e.g. windows defender, or other… try to add an exception for NanoEdge AI Studio, or deactivate them)
- proxy (if using any, check settings or deactivate)
- VPN (if using any, check settings or deactivate)
- wrong DNS settings on your computer
- trying to install the Studio in a virtual machine (which is not allowed, won’t work)
Here are a few other solutions that you may try independently (on Windows), after checking the points above: quit the Studio, and:
- delete the file api_settings in Users\<your_username>\AppData\Roaming\nanoedgeaistudio\ and relunch the Studio.
- edit the file init.json in Users\<your_username>\AppData\Roaming\nanoedgeaistudio\, replace
"port":5000
by another port number that is available on your computer, for example"port":5001
then save and relaunch the Studio.
If you get the following error message:
This may be due to the “Controlled folder access” feature of Windows Defender in Windows 10. It can block Studio access to the folder /Documents which is used to store NanoEdge AI Studio’s workspace.
You need to allow both executables NanoEdge AI Studio.exe
and neai_api_app.exe
to run.
Please check Windows Support: Allow an app to access controlled folders.
NanoEdge AI Studio usually asks for your license key after installing an important update, after updating your license, or after some time has passed. NanoEdge AI Studio shouldn’t continually ask for your license key every time you launch it.
However this might happen for some users due to poor network performances, or when rebooting your computer, or when using an older machine, and so on.
Make sure your antivirus or firewall software are not blocking any incoming or outgoing connexion, and that you are not using third party software that may remove some temporary files created by NanoEdge AI Studio.
If you’re using a proxy, use the following settings:
Here are the IP adresses that need to be whitelisted:
Licensing API: Cartesiam API for library compilation: 54.147.158.222 52.178.13.227 54.147.163.93 54.144.124.187 54.144.46.201 or via URL: https://api.cryptlex.com:443 or via URL: https://api.cartesiam.net
Double check that you entered your license key properly.
- Choose Offline activation and enter your license key.
- Copy the long string of characters that appears.
- Go to the Cryptlex login page (https://cartesiam.cryptlex.app/auth/login).
- Reset your password using the email address provided when downloading NanoEdge AI Studio.
- Log into your Cryptlex dashboard using your new password.
- Click on your license key, then Activations and Offline activation
- Click ACTIVATION, then paste the string of characters copied in step 2, and click Download response.
- In NanoEdge AI Studio, click Import file and open the downloaded .dat file.
It happens when the port used for communication (between the local Cartesiam API, on your machine, and NanoEdge AI Studio) is used by some other program. It is set to 5000 by default. You may change it to any other port that you know is not currently being used.
Double check that:
- you have a sufficient amount of resources on your machine for NanoEdge AI Studio to run properly (RAM, CPU cores).
- the background scanning process of your antivirus or firewall is not interfering with the Studio.
- you’re not trying to quit and relaunch the Studio too quickly.
- you’re not running multiple instances of the studio.
After clicking somewhere, if nothing happens, and the window stays blank for more than one minute, please consider closing and restarting the Studio.
When starting a benchmark, progress graphs and plots should appear within one or two minute. If nothing happens, and the lower half of your screen appears blank, please quit and relaunch the Studio. Then, start a new benchmark.
Install the following package by entering:
sudo apt-get install libgconf-2-4
Add yourself to the “dialout” group:
sudo usermod -a -G dialout $USER
Create a rule file to automatically enable permissions when a device is connected:
sudo nano /etc/udev/rules.d/50-local.rules
Paste this line in the file you just created (where
/dev/ttyACM0
targets your USB port).ACTION=="add", ATTRS{idProduct}=="0042", ATTRS{idVendor}=="2341", DRIVERS=="usb", RUN+="chmod a+rw /dev/ttyACM0"
Press Control-O and then Control-X to save the file and exit.
Note
You may need to log out and log back in (or reboot your computer) for the changes to take effect.
II. NanoEdge AI Library / Emulator¶
If, in the Studio, the benchmark results were good, and the selected Library was properly tested and validated using the Emulator, then the embedded Library will give similar performances if used in the same conditions, with data that is coherent with those used for Library selection.
Please check the following section: Emulator: possible causes for poor results.
The library yielded by NanoEdge AI Studio will be the result of the data taken as input. Depending on your use case, it can be either:
- very specialized, extremely specific to one specific application or machine;
- or very versatile, adaptable to a wide range of different machines (of the same type).
To get a very specific library, your imported data (Studio: Steps 2 and 3) must be focused and have low variance. It should contain many examples of the same signals, which must be as repeatable as possible.
To get a general and adaptable library, your imported data must contain a wide range of signals, that represent different behaviors, possibly on logged using several kinds machines (e.g. industrial vibrating machines used for different tasks).
Please also check: Which signals to put in which files.
The minimum iterations is a recommended number that appears at the end of a benchmark. It is a minimum number of iterations that summarizes how fast the Library can learn once embedded.
It corresponds to the minimum number of times the NanoEdgeAI_learn
function has to be called in order for the knowledge acquired by the Library’s model to be rich enough.
Warning
If your use case has several regimes, or modes of nominal behavior, these should all be included within the learning iterations.
For instance, when monitoring vibration patterns on a 3-speed fan, the Studio recommends a minimum of 90 iterations. It means that you must provide at least 90 examples of signals in total, including all 3 speeds (e.g. 30 iterations, or lines, per speed at the very minimum). Of course you could also provide more, e.g. 200 examples per speed (totaling 600 iterations).
Note
This number is a strict minimum. Realistically, don’t hesitate to use more, e.g. 10x this number, if needed.
The NanoEdgeAI_set_sensitivity
function changes the sensitivity of the model dynamically at any time, without having to go through a new learning phase. This sensitivity has no influence on the knowledge acquired during the learning steps; it only plays a role in the detection step.
It acts as a linear scaler of the pre-set internal sensitivity (optimized during benchmark in the Studio). It influences the similarity percentages that are returned by the NanoEdgeAI_detect
function.
Note
- The default sensitivity value is
1
. A sensitivity value between0
and1
(excluded) decreases the sensitivity of the model, while a value in between1
and100
increases it. We recommend increasing or decreasing sensitivity by steps of 0.1. - Sensitivity
1.1 - 100
will tend to decrease the percentages of similarity returned, while sensitivity0 - 0.9
will decrease them.
Yes. If the data contained in the “regular signals” file imported in NanoEdge AI Studio correspond to different regimes, then the Library will be able to detect those different regimes and consider them as “nominal”. This selected Library will include a machine learning model that has the ability to adapt to those differences in machine behavior.
It is also important, before embedding the Library, to properly design learning cycles, so that all the different regimes to be considered as “nominal” are learned. You may run a learning phase for each of those different regimes, or a single learning phase that includes all of them.
The similarity score is a measure of how mathematically similar a given sample is, compared to the existing knowledge base of the Library.
If a sample “looks” like something seen before, it will have a similarity score near 100 (%), and if it completely new (looks dramatically different), the score will be close to 0.
When building a smart device, the final features will heavily depend on the way those functions are called. It is entirely up to the developer to design relevant learning and detection strategies, depending on the project’s specificities and constraints.
For example for a hypothetical machine, one strategy could be to:
- initialize the model;
- establish an initial knowledge base by calling learn() every minute for 24 hours on that machine;
- switching to inference mode by calling detect() 10 times every hour (and averaging the returned scores), each day;
- blink a LED and ring alarms whenever detect() returns any anomaly (average score < 90%);
- run another learning cycle to enrich the existing knowledge, if temperature rises above 60°C (and the machine is still OK)
- send a daily report (average number of anomalies per hour, with date, time, machine ID…) using Bluetooth or LoRa.
Yes. For more information, see Library: creating backups.
Note
This feature is mainly used to prevent loss of knowledge, e.g. in case of power failure.
Warning
While it is possible to transfer the knowledge acquired on one device, to another device, we strongly discourage it. Indeed, it defeats the purpose of acquiring knowledge in-situ.
The knowledge acquired on one device isn’t necessarily transferable to another device. For example, even a very subtle misplacement of an accelerometer could be enough to kill the Library’s performances, during vibrational analysis, if no additional learning was done in-situ.
If you really intend to transfer some knowledge, then run at least a few learning cycles in-situ on the new device, to enrich the knowledge and adapt it to the new environment.
The classifier function returns a class ID, and the percentage of probability associated to this class. It corresponds to the degree of certainty that the correct class has actually been detected.
The classifier therefore calculates a probability for each of the possible classes (which all add up to 1, or 100%), and only returns the class with the highest probability. See the Classification Library documentation for more details.
Resources¶
Anomaly Detection:
Classification:
Useful links:
- Cartesiam's Website
- Download NanoEdge AI Studio
- For technical issues, please check ST Support.
- For general enquiries, please contact Edge AI Services.