Main Content

labelDefinitionCreator

Object for storing, modifying and creating label definitions table

Description

The labelDefinitionCreator object stores definitions of labels, sublabels, and attributes for labeling ground truth data. Use Object Functions to add, remove, modify, or display label definitions. Using the create object function, you can create label definitions table from the labelDefinitionCreator object. You can use this label definitions table with the Image Labeler, and Video Labeler apps. To create a label definitions table for use with the Ground Truth Labeler (Automated Driving Toolbox) app, use a labelDefinitionCreatorMultisignal (Automated Driving Toolbox) object instead.

Creation

Description

example

ldc = labelDefinitionCreator creates an empty label definition creator object, ldc. Add label definitions by using Object Functions. The details of the stored labels, sublabels, and attributes can be inspected using the info object function.

example

ldc = labelDefinitionCreator(labelDefs) creates a label definition creator object ldc and stores definitions from the label definitions table labelDefs. Use Object Functions to add new label definitions or modify the existing label definitions. The details of the stored labels, sublabels, and attributes can be inspected using the info object function.

Input Arguments

expand all

Label definitions, specified as a table with up to seven columns. The possible columns are Name, Type, LabelColor, PixelLabelID, Group, Description, and Hierarchy. This table specifies the definitions of labels, sublabels, and attributes for labeling ground truth data. For more details, see LabelDefinitions.

Output Arguments

expand all

Label definition creator, returned as a labelDefinitionCreator object that contains information about label definitions associated with ground truth data.

Object Functions

addLabelAdd label to label definition creator object
addSublabelAdd sublabel to label in label definition creator object
addAttributeAdd attributes to label or sublabel in label definition creator object
removeLabelRemove label from label definition creator object
removeSublabelRemove sublabel from label in label definition creator object
removeAttributeRemove attribute from label or sublabel in label definition creator object
editLabelGroupModify a label group name
editGroupNameChange group name
editLabelDescriptionModify description of label or sublabel in label definition creator object
editAttributeDescriptionModify description of attribute in label definition creator object
create Create label definitions table from the label definition creator object
infoDisplay information about a label, sublabel, or attribute stored in label definition creator object

Examples

collapse all

Create an empty label definition creator object.

ldc = labelDefinitionCreator
ldc = 

labelDefinitionCreator with 0 labels. Use the addLabel method to add a label.

Add a label with the name "Vehicle" and specify the type of label as a rectangle.

addLabel(ldc,'Vehicle',labelType.Rectangle)

Add a sublabel with the name "Wheel" and an attribute with the name "Color" to the label "Vehicle" stored in ldc. Specify the type of sublabel as a rectangle and the attribute type as a string with value 'Red'.

addSublabel(ldc,'Vehicle','Wheel',labelType.Rectangle)
addAttribute(ldc,'Vehicle','Color',attributeType.String,'Red')

Display the details of the label definition creator object.

ldc
ldc = 

labelDefinitionCreator contains the following labels:

	Vehicle with 1 sublabels and 1 attributes.	(info)

For more details about attributes and sublabels, use the info method.

Load an existing label definitions table into the workspace.

labelDefFile = fullfile(toolboxdir('vision'), 'visiondata', 'labelDefsWithAttributes.mat');
ld = load(labelDefFile)
ld = 

  struct with fields:

    labelDefs: [4×4 table]

Create a label definition creator object from the label definitions table. Display the details of the label definition creator object.

ldc = labelDefinitionCreator(ld.labelDefs)
ldc = 

labelDefinitionCreator contains the following labels:

	Vehicle with 0 sublabels and 3 attributes.	(info)
	Pedestrian with 0 sublabels and 0 attributes.	(info)
	LaneMarker with 0 sublabels and 2 attributes.	(info)
	TrafficLight with 1 sublabels and 0 attributes.	(info)

For more details about attributes and sublabels, use the info method.

Version History

Introduced in R2018b