Importing Pre-Labeled Data with the DCLI Format

You can import pre-labeled sensor data from outside sources into the SensiML Toolkit. It is a very useful tool if you have created your own protocols/applications for collecting/labeling sensor data and wish to integrate your labeled data into the SensiML Toolkit.

Note

This tutorial will be showing how to define your labels. To find out more about the raw sensor data files that SensiML supports see the in the Importing External Sensor Data tutorial

You can write a script or application to convert your data into this format. This allows you to continue using your previous methods for collecting/labeling data while getting the benefits that the SensiML Toolkit provides.

Note

This guide assumes you are familiar with a few key terms from the Getting Started Guide. We will be referring to Metadata, Sessions, and Segments from this guide. If you are not familiar with these terms, please read the guide above before getting started.

How to Import Metadata/Segments

The Data Capture Lab allows you to import metadata and segments via .dcli files. We will define the DCLI file format in the next section. For now, just note that in order to import your metadata and segments you can find the import feature inside the menu item File → Import from DCLI…

../_images/import-from-dcli.png

DCLI File Format

The Data Capture Lab allows you to import metadata and segments via .dcli files.

  1. Download a full working example here: Import Example. We suggest you download and try this example out before building your own .dcli files.

The DCLI format is a JSON based format with JSON properties that the DCL will look for when importing your metadata/segments. Let’s take a look at a snippet taken from the example code:

[
    {
        "file_name": "Example_01.csv",
        "metadata": [
            {
                "name": "Subject",
                "value": "User001"
            },
            {
                "name": "Size",
                "value": "Medium"
            }
        ],
        "sessions": [
            {
                "session_name": "Session 1",
                "segments": [
                    {
                        "name": "Label",
                        "value": "Kick",
                        "start": 188,
                        "end": 1500
                    },
                    {
                        "name": "Label",
                        "value": "Pass",
                        "start": 2500,
                        "end": 3000
                    }
                ]
            },
            {
                "session_name": "Session 2",
                "segments": [
                    {
                        "name": "Label",
                        "value": "Dribble",
                        "start": 101,
                        "end": 200
                    },
                    {
                        "name": "Label",
                        "value": "Kick",
                        "start": 400,
                        "end": 600
                    }
                ]
            }
        ]
    }
]

JSON Object Definitions

The DCLI file is a list of file objects with various properties for importing metadata/segments. Listed below is a description of each property and how to use it. It is helpful to download the full example above to see how these definitions relate to a real example.

File Object

Each file object has three properties; file_name, metadata, and sessions.

file_name - (string) If you are importing new files to your project the DCL will search for your file in the same directory that the .dcli file is located. If you are importing metadata/segments to existing files in your project then this will be what the DCL uses to lookup the file in your project.

metadata - (list<object>) Metadata associated with the file object. Each metadata object has two properties name and value defined below.

sessions - (list<object>) Sessions associated with the file object. Each session object has two properties session_name and segments defined below.

Metadata Object

Metadata objects have two properties name and value.

name - (string) Name is the general metadata property group. For example: Subject or Size

value - (string) Value is what will be assigned to the associated file object

Session Object

Session objects have two properties session_name and segments.

session_name - (string) Name of the session you want to associate with your segment objects

segments - (list<object>) Segments associated with the session object. Each segment object has four properties name, value, start, end defined below

Segment Objects

Segment objects have four properties name, value, start, end. As a reminder, a segment defines a specific location within your file where an event is taking place.

name - (string) This is the group name for your segment labels. You can have multiple group names, but for the most part you will always want to use a generic name to group your segment labels together. For example if I was building a Soccer application, I would always set “name”: “Label” and use the value object for your different events (Dribble, Kick, Pass)

value - (string) The name of the event that the segment is defining. For example: Dribble, Kick, Pass

start - (integer) This is the start index location of where you segment will be located within the file object

end - (integer) This is the end index location of where you segment will be located within the file object