selectLabelsByLabelType
Description
selects labels of the types specified by gtLabel
= selectLabelsByLabelType(gTruth
,labelTypes
)labelTypes
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.
Examples
Select Ground Truth Labels by Label Type
Select ground truth labels from a
object by specifying a label type.groundTruthMultisignal
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 definitions for rectangle, cuboid, and scene label types.
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}
Inspect the ROI labels. The object contains labels for the lidar point cloud sequence and the video.
gTruth.ROILabelData
ans = ROILabelData with properties: lidarSequence: [34x2 timetable] video_01_city_c2s_fcw_10s: [204x2 timetable]
Create a new groundTruthMultisignal
object that contains only labels that are of type cuboid.
labelTypes = labelType.Cuboid; gtLabel = selectLabelsByLabelType(gTruth,labelTypes);
For the original and new objects, inspect the first five rows of label data for the lidar point cloud sequence. Because the lidar point cloud signal in the original object contains only cuboid labels, the new object contains the same label data for the lidar sequence as the original object.
lidarLabels = gTruth.ROILabelData.lidarSequence; lidarLabelsSelection = gtLabel.ROILabelData.lidarSequence; numrows = 5; head(lidarLabels,numrows) head(lidarLabelsSelection,numrows)
Time car truck ___________ ____________ ____________ 0 sec {1x1 struct} {1x0 struct} 0.29926 sec {1x1 struct} {1x0 struct} 0.59997 sec {1x1 struct} {1x0 struct} 0.8485 sec {1x1 struct} {1x0 struct} 1.1484 sec {1x1 struct} {1x0 struct} Time car truck ___________ ____________ ____________ 0 sec {1x1 struct} {1x0 struct} 0.29926 sec {1x1 struct} {1x0 struct} 0.59997 sec {1x1 struct} {1x0 struct} 0.8485 sec {1x1 struct} {1x0 struct} 1.1484 sec {1x1 struct} {1x0 struct}
For the original and new objects, inspect the first five rows of label data for the video. Because video signals do not support the Cuboid
label type, the new object contains no label data for the video.
videoLabels = gTruth.ROILabelData.video_01_city_c2s_fcw_10s; videoLabelsSelection = gtLabel.ROILabelData.video_01_city_c2s_fcw_10s; head(videoLabels,numrows) head(videoLabelsSelection,numrows)
Time car truck ________ ____________ ____________ 0 sec {1x3 struct} {1x0 struct} 0.05 sec {1x3 struct} {1x0 struct} 0.1 sec {1x3 struct} {1x0 struct} 0.15 sec {1x3 struct} {1x0 struct} 0.2 sec {1x3 struct} {1x0 struct} Time ________ 0 sec 0.05 sec 0.1 sec 0.15 sec 0.2 sec
Input Arguments
gTruth
— Multisignal ground truth data
groundTruthMultisignal
object | vector of groundTruthMultisignal
objects
Multisignal ground truth data, specified as a groundTruthMultisignal
object or vector of groundTruthMultisignal
objects.
labelTypes
— Label types
labelType
enumeration | vector of labelType
enumerations
Label types, specified as a labelType
enumeration or vector of
labelType
enumerations.
To view all label types in a groundTruthMultisignal
object,
gTruth
, enter this command at the MATLAB® command
prompt.
unique(gTruth.LabelDefinitions.LabelType)
Example: labelType.Cuboid
Example: [labelType.Cuboid labelType.Scene]
Output Arguments
gtLabel
— Ground truth with only selected labels
groundTruthMultisignal
object | vector of groundTruthMultisignal
objects
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 types specified by the labelTypes
input.
Limitations
Selecting sublabels by label type is not supported.
Version History
Introduced in R2020a
See Also
Objects
Functions
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
- Canada (English)
- United States (English)
Europe
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
Asia Pacific
- Australia (English)
- India (English)
- New Zealand (English)
- 中国
- 日本Japanese (日本語)
- 한국Korean (한국어)