def main(): from core.kitti import KITTI, ALL_OBJECTS, CARS_ONLY DS_DIR = '/home/salam/datasets/KITTI/training' reader = KITTI(DS_DIR, CARS_ONLY) ids = reader.get_ids('train') for t in [ids[4]]: img = reader.get_image(t) pts, ref = reader.get_velo(t, use_fov_filter=False) boxes_2D = reader.get_boxes_2D(t) boxes_3D = reader.get_boxes_3D(t) P2 = reader.get_calib(t)[2] for b in boxes_3D: b.text = f"{np.random.uniform(0.0, 1.0, (1,))[0]:0.2f}" imshow(bev(pts, pred_boxes=boxes_3D, title="GT"))
print('world_pts.shape', world_pts.shape) print('nearest.shape ', nearest.shape) geo_feature = nearest - world_pts nearest_projected = project(P2, nearest).astype( np.int32).T // image_downsampling_factor return { 'mapping': nearest_projected.reshape((bev_length, bev_width, 2)), 'geo_feature': geo_feature.reshape((bev_length, bev_width, 3)) } for i, id in enumerate(train_ids + val_ids): pc, _ = kitti.get_velo(id, workspace_lim=((-40, 40), (-1, 3), (0, 70)), use_fov_filter=True) _, _, P2 = kitti.get_calib(id) # img = kitti.get_image(id) # img = cv2.resize(img, (311, 94)) # print('img.shape', img.shape) bev_shape = (448, 512) world_pts2x, nearest2x = get_nearest_neighbour(pc, bev_shape[1] // 2, bev_shape[0] // 2, 2, P2) # mapping2x[:,:,(0,1)] = mapping2x[:,:,(1,0)] world_pts4x, nearest4x = get_nearest_neighbour(pc, bev_shape[1] // 4, bev_shape[0] // 4, 4, P2) # mapping4x[:,:,(0,1)] = mapping4x[:,:,(1,0)] world_pts8x, nearest8x = get_nearest_neighbour(pc, bev_shape[1] // 8, bev_shape[0] // 8, 8, P2) # mapping8x[:,:,(0,1)] = mapping8x[:,:,(1,0)]