trainVoxelRCNNObjectDetector - Train Voxel R-CNN object detector for lidar data - MATLAB (original) (raw)
Train Voxel R-CNN object detector for lidar data
Since R2024b
Syntax
Description
Train a Detector
[trainedDetector](#mw%5F063a1649-1ed5-4fb7-9fdd-32d54f8be798) = trainVoxelRCNNObjectDetector([trainingData](#mw%5F14093dec-93a5-43a4-92ea-ba442267fad3),[detector](#mw%5F302e6c0c-03a6-41f2-a314-178169d27d11),[options](#mw%5F358f3085-e032-4ed1-962f-e4db609bc506))
trains an untrained or pretrained voxel region-based convolutional neural network (Voxel R-CNN) object detector, specified by detector
, on the training datatrainingData
, and returns the trained detectortrainedDetector
. 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](#mw%5F063a1649-1ed5-4fb7-9fdd-32d54f8be798) = trainVoxelRCNNObjectDetector([trainingData](#mw%5F14093dec-93a5-43a4-92ea-ba442267fad3),[checkpoint](#mw%5F435cc7ec-2a88-481f-a3de-68d5b118bb61),[options](#mw%5F358f3085-e032-4ed1-962f-e4db609bc506))
resumes training from the saved checkpoint specified bycheckpoint
.
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](#mw%5F063a1649-1ed5-4fb7-9fdd-32d54f8be798),[info](#mw%5Fdb3bdfb7-54ce-4830-a083-7b21b8ed1aa1)] = 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.
Note
This functionality requires Deep Learning Toolbox™, Parallel Computing Toolbox™, Lidar Toolbox™, and the Lidar Toolbox Interface for OpenPCDet Library support package. You can download and install the Lidar Toolbox Interface for OpenPCDet Library from Add-On Explorer. For more information about installing add-ons, see Get and Manage Add-Ons.
Input Arguments
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 apointCloud 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 thelidarObjectDetectorTrainingData 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:
- Monitoring —
Plots
,Verbose
, andVerboseFrequency
- Stochastic Solver Options —
MaxEpochs
,MiniBatchSize
,Shuffle
, andInitialLearnRate
- Validation —
ValidationData
andValidationFrequency
- Regularization and Normalization —
L2Regularization
- Hardware and Acceleration —
PreprocessingEnvironment
as"serial"
and"parallel"
- Checkpoints —
CheckpointPath
,CheckpointFrequency
, andCheckpointFrequencyUnit
as"epoch"
Saved detector checkpoint, specified as a voxelRCNNObjectDetector
object. To periodically save a detector checkpoint during training, specify theCheckpointPath
name-value argument oftrainingOptions
when creating your training options object. To control how frequently the function saves checkpoints, use theCheckPointFrequency
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 youroptions 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 thedetector
variable. To continue training, specify the network extracted from the file to the trainVoxelRCNNObjectDetector
function.
trainedDetector = trainVoxelRCNNObjectDetector(trainingData,checkpoint,options);
Output Arguments
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 ofNaN
for that iteration. The structure contains theValidationLoss
field only when options specifies validation data.
Version History
Introduced in R2024b
The trainVoxelRCNNObjectDetector function is no longer supported with MATLAB® Compiler™.