How do I get past grid parameter restrictions when trying to create custom training data for a YOLOv4 LIDAR object detection network?

4 次查看(过去 30 天)
I have been following and modifying the example for LIDAR Complex-YOLOv4 Object Detection, and I am running into an issue when creating training data using the createTrainingData.m file. The Standard pcRange block [xMin = -25.0 xMax = 25.0 yMin = 0.0 yMax = 50.0 zMin = -7.0 and zMax = 15.0] is too small for my data set, and the origin position cuts off most of the point cloud regions I want to capture (see image ROI_within_PointCloud). I would like to adjust the pcRange to allow for an ROI as seen in the attached image DesiredROI_2D_PointCloud.
When I drop the xMin and/or yMin values below the standard, i.e. xMin < -25 and/or yMin < 0, to capture the desired region I receive the following error:
-----------------------------------------------------------------------------------------------------------
Error using sub2ind (line 71)
Out of range subscript.
Error in helper.preprocess (line 53)
mapIndices = sub2ind([bevHeight,bevWidth],locMod(:,1),locMod(:,2));
Error in createTrainingData (line 42)
[processedData,~] = helper.preprocess(ptCloud,gridParams);
----------------------------------------------------------------------------------------------------------
As far as I can tell after diving into the sub2ind function, this error is occuring due to v, the newly sorted array of points, failing this portion of the if statement: min(v,[],'all') < 1. I can adjust xMax and yMax to be larger in the positive direction and have no issues.
How do I get past this issue and move/modify the region of interest within the point cloud scene? Can I adjust the origin location of the point cloud some how? Or can I remove the restriction on expanding the ROI into the negative quadrants?
  1 个评论
Nick Angle
Nick Angle 2024-8-29
I ended up working around this by offsetting the origin of the point cloud by translating every point by an offset value as seen here:
loc = ptCloud.Location; % Create a new coordinate array that is editable
loc(:,1) = loc(:,1) - (0.5)*ptCloud.XLimits(1); % Shift all points in the X-axis
loc(:,2) = loc(:,2) - (0.5)*ptCloud.YLimits(1); % Shift all points in the Y-axis (shifting origin)
ptCloudOut = pointCloud(loc,"Color", ptCloud.Color,"Normal",ptCloud.Normal,"Intensity",ptCloud.Intensity);
Just taking the XYZ coordinates from the original point cloud and applying them to a new point cloud with a translation works, but is this the most efficient way to do this? Am I missing something with the toolbox?

请先登录,再进行评论。

采纳的回答

Milan Bansal
Milan Bansal 2024-9-9
I understand that you wish to translate your point clouds to a new orgin to select the desired region of interest.
Instead of shifting the locations mannually, you can make use of the inbuilt function pctransform which uses the rigidtform3d object to rotate and translate the point clouds. Here is how you can do it.
% Specify the amount of translation and rotation you want.
rotationAngles = [0 0 0];
translation = [2 5 6];
% Create tform object
tform = rigidtform3d(rotationAngles,translation);
% Apply pctransform
ptCloudTransformed = pctransform(ptCloud,tform);
Please refer to the following documentation links to learn more about pctransform and rigidtform3d.
Hope this helps!

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Labeling, Segmentation, and Detection 的更多信息

产品


版本

R2024a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by