def get_candidate_matches(pred_infos, gt_infos, group_keys=['scene_id', 'view_id', 'label'], only_valids=True):
    pred_infos['pred_id'] = np.arange(len(pred_infos))
    gt_infos['gt_id'] = np.arange(len(gt_infos))
    group_keys = list(group_keys)
    cand_infos = pred_infos.merge(gt_infos, on=group_keys)
    if only_valids:
        cand_infos = cand_infos[cand_infos['valid']].reset_index(drop=True)
    cand_infos['cand_id'] = np.arange(len(cand_infos))
    return cand_infos
def get_candidate_matches(pred_infos, gt_infos, group_keys=['scene_id', 'view_id', 'label'], only_valids=True):
    pred_infos['pred_id'] = np.arange(len(pred_infos))
    gt_infos['gt_id'] = np.arange(len(gt_infos))
    group_keys = list(group_keys)
    cand_infos = pred_infos.merge(gt_infos, on=group_keys)
    if only_valids:
        cand_infos = cand_infos[cand_infos['valid']].reset_index(drop=True)
    cand_infos['cand_id'] = np.arange(len(cand_infos))
    return cand_infos