def vec_iou(pred_lines, gt_lines):
    '''
        each line with 1 meter width
        pred_lines: num_preds, npts, 2
        gt_lines: num_gts, npts, 2
    '''

    num_preds = pred_lines.shape[0]
    num_gts = gt_lines.shape[0]

    pred_lines_shapely = \
        [LineString(i).buffer(1.,
            cap_style=CAP_STYLE.round, join_style=JOIN_STYLE.round)
                          for i in pred_lines]
    gt_lines_shapely =\
        [LineString(i).buffer(1.,
            cap_style=CAP_STYLE.round, join_style=JOIN_STYLE.round)
                        for i in gt_lines]

    # construct tree
    tree = STRtree(gt_lines_shapely)
    index_by_id = dict((id(pt), i) for i, pt in enumerate(gt_lines_shapely))

    iou_matrix = np.zeros((num_preds, num_gts))

    for i, pline in enumerate(pred_lines_shapely):

        for o in tree.query(pline):
            if o.intersects(pline):
                gt_id = index_by_id[id(o)]

                inter = o.intersection(pline).area
                union = o.union(pline).area
                iou_matrix[i, gt_id] = inter / union

    return iou_matrix

        each line with 1 meter width
        pred_lines: num_preds, npts, 2
        gt_lines: num_gts, npts, 2
    
projects/mmdet3d_plugin/datasets/map_utils/tpfp_chamfer.py