Ejemplo n.º 1
0
def prepForPredicting(fileidx, objects_to_suppress):
    data = np.fromfile(lidar_files.format(fileidx), dtype=np.float32).reshape(
        (-1, 4))[:, :3]
    calib_extrinsic = calib_extrinsics[calib_map[fileidx]].copy()
    calib_extrinsic[2, 3] += 1.65
    data = data.dot(calib_extrinsic[:3, :3].T) + calib_extrinsic[:3, 3]

    # get ground
    ground = np.load(ground_planes_by_file.format(fileidx))
    pts, tileidxs = tilePoints(data, grndstart, grndstep, grndlen)
    groundTs = planes2Transforms(ground)

    # get suppressed objects
    suppress_start, suppress_end = np.searchsorted(objects_to_suppress[:, 0],
                                                   [fileidx, fileidx + 1])
    #pts2suppress = objects_to_suppress[suppress_start:suppress_end, 1:3].copy()
    pts2suppress = np.zeros((suppress_end - suppress_start, 4))
    pts2suppress[:, :2] = objects_to_suppress[suppress_start:suppress_end, 1:3]
    pts2suppress[:,
                 2] = np.cos(objects_to_suppress[suppress_start:suppress_end,
                                                 0])
    pts2suppress[:,
                 2] = np.sin(objects_to_suppress[suppress_start:suppress_end,
                                                 0])
    return pts, tileidxs, pts2suppress, groundTs
Ejemplo n.º 2
0
    globaldetections = np.zeros(
        (nnegatives, anchorlen[0], anchorlen[1], anchorlen[2]), dtype=bool)
    detectioncount = 0

    for file_idx in files2use:
        # load relevant data
        data = np.fromfile(lidar_files.format(file_idx),
                           dtype=np.float32).reshape((-1, 4))[:, :3]
        calib_extrinsic = calib_extrinsics[calib_map[file_idx]].copy()
        calib_extrinsic[2, 3] += 1.65
        data = data.dot(calib_extrinsic[:3, :3].T) + calib_extrinsic[:3, 3]

        # get ground
        ground = np.load(ground_planes_by_file.format(file_idx))
        pts, tileidxs = tilePoints(data, grndstart, grndstep, grndlen)
        groundTs = planes2Transforms(ground)

        # get suppressed objects
        suppress_start, suppress_end = np.searchsorted(
            objects_to_suppress[:, 0], [file_idx, file_idx + 1])
        pts2suppress = objects_to_suppress[suppress_start:suppress_end,
                                           1:3].copy()
        pts2suppress = np.zeros((suppress_end - suppress_start, 4))
        pts2suppress[:, :2] = objects_to_suppress[suppress_start:suppress_end,
                                                  1:3]
        pts2suppress[:, 2] = np.cos(
            objects_to_suppress[suppress_start:suppress_end, 0])
        pts2suppress[:, 2] = np.sin(
            objects_to_suppress[suppress_start:suppress_end, 0])

        detectioncount = predictNegs(pts, tileidxs, groundTs, btsplits,