Main Content

vision.labeler.AutomationAlgorithm

Interface for algorithm automation in ground truth labeling

Description

The AutomationAlgorithm class specifies the interface for defining custom automation algorithms to run in the Image Labeler, Video Labeler, and Ground Truth Labeler (Automated Driving Toolbox) apps. Classes that inherit from the AutomationAlgorithm interface can be used with the automation workflow of the labeling apps to generate ground truth labels. Use of the Ground Truth Labeler app requires Automated Driving Toolbox™.

Properties

expand all

The AutomationAlgorithm class predefines this set of properties.

Ground truth data, specified as a groundTruth or groundTruthMultisignal (Automated Driving Toolbox) object. This property holds all the labels in the labeling app prior to automation.

  • For automation algorithms used in the Image Labeler or Video Labeler app, this property must be a groundTruth object.

  • For automation algorithms used in the Ground Truth Labeler (Automated Driving Toolbox) app (requires Automated Driving Toolbox), this property must be a groundTruthMultisignal object.

Label definitions selected for automation in the labeling app, specified as a structure. The labeling apps support selection of only one labeling definition per automation session. In the labeling apps, the selected label definition is highlighted in yellow in either the ROI Label Definition or Scene Label Definition pane on the left.

The structure contains these fields.

FieldDescription
Type

labelType enumeration that contains the type of label definition. Valid label types are:

  • labelType.Rectangle

  • labelType.Cuboid (for point clouds)

  • labelType.ProjectedCuboid (for image and video data)

  • labelType.Line

  • labelType.PixelLabel

  • labelType.Scene

labelType.Custom is not supported.

NameCharacter vector that contains the name of the label definition.
Attributes (optional)

Structure array that contains one structure for each attribute in the label definition. If the label definition does not contain attributes, then this property does not include the Attributes field.

The first field of each attribute structure in this structure array contains the attribute name. The second field contains a structure of values that are associated with that name. If you are defining a List attribute, you must also define the list of values for that attribute. Values for Numeric Value, String, or Logical attributes are optional. Descriptions for the attributes are optional for all cases.

PixelLabelID (optional)Positive integer that contains the pixel label ID for the label definition. This PixelLabelID field applies only for label definitions of type PixelLabel.

To view a sample SelectedLabelDefinitions structure that contains an attribute, enter this code at the MATLAB® command prompt.

selectedLabelDefs.Type = labelType.Rectangle;
selectedLabelDefs.Name = 'Car';
selectedLabelDefs.Attributes = struct('distance', ...
    struct('DefaultValue',0,'Description','Sensor distance'))

To view a sample SelectedLabelDefinitions structure that contains pixel label definitions, enter this code at the MATLAB command prompt.

selectedLabelDefs.Type = labelType.Rectangle;
selectedLabelDefs.Name = 'Car';
selectedLabelDefs.Attributes = struct('distance', ...
    struct('DefaultValue',0,'Description','Sensor distance'))

Valid label definitions that the algorithm can automate, specified as a structure array. Each structure in the array corresponds to a valid label definition. To determine which label definitions are valid, the app uses the checkLabelDefinition method. This table describes the fields for each valid label definition structure.

FieldDescription
Type

labelType enumeration that contains the type of label definition. Valid label types are:

  • labelType.Rectangle

  • labelType.Cuboid (for point clouds)

  • labelType.ProjectedCuboid (for image and video data)

  • labelType.Line

  • labelType.PixelLabel

  • labelType.Scene

labelType.Custom is not supported.

NameCharacter vector that contains the name of the label definition.
Attributes (optional)

Structure array that contains one structure for each attribute in the label definition. If the label definition does not contain attributes, then this property does not include the Attributes field.

The first field of each attribute structure in this structure array contains the attribute name. The second field contains a structure of values that are associated with that name. If you are defining a List attribute, you must also define the list of values for that attribute. Values for Numeric Value, String, or Logical attributes are optional. Descriptions for the attributes are optional for all cases.

PixelLabelID (optional)Positive integer that contains the pixel label ID for the label definition. This PixelLabelID field applies only for label definitions of type PixelLabel.

To view a sample ValidLabelDefinitions structure that contains an attribute, enter this code at the MATLAB command prompt.

validLabelDefs(1).Type = labelType.Rectangle;
validLabelDefs(1).Name = 'Car';
validLabelDefs(2).Type = labelType.Line;
validLabelDefs(2).Name = 'LaneMarker';
validLabelDefs(3).Type = labelType.Scene
validLabelDefs(3).Name = 'Sunny';

To view a sample ValidLabelDefinitions structure that contains pixel label definitions, enter this code at the MATLAB command prompt.

validLabelDefs(1).Type = labelType.PixelLabel;
validLabelDefs(1).Name = 'Road';
validLabelDefs(1).PixelLabelID  = 1;
validLabelDefs(2).Type = labelType.PixelLabel;
validLabelDefs(2).Name = 'Sky';
validLabelDefs(2).PixelLabelID = 2

Clients of the AutomationAlgorithm class are required to define this set of properties. These properties set up the name, description, and user instructions for your automated algorithm.

Automation algorithm name, specified as a character vector.

Algorithm description, specified as a character vector.

Algorithm directions displayed in app, specified as a cell array. UserDirections are specified as a cellstr, with each string representing a separate direction. Use the checkSetup method to verify that the directions have been adhered to.

Object Functions

Clients of an AutomationAlgorithm implement these user-defined functions to define execution of the algorithm.

checkLabelDefinitionValidate label definition
checkSignalTypeValidate signal type
checkSetupSet up validation (optional)
initializeInitialize state for algorithm execution (optional)
runRun label automation on every frame in interval
terminateTerminate automated algorithm (optional)

Clients of an AutomationAlgorithm can also implement the user-defined settingsDialog function to display algorithm settings, or a constructor with no input arguments.

For more information on creating your own automation algorithm, see Create Automation Algorithm for Labeling.

Introduced in R2017a