def one_to_one_matching(pred_infos, gt_infos, keys=('scene_id', 'view_id'), allow_pred_missing=False):
    keys = list(keys)
    pred_infos['pred_id'] = np.arange(len(pred_infos))
    gt_infos['gt_id'] = np.arange(len(gt_infos))
    matches = pred_infos.merge(gt_infos, on=keys)
    matches_gb = matches.groupby(keys).groups
    assert all([(len(v) == 1) for v in matches_gb.values()])
    if (not allow_pred_missing):
        assert (len(matches) == len(gt_infos))
    return matches
def one_to_one_matching(pred_infos, gt_infos, keys=('scene_id', 'view_id'), allow_pred_missing=False):
    keys = list(keys)
    pred_infos['pred_id'] = np.arange(len(pred_infos))
    gt_infos['gt_id'] = np.arange(len(gt_infos))
    matches = pred_infos.merge(gt_infos, on=keys)
    matches_gb = matches.groupby(keys).groups
    assert all([(len(v) == 1) for v in matches_gb.values()])
    if (not allow_pred_missing):
        assert (len(matches) == len(gt_infos))
    return matches