Using the ML Plugin with SensiML

 Objective

This guide covers usage of the ML Plugin with our design partner, SensiML. From the ML Plugin, it is possible to save data to a CSV file that is formatted for import in the SensiML's Data Capture Lab (DCL). The DCL is the entry point for a new SensiML project, and it is where project data is labeled in preparation for model development.

dv-sensiml.png

 Materials

Software Tools

The ML Plugin and MPLAB® Data Visualizer can both be installed as plugins to MPLAB® X via the plugins manager or the ML Plugin can be installed as a plugin to MPLAB® Data Visualizer Standalone.

 Procedure

This section contains instructions for using the ML plugin with SensiML. It will cover the process of saving data captured with Data Visualizer to a CSV file for use with SensiML. To learn more about how to use the SensiML Analytics Toolkit to create machine learning solutions, check out our example application "Gesture Recognition with SensiML".

This guide picks up where "The ML Plugin User's Guide" left off. The following instructions require that data is already marked within MPLAB® Data Visualizer as described in the user's guide.

Saving Data for Import into the Data Capture Lab

1

Saving to CSV

Logging data to a CSV file is the primary flow from the ML Plugin to the SensiML Analytics Toolkit. To do this, press Save to CSV, and then complete the Save Data Snapshot dialog by selecting the desired data sources and then saving. After importing the data into the Data Capture Lab, there is full-featured support for labeling, segmenting, and otherwise preparing data for use in model development.

no-dcli.png
Figure 1: Save data to a CSV file

The file format in the Save Data Snapshot dialog is preset to SensiML CSV when saving in this manner, so there is no need to adjust any settings in this menu.

snapshot.png
Figure 2: Save Data Snapshot with the SensiML CSV preset selected

Once the data is saved to a CSV you are ready to import the data into SensiML's Data Capture Lab. The next section covers the optional step of generating a DCLI file, which allows for pre-labeling of data before importing it to the Data Capture Lab.

2

Generating a DCLI File

The ML Plugin also supports the generation of a DCLI file, which is used to label segment data before import into the Data Capture Lab. This is useful when all of the data marked in the time window is of a single event type. When generating the DCLI file, it will be saved with the same name as the CSV file, and it will be saved in the same location. Then the data can be imported to the Data Capture Lab via the DCLI file.

In the cases where all the selected data is of a single event type, the DCLI file can be used to label the data as well as segment it, if that is desired. There is an option to use window segmentation to regularize the size of the data that will be used during model training. The window size should be determined by the signal type as well as the length and nature of the event that is to be detected. If discrete events need to be segmented from the selected data, then this must be done in the Data Capture Lab, so it is advised to disable the window segmentation option if manual segmentation is required.

dcli-1000.png
Figure 3: Generate DCLI without window segmentation

The Data Capture Lab supports labeling sessions to simplify the process of iterating on different labeling strategies. By default, this value is set to "MPLAB DV Session" to indicate the source, but feel free to modify this as you see fit.

Figure 3 shows the SensiML menu when a 10 s window is selected within the ML Plugin. Since the sensor sampling rate is set at 100 Hz, there are 1000 samples marked within Data Visualizer. With the setting configured as shown, the DCLI file will denote a single segment that spans from index 0 to index 999 of the selected data. Notice that the window offset slider is disabled. This is because the window size is set to the maximum value - meaning that the segmentation window is the same size as the marked window in Data Visualizer, so there is not enough data to implement a sliding window.

When the window size is reduced to at least half of the max value, multiple segments will be sliced from the selected data. The next figure shows an example of slicing 3 s segments from the marked data with no overlap since window offset equals window size. This will produce the following three segments: [0,299], [300,599], [600,899].

dcli-300-300.png
Figure 4: Generate DCLI with 3 s window segmentation - no overlap

It is also possible to configure overlap between consecutive windows. The next figure shows an example of slicing 3 s segments with 1.5 s overlap between consecutive windows. This will produce the following five segments: [0,299], [150,449], [300,599], [450, 749], [600,899].

dcli-300-150.png
Figure 5: Generate DCLI with 3 s window segmentation - 500px overlap

Overlapping windows can be helpful in increasing the size of the training dataset by slicing a greater number of unique segments from the selected data. The window overlap should be considered with respect to the data and the target application.

Window segmentation can also be done later on in the development process within SensiML's Analytics Studio. During the AutoML-based model selection step, the windowing segmenter can be selected and window size can be specified.

Importing Data into the SensiML Data Capture Lab

Once you've generated your CSV or DCLI file, visit the Importing External Sensor Data guide in the SensiML documentation to learn how to import your data into Data Capture Lab. You may also want to check out the "Gesture Recognition with SensiML" guide for an example of importing a DCLI file.

 Results

After saving your data and importing it into the Data Capture Lab, it can be used to build an ML pipeline in either the Analytics Studio or the Python Client. The final Knowledge Pack can be deployed directly within the embedded application as demonstrated in the SensiML Gestures Demo Application.

© 2021 Microchip Technology, Inc.
Notice: ARM and Cortex are the registered trademarks of ARM Limited in the EU and other countries.
Information contained on this site regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer's risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.