メインコンテンツ

Export Multi-Sensor Ground Truth and Create Training Data

R2026b

After labeling your data in the Multi-Sensor Labeler app, as described in the Create Labels and Label Multi-Sensor Data and Automate Labeling for Multi-Sensor Data procedures, export the labeled multi-sensor ground truth data.

Export Labeled Data

To export the labeled ground truth data to the MATLAB workspace:

  1. On the app toolstrip, click Export Labels.

  2. Select To Workspace.

  3. Specify the variable name as gTruth.

The app exports a groundTruthMultiSensor object named gTruth to the MATLAB workspace. This object contains the data source information, label definitions, ROI label data, and scene label data for all signals.

Export to MAT File

To export the labeled data to a MAT file:

  1. On the app toolstrip, click Export Labels.

  2. Select To File.

  3. Specify the file name and location for the MAT file.

The app saves the groundTruthMultiSensor object to the specified MAT file. You can also export only label definitions to a file by selecting Export and then choosing the Label Definitions section option To File.

Generate Training Data from Labeled Multi-Sensor Ground Truth

After exporting the groundTruthMultiSensor object to the workspace, follow these steps to generate training data for deep learning models.

Generate Training Data from Labeled Point Cloud Data

FunctionInput Label TypeDescription
semanticPointLabelTrainingDataSemantic Point ROIGenerates paired pointCloudDatastore and semanticPointLabelDatastore objects for training 3-D semantic segmentation networks.
pointCloudObjectDetectorTrainingDataCuboidCreates a training data table for 3-D object detection from cuboid ROI labels.

Generate Training Data from Labeled Image or Video Data

To create image training data, use gatherLabelData to extract label data and timestamps, then use writeFrames to write image frames to disk. From there, construct datastores for the desired training workflow.

% Extract label data and timestamps for an image signal
signalName = "myImageSignal";
[labelData, timestamps] = gatherLabelData(gTruth, signalName, labelType.Rectangle);

% Write frames to disk
outputFolder = fullfile(tempdir, "imageFrames");
filenames = writeFrames(gTruth, signalName, outputFolder, timestamps);

% Create image datastore from written frames
imds = imageDatastore(filenames{1});

After extracting the image frames and label data, create training datastores based on your task:

Note

Creating training datastores from gathered label data requires Computer Vision Toolbox™.

  • Object Detection — Gather Rectangle label data. Create a boxLabelDatastore and combine with the image datastore.

    blds = boxLabelDatastore(labelData{1});
    trainingData = combine(imds, blds);
  • Semantic Segmentation — Gather PixelLabel data. Create a pixelLabelDatastore from the pixel label data files and combine with the image datastore.

    [labelData, timestamps] = gatherLabelData(gTruth, signalName, labelType.PixelLabel);
    pxds = pixelLabelDatastore(labelData{1}.PixelLabelData, classNames, pixelLabelIDs);
    trainingData = combine(imds, pxds);
  • Instance Segmentation — Gather Rectangle labels and corresponding polygon masks. Create a boxLabelDatastore for bounding boxes and a datastore for the instance masks, then combine all three with the image datastore.

    blds = boxLabelDatastore(labelData{1});
    maskds = imageDatastore(maskFiles, ReadFcn=@(x) imread(x));
    trainingData = combine(imds, blds, maskds);

For a complete example of extracting label data and writing frames, see the gatherLabelData reference page.

Explore Exported Ground Truth

After exporting the ground truth data to the workspace, you can explore the groundTruthMultiSensor object properties:

  • DataSource — A MultiSignalSource array containing the data source information for each loaded signal.

  • LabelDefinitions — A table containing the label definitions, including label names, types, groups and semantic IDs.

  • ROILabelData — A vision.labeler.labeldata.ROILabelData object containing the ROI label data for all signals and frames.

  • SceneLabelData — A vision.labeler.labeldata.SceneLabelData object containing the scene label data.

Use the gatherLabelData function to gather label data from the ground truth object into a format suitable for training data creation.

Save and Load Projects

You can manage your labeling projects to preserve work across multiple labeling sessions.

  • Save Project — On the app toolstrip, select Save Session, and then either Save or Save As. The saved session includes the data source, label definitions, labeled ground truth, and your session preferences such as the app layout.

  • New Project — Click New Session to start a new session. Specify a session folder in the dialog box that opens.

  • Open Project — Click Open Session and select one of the listed recent sessions, or navigate to the folder of a previous session. You can also open legacy Ground Truth Labeler project files (.prj or .mat) and Lidar Labeler session files.

See Also

| | |

Topics