Main Content

checkSetup

Class: vision.labeler.AutomationAlgorithm
Namespace: vision.labeler

Set up validation (optional)

Description

In the labeling apps, the checkSetup method checks the validity of the setup when you click Run in an automation session. If checkSetup returns true, then the setup is valid and the app proceeds to run the automation algorithm by using the initialize, run, and terminate methods.

Clients of AutomationAlgorithm can optionally implement this method.

isReady = checkSetup(algObj) returns true if you completed set up correctly and the automation algorithm algObj can begin execution. Otherwise, checkSetup returns false.

example

isReady = checkSetup(algObj,labelsToAutomate) additionally provides a table, labelsToAutomate, that contains labels selected for the automation algorithm to use for labeling. This syntax does not support pixel label automation. In addition, this syntax is available only for time-dependent (temporal) automation algorithms. The Ground Truth Labeler (Automated Driving Toolbox) and Video Labeler apps support temporal algorithms but the Image Labeler does not. For more information on these types of algorithms, see Temporal Automation Algorithms.

Examples

expand all

This implementation of the checkSetup method checks the setup for a temporal automation algorithm. This method determines that an automation algorithm is ready to run if at least one ROI label exists.

function isReady = checkSetup(algObj,labelsToAutomate)
    
    notEmpty = ~isempty(labelsToAutomate);
    hasROILabels = any(labelsToAutomate.Type == labelType.Rectangle);
    isReady = (notEmpty && hasROILabels)
        
end

Input Arguments

expand all

Automation algorithm, specified as a vision.labeler.AutomationAlgorithm object.

Labels selected for automation, specified as a table with these columns.

Column NameDescription
Type

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

  • labelType.Rectangle

  • labelType.Cuboid (Ground Truth Labeler app only)

  • labelType.ProjectedCuboid

  • labelType.Line

  • labelType.Scene

labelType.PixelLabel and labelType.Custom are not supported.

NameCharacter vector that contains the name of the label.
TimeScalar of type double that specifies the time, in seconds, when the label was marked.
Position

Location of the label in the frame. The format of this vector depends on the label type.

Label TypePosition Format
Rectangle — Rectangular region of interest (ROI) labels

M-by-4 numeric vector of the form [x, y, w, h], where:

  • M is the number of labels in the frame.

  • x and y specify the upper-left corner of the rectangle.

  • w specifies the width of the rectangle, which is the length of the rectangle along the x-axis.

  • h specifies the height of the rectangle, which is the length of the rectangle along the y-axis.

Cuboid — Cuboid ROI labels

M-by-9 numeric vector of the form [xctr, yctr, zctr, xlen, ylen, zlen, xrot, yrot, zrot], where:

  • M is the number of labels in the frame.

  • xctr, yctr, and zctr specify the center of the cuboid.

  • xlen, ylen, and zlen specify the length of the cuboid along the x-axis, y-axis, and z-axis, respectively.

  • xrot, yrot, and zrot specify the rotation angles for the cuboid along the x-axis, y-axis, and z-axis, respectively. These angles are clockwise-positive when looking in the forward direction of their corresponding axes.

This figure shows how these values specify the position of a cuboid.

ProjectedCuboid — Cuboid ROI labels

M-by-8 vector of the form [x1, y1, w1, h1, x2, y2, w2, h2], where:

  • M is the number of labels in the frame.

  • x1, y1 specifies the x,y coordinates for the upper-left location of the front-face of the projected cuboid

  • w1 specifies the width for the front-face of the projected cuboid.

  • h1 specifies the height for the front-face of the projected cuboid.

  • x2, y2 specifies the x,y coordinates for the upper-left location of the back-face of the projected cuboid.

  • w2 specifies the width for the back-face of the projected cuboid.

  • h2 specifies the height for the back-face of the projected cuboid.

The figure shows how these values determine the position of a cuboid.

Labeled projected cuboid

Line — Polyline ROI labelsM-by-1 vector of cell arrays, where M is the number of labels in the frame. Each cell array contains an N-by-2 numeric matrix of the form [x1 y1; x2 y2; ... ; xN yN] for N points in the polyline.
Scene — Scene labels

Logical value of 1 if the label is present in the frame and 0 otherwise.

Each row of the table corresponds to a label selected for automation. This labelsToAutomate table contains a rectangle label, a line label with five points, and a cuboid label.

       Type           Name           Time        Position  
     _________    ____________    _________    ____________
 
     Rectangle    'Car'           0.033333     [1x4 double]
     Line         'LaneMarker'    0.066667     [5x2 double]
     Cuboid       'Truck'         0.099999     [1x9 double] 

Output Arguments

expand all

True or false result of the setup check, returned as a 1 or 0 of data type logical.

Version History

Introduced in R2017a