SDS YAML Files

SDS uses YAML files to describe binary stream data, attach labels and annotations, and configure interfaces, playback, and viewer settings. The JSON Schema files in the schema directory provide machine-readable definitions of these formats.

The files associated with SDS data streams have distinct roles:

File Purpose
<stream-name>.<label>.sds Binary data stream recorded for one stream.
<stream-name>.<label>.p.sds Binary data stream recorded during playback.
<stream-name>.sds.yml Metadata describing the binary data structure of a stream.
[<stream-name>.]<label>.sds-tag.yml Labels and annotations for one stream or multiple sensor-fusion streams.
*.sdsio.yml SDSIO configuration file for interfaces, streams, playback, and viewer settings.

Viewer interactions may update viewer settings in the SDSIO configuration file. They do not modify *.sds.yml, because stream metadata describes the binary data structure.

SDS Metadata Format

The content of each data stream may be described in an SDS metadata file in YAML format that is created by the user. Data conversion utilities and data viewers use this metadata to interpret the binary stream content. For example, a data stream named sensorX (stored in files sensorX.0.sds, sensorX.1.sds, ...) can be described with a corresponding metadata file sensorX.sds.yml as shown below.

SDS Metadata Format

The following section defines the YAML format of this metadata file. The file schema/sds.schema.json is a schema description of the SDS metadata format.

sds: Description
    name: Required Name of the Synchronous Data Stream
    description: Optional Additional descriptive text
    block-frequency: Optional Frequency in Hz (interval) of data blocks within a data stream (see note)
    sample-frequency: Optional Frequency in Hz (sample rate) of samples within a data block (see note)
    tick-frequency: Optional Tick frequency in Hz of the timeslot value; default: 1000 Hz
    classes: Optional Non-empty list of named class definitions
    header: Optional Non-empty list of values stored once at the beginning of each value-list data block
    content: Required List of stream-content entries (see below)

Note

  • block-frequency: is optional as it can be derived from the timeslot value in combination with tick-frequency:.
  • sample-frequency: is required when a data block contains a temporal sequence sampled at a fixed rate. Omit it when all records share the block timeslot.
  • SDS v3.0 used frequency: to indicate a sample rate. In SDS v3.1 this is renamed to sample-frequency: to clarify the information.

The picture below shows how sample-frequency: and block-frequency: are applied. When data streams from different sources are combined, data blocks may vary in size.

Data Block Size and Sample Frequency

The optional header: list describes values stored once at the beginning of a value-list data block. The content: list describes the binary layout following this optional header. Depending on the stream type, content: uses these nodes:

  • value: list entries to describe discrete values, such as sensor channels or algorithm outputs. A data block can contain multiple samples, so the content size after any header is a multiple of the sample size. Without a header:, a block size of 0 indicates that no sample is available in that timeslot.
  • audio: entry to describe audio channel parameters.
  • image: entry to describe a camera stream with frame layout parameters.

Supported data types

The type: node used by header: and value-list content: entries supports the following C data types. All multi-byte values use little-endian byte order.

Type Size Description
int8_t 1 byte Signed 8-bit integer
uint8_t 1 byte Unsigned 8-bit integer
int16_t 2 bytes Signed 16-bit integer
uint16_t 2 bytes Unsigned 16-bit integer
int32_t 4 bytes Signed 32-bit integer
uint32_t 4 bytes Unsigned 32-bit integer
float 4 bytes IEEE 754 single-precision floating-point value
double 8 bytes IEEE 754 double-precision floating-point value

Other C data types, implementation-defined types such as int, and bit-field notation such as uint32_t:1 are not supported. Boolean values must be stored using one of the supported integer types with an application-defined representation.

Class definitions

The optional classes: list defines mappings from stored integer indices to human-readable labels:

classes: Description
- class: Required Global class name
    selection: Optional Class selection behavior: one-of (default) or multiple
    values: Required Non-empty mapping of integer indices to string labels

Each index in values: must be unique within the class. Labels need not be unique because several stored indices may have the same meaning. Negative and sparse indices are permitted.

For selection: one-of, at most one class label can be active at a time. In a data tag file, a new tag of the same class replaces the previous tag at the new tag's timeslot. For selection: multiple, several labels can be active concurrently.

The optional class: property on a header: or value-list content: entry references one of these class definitions. It is valid only with an integer data type. The raw integer remains the stored value; the class supplies its display label.

sds:
  name: ModelOut
  classes:
    - class: keyword
      values:
        -1: UNKNOWN
        0: a
        1: b
        26: zero
  content:
    - value: predicted_class
      type: int32_t
      class: keyword
    - value: confidence
      type: float

Data block header

The optional header: list describes a fixed-size user data header at the beginning of every value-list data block. This header is part of the data block and is distinct from the standard 8-byte SDS record header that contains the timeslot and block size.

Structured ML output may contain a variable number of results for one inference. For example, a person- or object-detection algorithm produces one set of values for every detected object, while information such as the number of detections applies to the complete inference result. The fixed-size header: stores this block-level information, and the repeated content: records describe the individual results. The CMSIS-Executorch Traffic Counter is an example of this type of output.

The header: node can be applied only when content: contains value: entries. It cannot be combined with audio: or image: content.

Each value in header: occurs exactly once per data block and uses the same value properties as a content: value:

header: Description
- value: Required Name of the header value
    type: Required Data type of the header value
    class: Optional Global class name for an integer value
    dim-x: Optional Array size x; default: 1
    dim-y: Optional Array size y; default: 1
    offset: Optional Offset of the header value; default: 0
    scale: Optional Scale factor of the header value; default: 1.0
    unit: Optional Physical unit of the header value

The binary layout of a data block is:

[fixed-size header values][content data]

The block size stored in the SDS record includes both parts. When header: is omitted, the data block starts directly with the content data, preserving compatibility with existing SDS metadata and data files.

Data blocks, records, and values

An SDS stream contains data blocks. One data block represents one application operation, typically one DSP processing step or ML inference. A data block contains zero or more records, and each record contains the values listed under content: in the specified order. For temporal data, these records are also called samples.

For a value: list, the data block repeats the described content record layout after the optional header. The number of content records is calculated as:

content record count = (block size - header size) / content record size

When header: is omitted, its size is zero. The remaining content size must be an exact multiple of the content record size. A data block with a header and zero content records has a block size equal to the header size.

The meaning of multiple records depends on the stream:

  • Temporal sequence: Records were acquired consecutively. sample-frequency: specifies their rate and therefore the time interval between them. For example, one motion-inference block may contain 125 consecutive accelerometer samples.
  • Result collection: Records were produced by the same operation and share the block timeslot. sample-frequency: is omitted because the records are not a temporal sequence. For example, one object-detection block may contain a variable number of detected objects.

The timeslot identifies the complete data block or application operation. It does not provide an individual acquisition time for every record. When exact per-record times are required, include a timestamp as another value in each record.

Value-list data stream

Typically describes the sample layout of a sensor data stream or the output of ML algorithms. A data block may contain several samples as shown in the picture above. The sample-frequency: should be specified when the data stream uses a discrete sample rate.

With dim-x: and dim-y: arrays can be composed. The equivalent representation in C is "type name[dim-y][dim-x]".

content: Description
- value: Required Name of the value
    type: Required Data type of the value
    class: Optional Global class name for an integer value
    dim-x: Optional Array size x; default: 1
    dim-y: Optional Array size y; default: 1
    offset: Optional Offset of the value; default: 0
    scale: Optional Scale factor of the value; default: 1.0
    unit: Optional Physical unit of the value

The following examples show metadata files for several value-list data streams.

Example: Gyroscope data

The following sensorX.sds.yml describes the binary layout of the sensorX data stream:

sds:                   # describes a synchronous data stream
  name: sensorX        # user defined name
  description: Gyroscope stream with 1KHz sample rate, plus additional user data
  sample-frequency: 1000
  content:
    - value: x         # Value name is 'x'
      type:  uint16_t  # stored using a 16-bit unsigned int
      scale: 0.2       # value is scaled by 0.2
      unit: dps        # base unit of the value
    - value: y
      type: uint16_t
      scale: 0.2
      unit: dps
    - value: z
      type: uint16_t
      unit: dps        # scale 1.0 is default
    - value: temp
      type: float
      unit: degree Celsius
    - value: raw
      type: uint16_t   # raw data, no scale or unit given
    - value: flag
      type: uint32_t   # application-defined flag bits

Example: Time-of-Flight data

The following ToF.sds.yml metadata describes data from a Time-of-Flight sensor:

sds:                   # describes a synchronous data stream
  name: ToF            # user defined name
  description: Time-of-Flight sensor with 8x8 matrix
  content:
    - value: distance  # Value name is 'distance'
      type:  uint16_t  # stored using a 16-bit unsigned int
      dim-x: 8
      dim-y: 8

Example: Motion-inference input

The following Motion.sds.yml metadata describes motion samples used together as the input to one inference:

sds:
  name: motion
  description: Motion samples used for one inference
  sample-frequency: 1000
  content:
    - value: x
      type: float
    - value: y
      type: float
    - value: z
      type: float

One record contains the three values x, y, and z and has a size of 12 bytes. A data block containing 125 records has a block size of 1500 bytes. The records form a temporal sequence sampled at 1 kHz, while the complete block is processed by one inference and has one timeslot.

Example: Object-detection output

The following Object.sds.yml metadata describes a variable-size collection of objects produced by one inference. The header stores the number of detected objects once, followed by one content record for each object:

sds:
  name: detections
  description: 0 - n objects detected in one inference
  classes:
    - class: object
      selection: multiple
      values:
        0: person
        1: bicycle
        2: car
  header:
    - value: count
      type: uint32_t
  content:
    - value: class_id
      type: uint32_t
      class: object
    - value: confidence
      type: float
    - value: x
      type: uint32_t
    - value: y
      type: uint32_t
    - value: width
      type: uint32_t
    - value: height
      type: uint32_t

The header has a size of 4 bytes and one detection record has a size of 24 bytes. For example, a block size of 244 bytes contains the 4-byte header and 10 object detections. The number of detections may vary between blocks and is calculated as (block size - 4) / 24. The header count value is expected to match this calculated record count. sample-frequency: is omitted because all detections are results of the same inference and share the block timeslot.

A data viewer can present these repeated records as a table and correlate the detection result with its source image by using the common timeslot.

Note

  • A variable-size segmentation mask cannot be described as an ordinary fixed-size detection record because its encoded size and pixel mapping depend on the model and mask representation. It may be stored in a separate image or mask stream and correlated with the source image, detection records, and optional bounding boxes by using the same timeslot. A standard SDS representation for associating an individual variable-size mask with a detection record is not currently defined.

Audio data stream

Describes audio data format, typically used for a microphone data stream.

content: Description
- audio: Required Audio format specification
    bit-depth: Required Bits per audio sample
    channels: Required Number of interleaved audio channels
    format: Optional Audio format used; default: pcm; currently only pcm is supported

Example:

sds:
  name: Mono
  description: Mono 16-bit PCM microphone
  sample-frequency: 16000
  content:
    - audio:
        bit-depth: 16
        channels: 1
        format: pcm

Image data stream

Describes the image data format, typically used for a camera data stream.

content: Description
- image: Required Image (camera data) format specification
    pixel_format: Required Pixel format identifier
    width: Required Number of pixels per row (integer >= 1)
    height: Required Number of rows (integer >= 1)
    stride_bytes: Optional Bytes per row for single-plane formats (see note)
    planes: Optional Per-plane stride for multi-plane formats (2..3 entries, see note)
planes: Per-plane metadata list
- stride_bytes: Required Bytes per row for this plane (integer >= 1)

Note

  • For image:, exactly one of stride_bytes: or planes: must be provided.

Template files for various image data formats are located in schema/image_format. These templates are listed below and use Linux V4L2 references.

pixel_format: Template file V4L2 reference page
RAW8 RAW8.sds.yml Luma-Only formats (GREY family)
RAW10 RAW10.sds.yml 10-bit Bayer (expanded to 16-bit)
RGB565 RGB565.sds.yml RGB formats
RGB888 RGB888.sds.yml RGB formats (RGB24)
NV12 NV12.sds.yml Planar YUV formats
NV21 NV21.sds.yml Planar YUV formats
I420 I420.sds.yml Planar YUV formats (YUV420 / YU12 family)
NV16 NV16.sds.yml Planar YUV formats
NV61 NV61.sds.yml Planar YUV formats
YUYV YUYV.sds.yml Packed YUV formats
UYVY UYVY.sds.yml Packed YUV formats
YUV422P YUV422P.sds.yml Planar YUV formats
YUV444 YUV444.sds.yml Packed YUV formats (packed 4:4:4)
YUV444P YUV444P.sds.yml Planar YUV formats (YUV444M family)

Note

Example:

sds:
  name: Video Stream - RGB888
  description: RGB888 video frames from camera
  sample-frequency: 24
  content:
    - image:
        pixel_format: RGB888
        width: 1280
        height: 720
        stride_bytes: 3840   # 3 bytes per pixel

SDS Data Tag Files

An SDS data tag file assigns labels to data blocks in one or more SDS data streams. Tags support data labeling workflows and can describe ground truth, classification results, activities, data quality, or other annotations. Applications include keyword spotting, activity recognition, and image classification.

Data tag files use YAML and the following filename format:

[<stream-name>.]<label>.sds-tag.yml

The optional <stream-name> determines the scope of the tags:

  • <stream-name>.<label>.sds-tag.yml contains tags derived from and applied to the specified stream. Including the stream name identifies the stream from which the annotation originates.
  • <label>.sds-tag.yml contains sensor-fusion tags applied to multiple streams with the same <label>. Omitting the stream name indicates that the annotation describes the combined recording rather than one specific stream.

The filename determines the stream and recording scope; these values are not repeated in the YAML content. A data tag file applies to matching recorded <stream-name>.<label>.sds files and playback-generated <stream-name>.<label>.p.sds files. Streams sharing a sensor-fusion tag file must use the same timeslot domain and tick-frequency.

Data Tag Format

The sds-tag: root node contains an optional description and a required list of tags. The list may initially be empty, for example when a viewer creates a new data tag file:

sds-tag: Description
    description: Optional Additional descriptive text
    tags: Required List of zero or more data tag entries

An empty data tag file has the following content:

sds-tag:
  tags: []

Each entry in the tags: list describes one tag:

tags: Description
- value: Required One tag value or a non-empty list of tag values
    class: Optional Global class name associated with the tag value
    timeslot: Required Timeslot at which the tag value is reached
    end-timeslot: Optional First timeslot at which the tag value no longer applies

The required timeslot: value specifies when the tag value is reached and is the start of the tag. The optional end-timeslot: value specifies the end of an interval:

  • Without end-timeslot:, an unclassified tag or a tag whose class uses selection: multiple marks only the data block at timeslot:. A tag whose class uses selection: one-of remains active until the next tag of the same class replaces it.
  • With end-timeslot:, the tag applies to the interval timeslot <= t < end-timeslot. A one-of tag ends earlier if another tag of the same class replaces it.

Except for replacement-based one-of tags, tags do not continue implicitly. A tag that covers more than one timeslot must specify end-timeslot:, which must be greater than timeslot:. An explicit end-timeslot: also ends a one-of tag if it is not replaced earlier.

The optional class: node associates the tag with a globally named class. Each tag value must match a label in that class. When class: is omitted, the tag value is free-form and is not connected to a class definition. A class used by a data tag must be defined in the SDS metadata of at least one applicable stream. If several applicable streams define it, their mappings must be identical.

A tag for a one-of class contains exactly one scalar label. A tag for a multiple class may contain one label or a list of labels.

The value: node accepts a string, number, boolean, or a non-empty list of these scalar values. A list assigns multiple values in one tag entry to the same timeslot or interval. List order is insignificant and duplicate values are not allowed. Multiple tag entries may overlap, including entries with the same class.

Data Tag Examples

The following Camera.0.sds-tag.yml assigns object annotations derived from and applied to the Camera.0.sds and Camera.0.p.sds streams. It uses the object class defined in the object-detection metadata example above:

sds-tag:
  description: Object-detection ground truth
  tags:
    - value: person
      class: object
      timeslot: 1234
    - value: [bicycle, car]
      class: object
      timeslot: 2000
      end-timeslot: 3000

The following 0.sds-tag.yml assigns activity and quality labels across all streams with label 0:

sds-tag:
  description: Sensor-fusion activity labels
  tags:
    - value: [walking, waving]
      class: activity
      timeslot: 4000
      end-timeslot: 5000
    - value: uncertain
      class: quality
      timeslot: 4200
      end-timeslot: 4300

Viewer visibility settings are stored in the SDSIO configuration file and are described by the streams: node. Interactive viewer changes do not modify *.sds.yml metadata files because those files describe only the binary data structure.

SDSIO Configuration File: *.sdsio.yml

The SDSIO configuration file *.sdsio.yml configures:

sdsio:

sdsio: Content
    interface: Optional SDSIO-Server only: specifies the interface used to connect to the target firmware (default: usb).
    workdir: Optional Directory containing *.sds files (default: current working directory). Relative paths are interpreted relative to the location of the *.sdsio.yml file. In AVH FVP simulations, the *.sdsio.yml file must reside in the simulator working directory.
    write-flush-records: Optional Force recorded SDS data to disk after this many records (0 = after every record; default: disabled). The SDSIO-Server --write-flush-records command-line option overrides this setting.
    metadir: Optional Directory for metadata files (default: workdir). This key is used by the VS Code CMSIS SDS extension.
    streams: Optional Data stream information used by the VS Code CMSIS SDS extension.
    play: Optional Playback step list that defines how *.sds files are played back (used in playback mode).
    flag-info: Optional Human readable labels for user flags. This key is currently not used by SDSIO-Server or the VSI3 simulation interface.

interface:

Note

  • The interface: settings are used by SDSIO-Server. The AVH FVP VSI3 simulation interface ignores interface:.
interface: Content
    usb: Optional Configure USB bulk interface.
    serial: Optional Configure serial (UART) interface.
    socket: Optional Configure TCP socket interface.

usb:

usb: Content
    high_priority: Optional SDSIO-Server only: increase process priority (default: false).

Example:

sdsio:
  interface:
    usb:                # configure for USB interface

serial:

serial: Content
    port: Required Port name (examples: COM3, ttyS0, ttyUSB1, ...).
    baudrate: Optional Baudrate (default: 115200).
    parity: Optional Parity bit: none, even, odd, mark, space (default: none).
    stopbits: Optional Stop bits: 1, 1.5, 2 (default: 1).

Example:

sdsio:
  interface:
    serial:             # configure for Serial interface with baudrate 230400 bps.
      baudrate: 230400

socket:

socket: Content
    ipaddr: Optional IPv4 address to bind to in listen mode, or host address when using connect: (example: 192.168.0.100); default for connect: is localhost 127.0.0.1.
    netif: Optional Network interface name (example: eth0); cannot be used with ipaddr.
    port: Optional TCP port number (default: 5050).
    connect: Optional When present, connect to ipaddr instead of listening; optional value is a message sent to the host when the connection is established (default: none).
    connect-time: Optional Duration in milliseconds to discard incoming data after the connection is established (default: 50).

Note

  • The ipaddr: and netif: options are mutually exclusive.
  • connect: requires ipaddr: and cannot be used with netif:.
  • netif: cannot be used in combination with connect:.

Example:

Configure for Network interface.

sdsio:
  interface:
    socket:             # configure for Network interface with default port

Configure for RTT interface via J-Link debug adapter.

sdsio:
  interface:
    socket:             # configure for RTT interface
      connect: "$$SEGGER_TELNET_ConfigStr=RTTCh;1$$"
      port: 19021

streams:

The streams: node provides additional information about the SDS data streams to the VS Code CMSIS SDS extension. The stream viewer type is derived from the corresponding *.sds.yml metadata. Viewer configuration stores only streams or values that the user hides; streams and values are displayed by default.

streams: Content
- name: Required Name of the data stream.
    display: Optional hide excludes the stream from the SDS viewer.
    hide-values: Optional List of value names excluded from graphical display.

An omitted display: node means that the stream is shown. Initially, hide is the only explicit display: value. An omitted or empty hide-values: list means that all values are selected for graphical display. hide-values: applies only to value-list streams.

Example:

sdsio:
  streams:
    - name: Camera
      display: hide

    - name: ModelOut
      hide-values: [confidence, class_id]

Transient editor state, such as the visible time range, time cursor, pane width, and scroll position, is not stored in *.sdsio.yml.

play:

The play: node specifies one or more playback steps. Each playback step defines the list of labels to play back for each opened SDS stream. Playback steps are numbered from 0 in the order in which they appear in the play: list.

For one playback step, all files of the labels: list are concatenated and appear as one data stream for the firmware. A pause (where the data stream needs to be closed and opened again by the firmware) is created with another - step: section.

play: Content
- step: Optional Descriptive text for the playback step.
    recdir: Optional Recording directory for generated *.p.sds files during playback; relative paths are relative to workdir:.
    setflags: Optional Set user flags (bitmask); example: 0x01.
    clearflags: Optional Clear user flags (bitmask); example: 0x01.
    labels: Optional List of label names that define the playback sequence.

Example:

sdsio:
  interface:
    usb:
  workdir: ./algorithm/SDS Recordings
  metadir: ./algorithm/SDS Recordings

  play:             # Playback script
    - step: "Playback: ML_In.0"
      labels: [ 0 ]
    - step: "Playback: ML_In.rock.1.sds + ML_In.rock.2.sds + ML_In.rock.3.sds"
      setflags: 0x02
      clearflags: 0x01
      labels:
        - rock.1
        - rock.2
        - rock.3

flag-info:

The flag-info: node provides human readable labels for the user flags 0..7. This information is currently not used by SDSIO-Server; it is intended for UI tooling.

flag-info: Content
- <flag-bit>: Required Maps the user flag bit position 0..23 to a human readable label.

Example:

sdsio:
  flag-info:
    - 0: Skip Algorithm A
    - 1: Inject fault condition
    - 7: Reserved