Main Content

selectLabelsByLabelName

Select multisignal ground truth by label name

Since R2020a

Description

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

example

Examples

collapse all

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

Load a groundTruthMultisignal object containing ROI and scene label data for a video and corresponding lidar point cloud sequence. The helper function used to load this object is attached to the example as a supporting file.

gTruth = helperLoadGTruthVideoLidar;

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 =

  5x7 table

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

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

Create a new groundTruthMultisignal 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: [204x2 timetable]
                lidarSequence: [34x2 timetable]


ans = 

  ROILabelData with properties:

    video_01_city_c2s_fcw_10s: [204x0 timetable]
                lidarSequence: [34x0 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

Multisignal ground truth data, specified as a groundTruthMultisignal object or vector of groundTruthMultisignal 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 groundTruthMultisignal 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 groundTruthMultisignal object or vector of groundTruthMultisignal objects.

Each groundTruthMultisignal object in gtLabel corresponds to a groundTruthMultisignal 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 by label name is not supported. However, you can select all labels of type pixel. Use the selectLabelsByLabelType function, specifying the label type as a labelType.PixelLabel enumeration.

  • Selecting sublabels by label name is not supported.

Version History

Introduced in R2020a