Contenuto principale

selectLabelsByLabelName

R2026b

Select multi-sensor ground truth by label name

Since R2026b

Description

gtLabel = selectLabelsByLabelName(gTruth,labelNames) selects labels specified by labelNames from a groundTruthMultiSensor object, gTruth. The function returns a corresponding groundTruthMultiSensor object, gtLabel, that contains only the selected labels. If gTruth is a vector of groundTruthMultiSensor objects, then the function returns a vector of corresponding groundTruthMultiSensor objects that contain only the selected labels.

example

Examples

collapse all

Select ground truth labels from a groundTruthMultiSensor object by specifying a label name.

This example assumes you have a groundTruthMultiSensor object, gTruth, in the workspace containing ROI and scene label data for a video and corresponding lidar point cloud sequence.

Inspect the label definitions. The object contains ROI labels for different vehicle types and a scene label. Because image and lidar point cloud signals represent ROIs differently, the car label has two rows. On image signals, such as videos, you draw the label as a rectangle. On point cloud signals, you draw the label as a cuboid.

gTruth.LabelDefinitions
ans =

  5×7 table

      Name       SignalType    LabelType       Group        Description           LabelColor            Hierarchy
    _________    __________    _________    ____________    ___________    ________________________    ____________

    {'car'  }    Image         Rectangle    {'Vehicles'}    {0×0 char}     {[0.5862 0.8276 0.3103]}    {1×1 struct}
    {'car'  }    PointCloud    Cuboid       {'Vehicles'}    {0×0 char}     {[0.5862 0.8276 0.3103]}    {1×1 struct}
    {'truck'}    Image         Rectangle    {'Vehicles'}    {0×0 char}     {[     0.5172 0.5172 1]}    {0×0 double}
    {'truck'}    PointCloud    Cuboid       {'Vehicles'}    {0×0 char}     {[     0.5172 0.5172 1]}    {0×0 double}
    {'sunny'}    Time          Scene        {'None'    }    {0×0 char}     {[     0 0.7241 0.6552]}    {0×0 double}

Create a new groundTruthMultiSensor object that contains labels for only the "sunny" label definition.

labelNames = "sunny";
gtLabel = selectLabelsByLabelName(gTruth,labelNames);

For the original and new objects, inspect the ROI label data. Because you did not select any ROI label names, in the new object, the signals do not contain any ROI label data at any timestamp.

gTruth.ROILabelData
gtLabel.ROILabelData
ans =

  ROILabelData with properties:

    video_01_city_c2s_fcw_10s: [204×2 timetable]
                lidarSequence: [34×2 timetable]


ans =

  ROILabelData with properties:

                lidarSequence: [34×0 timetable]
    video_01_city_c2s_fcw_10s: [204×0 timetable]

For the original and new objects, inspect the scene label data. Because you selected the "sunny" label, the original object and new object contain identical scene label data.

gTruth.SceneLabelData
gtLabel.SceneLabelData
ans =

  SceneLabelData with properties:

    sunny: [0 sec    10.15 sec]


ans =

  SceneLabelData with properties:

    sunny: [0 sec    10.15 sec]

Input Arguments

collapse all

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

Label names, specified as a character vector, string scalar, cell array of character vectors, or string vector.

To view all label names in a groundTruthMultiSensor object, gTruth, enter this command at the MATLAB® command prompt.

unique(gTruth.LabelDefinitions.Name)

Example: "car"

Example: "car"

Example: {"car","lane"}

Example: ["car" "lane"]

Output Arguments

collapse all

Ground truth with only the selected labels, returned as a groundTruthMultiSensor object or vector of groundTruthMultiSensor objects.

Each groundTruthMultiSensor object in gtLabel corresponds to a groundTruthMultiSensor object in the gTruth input. The returned objects contain only the labels that are of the label names specified by the labelNames input.

Limitations

  • Selecting pixel labels or semantic point labels by label name is not supported. However, you can select all labels of these types. Use the selectLabelsByLabelType function, specifying the label type as a labelType.PixelLabel or labelType.SemanticPointLabel enumeration.

  • Selecting sublabels by label name is not supported.

Version History

Introduced in R2026b