第一步
安装mmdetection3D
第二步
将rosbag保存为n行4列的pcd,第四列为强度
inpoly_points_np_4=inpoly_points_np[:, :4] #mmdetect3D只能推理(n,4)的bin点云
attributes = inpoly_points_np[:, 3]
inpoly_points_np = inpoly_points_np[:, :3]
# 将numpy点云转换为Open3D点云对象
inpoly_pcd = o3d.geometry.PointCloud()
inpoly_pcd.points = o3d.utility.Vector3dVector(inpoly_points_np)
inpoly_pcd.colors = o3d.utility.Vector3dVector(np.tile(attributes[:, np.newaxis], (1, 3)))
# 保存点云到PCD文件
o3d.io.write_point_cloud("inpoly_point_cloud.pcd", inpoly_pcd, write_ascii=True)
第三步
根据mmdetection3D文档中的转化代码,将自己的pcd文件转化为可以检测的.bin
第四步
运行检测
(openmmlab) han@han:~/Desktop/hxb_projects/mmdetection3d$ python demo/pcd_demo.py /home/han/Desktop/hxb_projects/FPP_deploy/2024-6-5/ws_livox_0605/ws_livox/mmdet3d_inpoly_point_cloud_data.bin configs/pointpillars/pointpillars_hv_secfpn_8xb6-160e_kitti-3d-car.py hv_pointpillars_secfpn_6x8_160e_kitti-3d-car_20220331_134606-d42d15ed.pth --show