Get Started with the Image Labeler

The Image Labeler app provides an easy way to mark rectangular region of interest (ROI) labels, polyline ROI labels, pixel ROI labels, and scene labels in a video or image sequence. This example gets you started using the app by showing you how to:

  • Manually label an image frame from an image collection.

  • Automatically label across image frames using an automation algorithm.

  • Export the labeled ground truth data.

ROI and Scene Label Definitions

  • An ROI label corresponds to either a rectangular or pixel region of interest. These labels contain two components: the label name, such as "cars," and the region you create.

  • A Scene label describes the nature of a scene, such as "sunny." You can associate this label with a frame.

Using the Image Labeler app, you can:

  • Interactively specify ROI labels and scene labels.

    • Use rectangular ROI labels for objects such as vehicles, pedestrians, and road signs.

    • Use pixel labels for areas such as backgrounds, roads, and buildings.

    • Use scene labels for conditions such as lighting and weather conditions, or for events such as lane changes.

  • Use built-in detection or tracking to automatically label the regions and scene labels.

  • Write, import, and use your own custom automation algorithm to automatically label a region and scene labels.

  • Export the ground truth labels for object detector training, semantic segmentation, or image classification.

Open the Image Labeler

  • MATLAB® Toolstrip: On the Apps tab, under Image Processing and Computer Vision, click the Image Labeler.

  • MATLAB command prompt: Enter imageLabeler.

Load a Video or Image Sequence and Import Labels

To load data into the Image Labeler, from the app toolstrip, click Load. You can load the following data:

  • Data Source: Add images from a folder or by using the imageDatastore function.

  • Label Definitions: Load a previously saved set of label definitions from a file. Label definitions specify the names and types of items to label.

  • Session: Load a previously saved session.

To import ROI and scene labels into the app, click Import Labels. You can import labels from the MATLAB workspace or from previously exported MAT-files. The imported labels must be groundTruth objects.

Create Label Definitions

Before you can label your images, you must define the name and type of each label category.

To define an ROI label,

  1. Click the Define new ROI label.

  2. Specify a label name and choose either Rectangle or Pixel label for the label type from the drop-down menu.

  3. Use the optional Group field to create a group. Click New Group from the drop-down menu and enter a group title in the field that appears. You can move a label to a different group by left-clicking and dragging the label.

  4. Optionally enter a label description.

To define a scene label:

  1. Click the Define new scene label.

  2. Specify a label name.

  3. Use the optional Group field to create a group. Click New Group from the drop-down menu and enter a group title in the field that appears.

  4. Optionally enter a label description.

To create labels from the MATLAB command line, use the labelDefinitionCreator object.

Label Ground Truth

After you set up the ROI label definitions, you can start labeling. You can create labels manually or use an automation algorithm.

 Create Labels Manually

Create Labels Using an Automation Algorithm

Use the Select Algorithm section to select an algorithm for automated labeling. You can use a built-in algorithm, create a custom algorithm, or import an algorithm.

  • Built-In Algorithm: Track people using the aggregated channel features (ACF) people detector algorithm.

  • Add a Custom Algorithm: To define and use a custom automation algorithm with the Image Labeler app, see Create Automation Algorithm for Labeling.

  • Import an Algorithm: To import your own algorithm, select Algorithm > Add Algorithm > Import Algorithm.

 Run an Automation Algorithm

Export Labels and Save Session

To export the ground truth labels to the MATLAB workspace or to a MAT-file, click Export Labels. The labels are exported as a groundTruth object. Click Save to save the session. The session and the exported labels are saved as MAT-files. You can use the exported groundTruth object to train an object detector or semantic segmentation network. See Train Object Detector or Semantic Segmentation Network from Ground Truth Data.


Pixel label data and ground truth data are saved in separate files. The app saves both files in the same folder. Keep these tips in mind:

  • The groundTruth object contains the file paths corresponding to the data source and the pixel label data. If you move the data source and pixel label data to a different folder, to update the paths stored within the groundTruth object, use the changeFilePaths function.

  • If you used an image collection to create your ground truth, do not delete images from the location you loaded them from. The path to those images is saved in the groundTruth object.

  • You can move the groundTruth MAT-file to a different folder.

For more details, see How Labeler Apps Store Exported Pixel Labels and Share and Store Labeled Ground Truth Data.

See Also



Related Topics