(points,
                  voxel_size,
                  coors_range,
                  with_reflectivity=False,
                  density_norm_num=16,
                  max_voxels=40000)
return bev_map
convert kitti points(N, 4) to a bev map. return [C, H, W] map.
    this function based on algorithm in points_to_voxel.
    takes 5ms in a reduced pointcloud with voxel_size=[0.1, 0.1, 0.8]

    Args:
        points: [N, ndim] float tensor. points[:, :3] contain xyz points and
            points[:, 3] contain reflectivity.
        voxel_size: [3] list/tuple or array, float. xyz, indicate voxel size
        coors_range: [6] list/tuple or array, float. indicate voxel range.
            format: xyzxyz, minmax
        with_reflectivity: bool. if True, will add a intensity map to bev map.
    Returns:
        bev_map: [num_height_maps + 1(2), H, W] float tensor. 
            `WARNING`: bev_map[-1] is num_points map, NOT density map, 
            because calculate density map need more time in cpu rather than gpu. 
            if with_reflectivity is True, bev_map[-2] is intensity map.
convert kitti points(N, 4) to a bev map. return [C, H, W] map.
    this function based on algorithm in points_to_voxel.
    takes 5ms in a reduced pointcloud with voxel_size=[0.1, 0.1, 0.8]
convert kitti points ( N 4 ) to a bev map . return [ C H W ] map . this function based on algorithm in points_to_voxel . takes 5ms in a reduced pointcloud with voxel_size = [ 0 . 1 0 . 1 0 . 8 ]
def points_to_bev(points,
                  voxel_size,
                  coors_range,
                  with_reflectivity=False,
                  density_norm_num=16,
                  max_voxels=40000):
    """convert kitti points(N, 4) to a bev map. return [C, H, W] map.
    this function based on algorithm in points_to_voxel.
    takes 5ms in a reduced pointcloud with voxel_size=[0.1, 0.1, 0.8]

    Args:
        points: [N, ndim] float tensor. points[:, :3] contain xyz points and
            points[:, 3] contain reflectivity.
        voxel_size: [3] list/tuple or array, float. xyz, indicate voxel size
        coors_range: [6] list/tuple or array, float. indicate voxel range.
            format: xyzxyz, minmax
        with_reflectivity: bool. if True, will add a intensity map to bev map.
    Returns:
        bev_map: [num_height_maps + 1(2), H, W] float tensor. 
            `WARNING`: bev_map[-1] is num_points map, NOT density map, 
            because calculate density map need more time in cpu rather than gpu. 
            if with_reflectivity is True, bev_map[-2] is intensity map. 
    """
    if not isinstance(voxel_size, np.ndarray):
        voxel_size = np.array(voxel_size, dtype=points.dtype)
    if not isinstance(coors_range, np.ndarray):
        coors_range = np.array(coors_range, dtype=points.dtype)
    voxelmap_shape = (coors_range[3:] - coors_range[:3]) / voxel_size
    voxelmap_shape = tuple(np.round(voxelmap_shape).astype(np.int32).tolist())
    voxelmap_shape = voxelmap_shape[::-1]  # DHW format
    coor_to_voxelidx = -np.ones(shape=voxelmap_shape, dtype=np.int32)
    # coors_2d = np.zeros(shape=(max_voxels, 2), dtype=np.int32)
    bev_map_shape = list(voxelmap_shape)
    bev_map_shape[0] += 1
    height_lowers = np.linspace(
        coors_range[2], coors_range[5], voxelmap_shape[0], endpoint=False)
    if with_reflectivity:
        bev_map_shape[0] += 1
    bev_map = np.zeros(shape=bev_map_shape, dtype=points.dtype)
    _points_to_bevmap_reverse_kernel(points, voxel_size, coors_range,
                                     coor_to_voxelidx, bev_map, height_lowers,
                                     with_reflectivity, max_voxels)
    # print(voxel_num)
    return bev_map
def points_to_bev ( points , voxel_size , coors_range , with_reflectivity = False , density_norm_num = 16 , max_voxels = 40000 ) : if not isinstance ( voxel_size , np . ndarray ) : voxel_size = np . array ( voxel_size , dtype = points . dtype ) if not isinstance ( coors_range , np . ndarray ) : coors_range = np . array ( coors_range , dtype = points . dtype ) voxelmap_shape = ( coors_range [ 3 : ] - coors_range [ : 3 ] ) / voxel_size voxelmap_shape = tuple ( np . round ( voxelmap_shape ) . astype ( np . int32 ) . tolist ( ) ) voxelmap_shape = voxelmap_shape [ : : - 1 ] # DHW format coor_to_voxelidx = - np . ones ( shape = voxelmap_shape , dtype = np . int32 ) # coors_2d = np.zeros(shape=(max_voxels, 2), dtype=np.int32) bev_map_shape = list ( voxelmap_shape ) bev_map_shape [ 0 ] += 1 height_lowers = np . linspace ( coors_range [ 2 ] , coors_range [ 5 ] , voxelmap_shape [ 0 ] , endpoint = False ) if with_reflectivity : bev_map_shape [ 0 ] += 1 bev_map = np . zeros ( shape = bev_map_shape , dtype = points . dtype ) _points_to_bevmap_reverse_kernel ( points , voxel_size , coors_range , coor_to_voxelidx , bev_map , height_lowers , with_reflectivity , max_voxels ) # print(voxel_num) return bev_map