1. What is NanoEdge AI Library for 1-class classification (outlier detection)?
NanoEdge™ AI Library is an Artificial Intelligence (AI) static library originally developed by Cartesiam, for embedded C software running on Arm® Cortex® microcontrollers.
When embedded on microcontrollers, it gives them the ability to easily "identify" outliers from sensor patterns, by themselves, without the need for the user to have additional skills in Mathematics, Machine Learning, or data science.
The NanoEdge AI static library for 1-class classification is the code that contains an AI model (for example, as a bundle of signal treatment, Machine Learning model, and optimally tuned hyperparameters) designed to identify if a sensor pattern is inside the class or outside the class (outlier/anomaly). The class under consideration is defined by the user in NanoEdge AI Studio (NanoEdgeAIStudio), also called the Studio, and are used during the training process of the AI model.
2. Purpose of NanoEdge AI Emulator for 1-class classification
With NanoEdge AI Emulator, you can emulate the behavior of your NanoEdge AI Library (from the command line, or the interface provided through NanoEdge AI Studio), and start testing it as if it was running on your embedded application.
The emulator comes with each library created by the Studio. It has been compiled using the same algorithm. This means that for one library, there is one emulator. Using this tool, you can determine whether or not a signal belongs to your class, as you would do in your embedded application.
3. NanoEdge AI Emulator functions
3.1. One-class detection (inference)
There are two options to run the 1-class classification process: using an input file, or a sequence of values.
3.1.1. One-class detection by file
Usage:
- By default all signals in input files are used:
./NanoEdgeAI_Oneclass_Emulator neai_oneclass --knowledge_path knowledge.dat --file oneclass_file.csv (Linux®) NanoEdgeAI_Onelass_Emulator.exe neai_oneclass --knowledge_path knowledge.dat --file oneclass_file.csv (Windows®)
- But you can restrict the number of signals used (for instance, here, 10-14):
./NanoEdgeAI_Oneclass_Emulator neai_oneclass --knowledge_path knowledge.dat --file oneclass_file.csv --begin 10 --end 14 (Linux®) NanoEdgeAI_Onelass_Emulator.exe neai_oneclass --knowledge_path knowledge.dat --file oneclass_file.csv --begin 10 --end 14 (Windows®)
Arguments:
--knowledge_path: path to the binary file containing the knowledge --file: path to the file containing data to classify --begin: number of the first data line in file (>= 1) (or of the first line to use) --end: number of the last data line in file (<= number of last line) (or of the last line to use)
Response:
{ "status": "oneclass_detection", "lib_id": "5d5fd41ec8e0327c934", "input": "oneclass_file.csv", "results": [ {"signal": 1, "line": 10, "id_status": 0, "status": "regular"}, {"signal": 2, "line": 11, "id_status": 0, "status": "regular"}, {"signal": 3, "line": 12, "id_status": 1, "status": "outlier"}, {"signal": 4, "line": 13, "id_status": 0, "status": "regular"}, {"signal": 5, "line": 14, "id_status": 0, "status": "regular"} ], "detection_summary": {"signals": 5, "regular": 4, "outlier": 1} }
Error: missing or not valid argument in NanoEdge AI oneclass function call ! Valid NanoEdge AI oneclass function calls by file are: neai_oneclass --knowledge_path path/knowledgefile --file path/testfile --begin line --end line neai_oneclass --knowledge_path path/knowledgefile --file path/testfile neai_oneclass --knowledge_path path/knowledgefile --array value1 value2 ... valueN (where value1 to valueN are the values of the input buffer) Refer to NanoEdge AI Oneclass Emulator documentation for more details. </syntaxhighlight >
3.1.2. One-class detection by a sequence of values
Usage:
./NanoEdgeAI_Oneclass_Emulator neai_oneclass --knowledge_path knowledge.dat --array value1 value2 ... valueN (Linux®) NanoEdgeAI_Oneclass_Emulator.exe neai_oneclass --knowledge_path knowledge.dat --array value1 value2 ... valueN (Windows®)
Arguments:
--array value1 value2 ... valueN buffer composed of N numerical values, from *value1* to *valueN*
Response:
{ "status": "oneclass_detection", "lib_id": "5d5fd41ec8e0327c934", "input": "oneclass_file.csv", "results": [ {"signal": 1, "line": "null", "id_status": 0, "status": "regular"} ], "detection_summary": {"signals": 1, "regular": 1, "outlier": 0} }
3.1.3. Remarks
- The two 1-class detection modes (by file and by sequence of values) can be combined.
- The binary file knowledge.dat is provided in the .zip file that you download by clicking Compile in NanoEdge AI Studio (on the "Deploy" screen which follows the "Optimize and Benchmark" and "Emulator" screens).
- The header shows the result of the classification process for each signal:
- id_status is the identifier status: 0 means inside the class, 1 means outside the class (outlier)
- status is the result: "regular" (inside the class), "outlier" (outside the class)
- The header detection_summary' shows a summary of the last detection call.
4. Resources
Documentation
All NanoEdge AI Studio documentation is available here.
Tutorials
Step-by-step tutorials, to use NanoEdge AI Studio to build a smart device from A to Z.