NanoEdge AI Emulator (Cl)

Documentation for Classification (Cl)

NanoEdge AI Studio, Library and Emulator: use the Studio to find the best Library.
Before embedding, test your Library’s performances locally using its clone, the Emulator.

I. What is NanoEdge AI Library for classification?

NanoEdge AI Library is an artificial intelligence static library developed by Cartesiam, for embedded C software running on ARM Cortex microcontroller.

When embedded on microcontrollers, it gives them the ability to easily “classify” 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 classification is the code that contains an AI model (for example, as a bundle of signal treatment, machine learning model, optimally tuned hyperparameters, etc.) designed to identify a sensor pattern in a class. All classes are defined by the user in the Studio and are used during the training process of the AI model.

II. Purpose of NanoEdge AI Emulator

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 identify the class of your input signal as you would do in your embedded application.

III. NanoEdge AI Emulator functions

1. Get informations (library id and name of classes)

The version of the Emulator and the name of classes can be accessed at any time using NanoEdgeAI_get_info.
The returned version number is the ID of the associated NanoEdge AI static library.


./NanoEdgeAI_Class_Emulator NanoEdgeAI_get_info             (Linux)
NanoEdgeAI_Class_Emulator.exe NanoEdgeAI_get_info           (Windows)


   "lib_id": "5d5fd41ec8e0327c934",
   "class_name": ["unknown", "low", "medium", "high", "stop"]

2. Classification (Inference)

There are two options to run the classification process: using an input file, or a sequence of values.

i. Classification by file


  • By default all signals in input files are used:
./NanoEdgeAI_Class_Emulator NanoEdgeAI_classifier --knowledge_path knowledge.dat --file class_file.csv         (Linux)
NanoEdgeAI_Class_Emulator.exe NanoEdgeAI_classifier --knowledge_path knowledge.dat --file class_file.csv       (Windows)
  • But you can restrict the number of signals used (e.g. here 10-14):
./NanoEdgeAI_Class_Emulator NanoEdgeAI_classifier --knowledge_path knowledge.dat --file class_file.csv --begin 10 --end 14     (Linux)
NanoEdgeAI_Class_Emulator.exe NanoEdgeAI_classifier --knowledge_path knowledge.dat --file class_file.csv --begin 10 --end 14   (Windows)


--knowledge_path:    path to the binary file containing the knowledge
--file:              path to the file containing data to class
--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)


   "status": "classification",
   "lib_id": "5d5fd41ec8e0327c934",
   "input": "../datasets/fan_testing_emulator.csv",
   "results": [
      {"signal": 1, "line": 10, "class_status": 1, "class_name": "low", "class_proba": [1.0000, 0.0000, 0.0000, 0.0000]},
      {"signal": 2, "line": 11, "class_status": 1, "class_name": "low", "class_proba": [0.9857, 0.0000, 0.0000, 0.0000]},
      {"signal": 3, "line": 12, "class_status": 2, "class_name": "medium", "class_proba": [0.0000, 1.0000, 0.0000, 0.0000]},
      {"signal": 4, "line": 13, "class_status": 3, "class_name": "high", "class_proba": [0.0000, 0.0000, 0.9987, 0.0000]},
      {"signal": 5, "line": 14, "class_status": 3, "class_name": "high", "class_proba": [0.0000, 0.0000, 1.0000, 0.0000]}
   "classification_summary": {"signals": 5, "classified": [2, 1, 2, 0], "unclassified": 0}

If an argument is missing, the following error message will be returned:

Error: missing or not valid argument in NanoEdge AI classification function call by file !
Valid NanoEdge AI classification function calls by file are:
   NanoEdgeAI_classifier --knowledge_path path/knowledgefile --file path/testfile --begin line --end line
   NanoEdgeAI_classifier --knowledge_path path/knowledgefile --file path/testfile
Refer to NanoEdge AI Classifier Emulator documentation for more details:


Your input file must have valid separators (, or ; or : or a single space or a single tab). If it is not the case, please modify your input file. You can easily do so by importing your file in NanoEdge AI Studio, selecting the separator you’re currently using, and then re-downloading it by clicking download.

Also make sure to use periods (.) for decimal values, and NOT commas (,).

ii. Classification by a sequence of values


./NanoEdgeAI_Class_Emulator NanoEdgeAI_classifier --knowledge_path knowledge.dat --array value1 value2 ... valueN       (Linux)
NanoEdgeAI_Class_Emulator.exe NanoEdgeAI_classifier --knowledge_path knowledge.dat --array value1 value2 ... valueN     (Windows)


--array value1 value2 ... valueN       buffer composed of N numerical values, from *value1* to *valueN*


   "status": "classification",
   "input": "array",
   "results": [
      {"signal": 1, "line": "null", "class_status": 1, "class_name": "low", "class_proba": [1.0000, 0.0000, 0.0000, 0.0000]}
   "classification_summary": {"signals": 1, "classified": [1, 0, 0, 0], "unclassified": 0}

iii. Remarks

  • The two classification 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 Step 6: “Deploy” of NanoEdge AI Studio.
  • The header results shows the result of the classification process for each signal:
    • class_status is the identifier of the identified class;
    • class_name is the name of the identified class;
    • class_proba is an array with the probabilities of each class.
  • The header classification_summary shows a summary of the last classification call.


All NanoEdge AI Studio documentation is available here.
Step-by-step tutorials, to use NanoEdge AI Studio to build a smart device from A to Z:

Useful links: