Main Content

selectLabelsByGroupName

Select multisignal ground truth by label group name

Since R2020a

Description

gtLabel = selectLabelsByGroupName(gTruth,labelGroups) selects labels belonging to the groups specified by labelGroups 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 group 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 label definitions in a "Vehicles" group. Ungrouped labels are in the group named "None".

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 "Vehicles" group.

groupNames = "Vehicles";
gtLabel = selectLabelsByGroupName(gTruth,groupNames);

For the original and new objects, inspect the ROI label data. Because "Vehicles" is the only group used for the ROI label data, the original and new object contain identical ROI label data.

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

For the original and new objects, inspect the scene label data. The "None" group, which is used only in scene labels, was not selected. Therefore, the new object contains no scene label data.

gTruth.SceneLabelData
gtLabel.SceneLabelData
ans = 

  SceneLabelData with properties:

    sunny: [0 sec    10.15 sec]


ans = 

  SceneLabelData with properties:

    sunny: [0x0 duration]

Input Arguments

collapse all

Multisignal ground truth data, specified as a groundTruthMultisignal object or vector of groundTruthMultisignal objects.

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

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

unique(gTruth.LabelDefinitions.Group)

Example: 'Vehicles'

Example: "Vehicles"

Example: {'Vehicles','Signs'}

Example: ["Vehicles" "Signs"]

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 belonging to the groups specified by the labelGroups input.

Version History

Introduced in R2020a