代码生成使用PointPillars激光雷达目标检测的深度学习
这个例子展示了如何生成CUDA®墨西哥人PointPillars对象探测器。有关更多信息,请参见激光雷达三维物体探测使用PointPillars深度学习激光雷达工具箱™的例子。
第三方的先决条件
要求
CUDA启用NVIDIA GPU®和兼容的驱动程序。
可选
等non-MEX建立静态和动态库或可执行文件,这个例子有以下额外的需求。
NVIDIA CUDA工具包。
英伟达cuDNN图书馆。
环境变量的编译器和库。有关更多信息,请参见第三方硬件(GPU编码器)和设置必备产品下载188bet金宝搏(GPU编码器)。
验证GPU环境
验证编译器和库设置正确,运行这个示例使用coder.checkGpuInstall
(GPU编码器)函数。
envCfg = coder.gpuEnvConfig (“主机”);envCfg。DeepLibTarget =“cudnn”;envCfg。DeepCodegen = 1;envCfg。安静= 1;coder.checkGpuInstall (envCfg);
Pretrained PointPillars网络
加载pretrainedpointPillarsObjectDetector
训练有素的激光雷达三维物体探测使用PointPillars深度学习的例子。自己训练检测器,明白了激光雷达三维物体探测使用PointPillars深度学习。
matFile =“pretrainedPointPillarsDetector.mat”;pretrainedDetector =负载(“pretrainedPointPillarsDetector.mat”,“探测器”);探测器= pretrainedDetector.detector;
pointpillarsDetect
入口点函数
的pointpillarsDetect
入口点函数的点云和信心阈值作为输入,并将它们传递到一个训练有素的pointPillarsObjectDetector
预测通过pointpillarDetect
函数。的pointpillarsDetect
函数将探测器从垫文件对象加载到一个持久变量和重用后续预测持久对象调用。
类型(“pointpillarsDetect.m”)
函数[bboxes、分数、标签]= pointpillarsDetect (matFile, dataLoc dataInt,阈值)%预测网络的输出和提取的信心,x, y, %宽度,高度,和类。%的深入学习网络负载预测持续pointPillarObj;如果isempty (pointPillarObj) pointPillarObj = coder.loadDeepLearningNetwork (matFile);结束ptCloud = pointCloud (dataLoc“强度”,dataInt);[bboxes、分数、标签]= pointPillarObj.detect (ptCloud,阈值,阈值);结束
评估对象的检测器检测
读点云。
电脑= pcread (“pandasetDrivingData.pcd”);
使用pretrained检测器的检测方法。
confidenceThreshold = 0.7;(bboxes、~、标签)=检测(探测器,电脑,“阈值”,confidenceThreshold);bboxesCar = bboxes(标签= =“汽车”:);bboxesTruck = bboxes(标签= =“卡车”:);
显示点云上的检测。
helperDisplay3DBoxesOverlaidPointCloud (pc.Location bboxesCar,“绿色”,…bboxesTruck,“红色”,“预测边界框”);
生成CUDA MEXscatter
生成CUDA®代码pointpillarsDetect
入口点函数,创建一个GPU代码配置对象为一个墨西哥人的目标和目标语言设置为c++。使用coder.DeepLearningConfig
(GPU编码器)函数创建一个cuDNN深度学习配置对象,并将其分配给DeepLearningConfig
GPU代码配置对象的属性。
cfg = coder.gpuConfig (墨西哥人的);cfg。TargetLang =“c++”;cfg。DeepLearningConfig = coder.DeepLearningConfig (TargetLibrary =“cudnn”);dataLoc = pc.Location;dataInt = pc.Intensity;args = {coder.Constant (matFile)编码器。typeof (dataLoc[正无穷,3],[1 0])编码器。typeof (dataInt[正无穷,1],[1 0])coder.typeof (confidenceThreshold)};codegen配置cfgpointpillarsDetectarg游戏arg游戏报告
代码生成成功:查看报告
运行生成的墨西哥人
调用生成的点云的CUDA墨西哥人。显示结果。
(bboxes、~、标签)= pointpillarsDetect_mex (matFile、dataLoc dataInt, confidenceThreshold);bboxesCar = bboxes(标签= =“汽车”:);bboxesTruck = bboxes(标签= =“卡车”:);helperDisplay3DBoxesOverlaidPointCloud (pc.Location bboxesCar,“绿色”,…bboxesTruck,“红色”,“预测边界框”);
辅助函数
函数helperDisplay3DBoxesOverlaidPointCloud (ptCld labelsCar carColor,…labelsTruck、truckColor titleForFigure)%显示不同颜色的边框为不同的点云%的类图;ax = pcshow (ptCld);showShape (“长方体”labelsCar,“父”ax,“不透明度”,0.1,“颜色”,…carColor,“线宽”,0.5);持有在;showShape (“长方体”labelsTruck,“父”ax,“不透明度”,0.1,“颜色”,…truckColor,“线宽”,0.5);标题(titleForFigure);变焦(ax, 1.5);结束
引用
[1]朗,亚历克斯·H。,Sourabh Vora, Holger Caesar, Lubing Zhou, Jiong Yang, and Oscar Beijbom. "PointPillars: Fast Encoders for Object Detection From Point Clouds."2019年IEEE / CVF计算机视觉与模式识别会议(CVPR),12689 - 12697。美国长滩,CA: IEEE 2019。https://doi.org/10.1109/CVPR.2019.01298。
[2]Hesai和规模。PandaSet。https://scale.com/open-datasets/pandaset。