Main Content

semanticPointLabelDatastore

R2026b

Datastore for 3-D point cloud semantic segmentation labels

Since R2026b

Description

A semanticPointLabelDatastore object stores per-point semantic labels for point cloud data. You can use this datastore for training 3-D semantic segmentation networks such as RANDLA-Net using the trainRandlanet function. The datastore provides per-point label data that maps each point in a point cloud to a semantic class.

Creation

Description

splds = semanticPointLabelDatastore(gTruth) creates a semantic point label datastore from a groundTruthMultiSensor object, gTruth. The datastore reads per-point semantic labels for each point cloud frame across all point cloud signals that include ground truth semantic labels. Use this syntax, if you have labeled ground truth from the Multi-Sensor Labeler app.

example

splds = semanticPointLabelDatastore(location,classNames,IDs) creates a semantic point label datastore from label data files on disk. The location specifies the folder or files containing the label data. classNames specifies the class names for the semantic labels, and IDs specifies the corresponding label IDs.

splds = semanticPointLabelDatastore(___,Name=Value) specifies options using one or more name-value arguments in addition to any of the input argument combinations from previous syntaxes. For example, IncludeSubfolders=true includes label data files from all subfolders within the specified location.

example

Input Arguments

expand all

Multi-sensor ground truth data, specified as a groundTruthMultiSensor object or vector of groundTruthMultiSensor objects containing SemanticPointLabel label data.

Location of the semantic point label data files, specified as a folder path or file paths.

Class names for the semantic labels, specified as a string array or cell array of character vectors.

Example: ["road" "car" "pedestrian" "building"]

Label IDs corresponding to each class name, specified as one of these values:

  • Numeric vector — Scalar integer label IDs between 0 and 255, one per class.

  • Cell array of numeric vectors — Each cell contains a scalar integer or a 1-by-3 RGB triplet of integers between 0 and 255. All cells must use the same format (all scalars or all RGB triplets).

Example: [1 2 3 4]

Example: {[128 64 128]; [244 35 232]; [0 0 142]}

Name-Value Arguments

expand all

Specify optional pairs of arguments as Name1=Value1,...,NameN=ValueN, where Name is the argument name and Value is the corresponding value. Name-value arguments must appear after other arguments, but the order of the pairs does not matter.

Example: splds = semanticPointLabelDatastore(gTruth,SignalName="lidarSequence")

Name of the point cloud signal from which to extract semantic point label data, specified as a string scalar, character vector, string array, or cell array of character vectors. Use this argument when gTruth contains multiple point cloud signals with semantic point labels. If not specified, the function processes all point cloud signals that have SemanticPointLabel data.

This argument applies only to the gTruth input syntax.

Include label data files from subfolders within the specified location, specified as true or false.

Number of label data files to read per call to read, specified as a positive integer. This value also sets the ReadSize property.

Alternate file system root paths, specified as a string array or cell array containing one or more rows. Each row specifies a set of equivalent root paths. Use this argument when you create a datastore on one machine and access it on another machine with different file system root paths.

File extensions for the label data files, specified as a string scalar or string array. By default, the datastore reads .mat files.

This argument applies only to the location input syntax.

Custom read function for reading label data files, specified as a function handle. The function must accept a file path as input and return the semantic point label data.

This argument applies only to the location input syntax.

Properties

expand all

File paths of the semantic point label data files included in the datastore.

Names of the semantic classes in the label data, returned as a string array. When you create the datastore from a groundTruthMultiSensor object, the class names are extracted from the SemanticPointLabel entries in the LabelDefinitions property. When you create the datastore from files, the class names are specified by the classNames input.

Number of label data files to read per call to read.

Function for reading label data files, specified as a function handle. The function must accept a file path as input and return the semantic point label data. By default, the datastore uses an internal function that reads .mat files containing semantic point label data.

Alternate file system root paths, specified as a string array or cell array containing one or more rows. Each row specifies a set of equivalent root paths. Use this property when you create a datastore on one machine and access it on another machine with different file system root paths.

Object Functions

expand all

readRead data from label datastore
readallRead all data in label datastore
previewPreview subset of data in datastore
hasdataDetermine if data is available to read
resetReset datastore to initial state
subsetCreate subset of datastore or FileSet
partitionPartition a datastore
numpartitionsNumber of datastore partitions
shuffleShuffle all data in datastore
combineCombine data from multiple datastores
transformTransform datastore
isPartitionableDetermine whether datastore is partitionable
isShuffleableDetermine whether datastore is shuffleable

Examples

collapse all

Create a semantic point label datastore directly from a groundTruthMultiSensor object exported from the Multi-Sensor Labeler app.

Load a groundTruthMultiSensor object that contains semantic point labels.

load("groundTruthMultiSensor.mat");

Create a semantic point label datastore from the ground truth data. The datastore automatically extracts class names and label IDs from the label definitions.

splds = semanticPointLabelDatastore(gTruth);

Display the class names and the number of label data files in the datastore.

disp(splds.ClassNames)
numFiles = numel(splds.Files)

Read the first set of per-point labels. The output is a categorical vector that maps each point in the corresponding point cloud to one of the semantic classes.

labels = read(splds);

Create a semantic point label datastore from label data files on disk using RGB color triplets as label IDs, and include label files from subfolders.

Specify the folder containing semantic point label data files and define the class names with corresponding RGB color triplet IDs.

location = fullfile(tempdir,"semanticLabels");
classNames = ["Road" "Sidewalk" "Car"];
labelIDs = {[128 64 128]; [244 35 232]; [0 0 142]};

Create a semantic point label datastore. Set IncludeSubfolders to true to include label data files from all subfolders within the specified location.

splds = semanticPointLabelDatastore(location,classNames,labelIDs, ...
    IncludeSubfolders=true);

Verify the number of files found and read the first set of labels.

numFiles = numel(splds.Files)
labels = read(splds);

Version History

Introduced in R2026b