SA-SSD代码阅读:
从代码的ReadMe获知数据处理使用tools/create_data.py文件。这个文件主要做三件事。
(1)调用函数create_kitti_info_file获取数据集中点云图像路径;
例如kitti_infos_train里面内容全部保存到’kitti_infos_train.pkl’文件内,kitti_infos_train包含标注点位置等信息
kitti_infos_train内容如下:
[{‘image_idx’: 0, ‘pointcloud_num_features’: 4, ‘velodyne_path’: ‘training/velodyne/000000.bin’, ‘img_path’: ‘training/image_2/000000.png’, ‘img_shape’: array([ 370, 1224], dtype=int32), ‘calib/P0’: array([[707.0493, 0. , 604.0814, 0. ],
[ 0. , 707.0493, 180.5066, 0. ],
[ 0. , 0. , 1. , 0. ],
[ 0. , 0. , 0. , 1. ]]), ‘calib/P1’: array([[ 707.0493, 0. , 604.0814, -379.7842],
[ 0. , 707.0493, 180.5066, 0. ],
[ 0. , 0. , 1. , 0. ],
[ 0. , 0. , 0. , 1. ]]), ‘calib/P2’: array([[ 7.070493e+02, 0.000000e+00, 6.040814e+02, 4.575831e+01],
[ 0.000000e+00, 7.070493e+02, 1.805066e+02, -3.454157e-01],
[ 0.000000e+00, 0.000000e+00, 1.000000e+00, 4.981016e-03],
[ 0.000000e+00, 0.000000e+00, 0.000000e+00, 1.000000e+00]]), ‘calib/P3’: array([[ 7.070493e+02, 0.000000e+00, 6.040814e+02, -3.341081e+02],
[ 0.000000e+00, 7.070493e+02, 1.805066e+02, 2.330660e+00],
[ 0.000000e+00, 0.000000e+00, 1.000000e+00, 3.201153e-03],
[ 0.000000e+00, 0.000000e+00, 0.000000e+00, 1.000000e+00]]), ‘calib/R0_rect’: array([[ 0.9999128 , 0.01009263, -0.00851193, 0. ],
[-0.01012729, 0.9999406 , -0.00403767, 0. ],
[ 0.00847068, 0.00412352, 0.9999556 , 0. ],
[ 0. , 0. , 0. , 1. ]]), ‘calib/Tr_velo_to_cam’: array([[ 0.00692796, -0.9999722 , -0.00275783, -0.02457729],
[-0.00116298, 0.00274984, -0.9999955 , -0.06127237],
[ 0.9999753 , 0.00693114, -0.0011439 , -0.3321029 ],
[ 0. , 0. , 0. , 1. ]]), ‘calib/Tr_imu_to_velo’: array([[ 9.999976e-01, 7.553071e-04, -2.035826e-03, -8.086759e-01],
[-7.854027e-04, 9.998898e-01, -1.482298e-02, 3.195559e-01],
[ 2.024406e-03, 1.482454e-02, 9.998881e-01, -7.997231e-01],
[ 0.000000e+00, 0.000000e+00, 0.000000e+00, 1.000000e+00]]), ‘annos’: {‘name’: array([‘Pedestrian’], dtype=’<U10’), ‘truncated’: array([0.]), ‘occluded’: array([0]), ‘alpha’: array([-0.2]), ‘bbox’: array([[712.4 , 143. , 810.73, 307.92]]), ‘dimensions’: array([[1.2 , 1.89, 0.48]]), ‘location’: array([[1.84, 1.47, 8.41]]), ‘rotation_y’: array([0.01]), ‘score’: array([0.]), ‘index’: array([0], dtype=int32), ‘group_ids’: array([0], dtype=int32), ‘difficulty’: array([0], dtype=int32), ‘num_points_in_gt’: array([377], dtype=int32)}},
(2)调用函数create_reduced_point_cloud获取相机视场内的点云;
remove_outside_points函数将相机视场外的点去除,去除后点云保存在velodyne_reduced文件夹下的.bin文件里
(3)调用函数create_groundtruth_database生成3D目标检测真值;
info_path=kitti_infos_trainval.pkl用于验证训练
保存在gt_database文件夹下的.bin文件里