Create Automation Algorithm Function for Labeling
This topic shows how to implement a custom automation algorithm using a function-based interface to accelerate ground truth labeling across labeling apps such as Image Labeler, Video Labeler, Lidar Labeler (Lidar Toolbox), and Ground Truth Labeler (Automated Driving Toolbox). The labeling apps enable you to label ground truth for a variety of data sources and automatically label your data by creating and importing a custom automation algorithm.
To build a custom automation algorithm for labeling apps, you can use either a function-based or class-based interface. The apps provide templates for both interface types. The table below compares their capabilities to help you choose the right interface for your workflow:
| Automation Algorithm Interface Type | Description | Use Case & Capabilities |
|---|---|---|
Function-based | Define automation logic using a standalone function with parameter tuning. |
|
Class-based | Create a custom class inheriting from |
|
For more information about the class-based automation algorithm interface, see Create Custom Automation Algorithm for Labeling.
How to Specify an Automation Function in an App
To create an automation algorithm using the built-in function template:
On the app toolstrip, click Select Algorithm > Custom Automation Function.
In the BrowserPanelDisplay pane, select the images for which to automate labeling, then click Automate in the toolbar.
On the app toolstrip, select Settings, and then specify the algorithm function. If you need to create a new function, you can click the blue information icon to open the automation function template.
The app invokes the automation algorithm on each image selected for
automation. The app returns the labels created by the automation algorithm in an
autoLabels structure. To automate pixel labeling, the
autoLabels structure must be a categorical matrix. Otherwise,
autoLabels must be a structure or a table.
Use a Function to Automate Labeling with Your Custom Detector
The labeler app built-in algorithms may not work to explicitly detect the features unique to your data. Therefore, you can train a detector using your data, and then create a custom algorithm using the function template provided within the app. The function requires a minimum set of parameters, which are related to the type of labels suited to your detector. Specifying a function handle within the app enables you to quickly test different automation algorithms and change the parameters of your algorithm.
This is an example of a function that creates an algorithm to use with a labeling app.
It runs a pretrained aggregate channel features (ACF) object detector to label people in
the input image. The function returns the predicted labels
autoLabels, which is a structure array that contains the
Name, Type, and Position
fields.
Create an Automation Algorithm Function
The function template contains descriptions for the fields in
autoLabels and an example of how to set the fields. The template
also specifies where to insert your custom algorithm function by name, or by specifying
a function handle. Use a function handle to pass additional inputs to your function, if
required. To access the template, select Settings, and then click
the blue information icon in the Custom Automation Function
Settings dialog box. The template contains this information:
See Also
Apps
- Video Labeler | Image Labeler | Ground Truth Labeler (Automated Driving Toolbox)
Classes
vision.labeler.AutomationAlgorithm|vision.labeler.mixin.BlockedImageAutomation|vision.labeler.mixin.Temporal
