Main Content

trainVoxelRCNNObjectDetector

Train Voxel R-CNN object detector for lidar data

Since R2024b

Description

Train a Detector

trainedDetector = trainVoxelRCNNObjectDetector(trainingData,detector,options) trains an untrained or pretrained voxel region-based convolutional neural network (Voxel R-CNN) object detector, specified by detector, on the training data trainingData, and returns the trained detector trainedDetector. The options input specifies training parameters for the detection network. You can use this syntax to fine-tune a pretrained Voxel R-CNN object detector.

To use this function, your system must have a CUDA® enabled NVIDIA® GPU. For information on the supported compute capabilities, see GPU Computing Requirements (Parallel Computing Toolbox).

Resume Training a Detector

trainedDetector = trainVoxelRCNNObjectDetector(trainingData,checkpoint,options) resumes training from the saved checkpoint specified by checkpoint.

You can use this syntax to:

  • Add more training data and continue training.

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

Additional Option

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

Input Arguments

collapse all

Training data, specified as a valid datastore object. You must configure datastore object such that using the read function on the datastore object returns a cell array with three columns. Each row corresponds to a point cloud, and the columns must follow this format.

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

  • Second column — Bounding boxes, specified as a cell array containing an M-by-9 matrix. Each row of the matrix is of the form [x y z length width height roll pitch yaw], representing the location and dimensions of a bounding box. M is the number of bounding boxes in the corresponding point cloud.

  • Third column — Labels, specified as a cell array containing an M-by-1 categorical vector with object class names. Each element of the vector specifies the class of the corresponding bounding box. All categorical data returned by the datastore must use the same pool of categories.

You can use the combine function to combine two or more datastores. For more information on creating datastore objects, see the datastore function.

You can generate input training data from labeled ground truth samples by using the lidarObjectDetectorTrainingData function.

Voxel R-CNN object detector, specified as a voxelRCNNObjectDetector object.

  • You can train an untrained object detector using the specified training options options.

  • You can continue training a pretrained detector with additional training data, or perform more training iterations to improve detector accuracy.

Training options, specified as a TrainingOptionsADAM object returned by the trainingOptions (Deep Learning Toolbox) function. To specify the solver name and other options for network training, use the trainingOptions (Deep Learning Toolbox) function.

The voxelRCNNObjectDetector function supports only these training options for the trainingOptions name-value arguments:

  • MonitoringPlots, Verbose, and VerboseFrequency

  • Stochastic Solver OptionsMaxEpochs, MiniBatchSize, Shuffle, and InitialLearnRate

  • ValidationValidationData and ValidationFrequency

  • Regularization and NormalizationL2Regularization

  • Hardware and AccelerationPreprocessingEnvironment as "serial" and "parallel"

  • CheckpointsCheckpointPath, CheckpointFrequency, and CheckpointFrequencyUnit as "epoch"

Saved detector checkpoint, specified as a voxelRCNNObjectDetector object. To periodically save a detector checkpoint during training, specify the CheckpointPath name-value argument of trainingOptions when creating your training options object. To control how frequently the function saves checkpoints, use the CheckPointFrequency and CheckPointFrequencyUnit name-value arguments when creating your training options.

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

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

The name of the MAT file includes the iteration number and timestamp of when the detector checkpoint was saved. The MAT file saves the detector in the detector variable. To continue training, specify the network extracted from the file to the trainVoxelRCNNObjectDetector function.

trainedDetector = trainVoxelRCNNObjectDetector(trainingData,checkpoint,options);

Output Arguments

collapse all

Trained Voxel R-CNN object detector, returned as a voxelRCNNObjectDetector object.

Training progress information, returned as a structure array 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 the ValidationLoss field only when options specifies validation data.

Version History

Introduced in R2024b