Main Content

trainLidarLaneDetector

Train lane detector for lidar data

Since R2023b

Description

detector = trainLidarLaneDetector(trainingData,detector,options) trains an untrained or pretrained lidar lane detection network utilizing global feature correlation (LLDN-GFC) lane detector, specified by detector. The options input specifies training parameters for the detection network.

You can use this syntax to fine-tune a pretrained LLDN-GFC lane detector.

detector = trainLidarLaneDetector(trainingData,checkpoint,options) resumes training from the saved detector checkpoint.

You can use this syntax to:

  • Add more training data and continue training the detector.

  • Improve training accuracy by increasing the maximum number of iterations.

[detector,info] = trainLidarLaneDetector(___) returns information on training progress, such as training loss, for each iteration using any combination of arguments from previous syntaxes.

Note

This functionality requires Deep Learning Toolbox™, Lidar Toolbox™, and the Automated Driving Toolbox™ Model for Lidar Lane Detection support package. You can download and install the Automated Driving Toolbox Model for Lidar Lane Detection from Add-On Explorer. For more information about installing add-ons, see Get and Manage Add-Ons.

Input Arguments

collapse all

Training data, specified as a valid combined datastore object.

  • You must set up the data such that using the read function of the datastore object returns a 1-by-2 cell array. The columns of the cell array must follow this format.

    • First column — Organized or unorganized point cloud data, specified as a pointCloud object.

    • Second column — Labeled ground truth data of the corresponding point cloud, specified as a 1-by-Q table. Each column of the table represents a single lane class, such as lane1, lane2, or lane3. The names of the variables must match the names of the classes stored in the ClassNames property of the lidarLaneDetector object specified by detector or checkpoint. Each cell of the column must be empty or an N-by-3 matrix that specifies the [x y z] coordinates of N lane points of the corresponding lane in the point cloud data. An empty cell indicates that the point cloud does not have any lane points for the corresponding lane.

      Note

      The pretrained LLDN-GFC lane detector model can detect a maximum of six lanes, and it assumes that the ego vehicle is placed such that there are three lane boundaries on either the left or right side of it. Thus, the class labels for the left and right lane boundaries of the ego vehicle must be lane3 and lane4, respectively.

      When you train the detector with your data set, you must use consistent class labels for the lane boundaries of the ego vehicle across all point clouds in the data set.

You can use a fileDatastore object to store the point cloud data and an arrayDatastore object to store the ground truth data. Then, use the combine function to combine two or more datastores. For more information on creating datastore objects, see the datastore function.

Untrained or pretrained LLDN-GFC lane detector, specified as a lidarLaneDetector object. Use a pretrained detector to train it with additional training data, or perform more training iterations to improve detection accuracy.

Training options, specified as a TrainingOptionsADAM (Deep Learning Toolbox) object returned by the trainingOptions (Deep Learning Toolbox) function. To specify the solver name and other options for network training, use the trainingOptions function. The trainLidarLaneDetector function supports only these properties of the TrainingOptionsADAM object:

  • Plots and DisplayVerbose and VerboseFrequency

  • Mini-Batch OptionsMaxEpochs and MiniBatchSize

  • ValidationValidationData and ValidationFrequency

  • Solver OptionsInitialLearnRate.

  • Hardware OptionsDispatchInBackground, and ExecutionEnvironment as "auto", "gpu", or "cpu" options.

  • CheckpointsCheckpointPath, CheckpointFrequency, and CheckpointFrequencyUnit as "epoch".

Saved detector checkpoint, specified as a lidarLaneDetector object. To periodically save a detector checkpoint during training, specify the CheckpointPath training option. To control the frequency for saving check points, in number of epochs, specify the CheckPointFrequency training option.

To load a checkpoint for a previously trained detector, first load the corresponding MAT file from the checkpoint path. Then, extract the lane detector from the loaded data. For example, if the CheckpointPath property of your options object is "/checkpath", you can load a checkpoint MAT file for a detector named detector by using this code.

data = load("/checkpath/detector-2.mat");
checkpoint = data.detector;

The name of the MAT file includes the epoch number at which the detector checkpoint was saved. The MAT file saves the detector in the detector variable.

To resume training from the saved detector checkpoint, use this syntax.

laneDetector = trainLidarLaneDetector(trainingData,checkpoint,options);

Output Arguments

collapse all

Trained LLDN-GFC lane detector, returned as a lidarLaneDetector object.

Training progress information, returned as a structure with these fields. Each field corresponds to a stage of training.

  • TrainingLoss — Training loss at each iteration.

  • ValidationLoss — Validation loss at each iteration.

Each field is a numeric vector with one element per training iteration. If the function does not calculate a value at a specific iteration, it returns a value of NaN for that iteration. The structure contains ValidationLoss only when options specifies validation data.

Version History

Introduced in R2023b