(gt_annos,
                  dt_annos,
                  current_classes,
                  difficultys,
                  metric,
                  min_overlaps,
                  compute_aos=False,
                  num_parts=50)
return ret_dict
Kitti eval. support 2d/bev/3d/aos eval. support 0.5:0.05:0.95 coco AP.
    Args:
        gt_annos: dict, must from get_label_annos() in kitti_common.py
        dt_annos: dict, must from get_label_annos() in kitti_common.py
        current_class: int, 0: car, 1: pedestrian, 2: cyclist
        difficulty: int. eval difficulty, 0: easy, 1: normal, 2: hard
        metric: eval type. 0: bbox, 1: bev, 2: 3d
        min_overlap: float, min overlap. official: 
            [[0.7, 0.5, 0.5], [0.7, 0.5, 0.5], [0.7, 0.5, 0.5]] 
            format: [metric, class]. choose one from matrix above.
        num_parts: int. a parameter for fast calculate algorithm

    Returns:
        dict of recall, precision and aos
Kitti eval. support 2d/bev/3d/aos eval. support 0.5:0.05:0.95 coco AP.
    Args:
        gt_annos: dict, must from get_label_annos() in kitti_common.py
        dt_annos: dict, must from get_label_annos() in kitti_common.py
        current_class: int, 0: car, 1: pedestrian, 2: cyclist
        difficulty: int. eval difficulty, 0: easy, 1: normal, 2: hard
        metric: eval type. 0: bbox, 1: bev, 2: 3d
        min_overlap: float, min overlap. official: 
            [[0.7, 0.5, 0.5], [0.7, 0.5, 0.5], [0.7, 0.5, 0.5]] 
            format: [metric, class]. choose one from matrix above.
        num_parts: int. a parameter for fast calculate algorithm
Kitti eval . support 2d / bev / 3d / aos eval . support 0 . 5 : 0 . 05 : 0 . 95 coco AP . Args : gt_annos : dict must from get_label_annos () in kitti_common . py dt_annos : dict must from get_label_annos () in kitti_common . py current_class : int 0 : car 1 : pedestrian 2 : cyclist difficulty : int . eval difficulty 0 : easy 1 : normal 2 : hard metric : eval type . 0 : bbox 1 : bev 2 : 3d min_overlap : float min overlap . official : [[ 0 . 7 0 . 5 0 . 5 ] [ 0 . 7 0 . 5 0 . 5 ] [ 0 . 7 0 . 5 0 . 5 ]] format : [ metric class ] . choose one from matrix above . num_parts : int . a parameter for fast calculate algorithm
def eval_class_v3(gt_annos,
                  dt_annos,
                  current_classes,
                  difficultys,
                  metric,
                  min_overlaps,
                  compute_aos=False,
                  num_parts=50):
    """Kitti eval. support 2d/bev/3d/aos eval. support 0.5:0.05:0.95 coco AP.
    Args:
        gt_annos: dict, must from get_label_annos() in kitti_common.py
        dt_annos: dict, must from get_label_annos() in kitti_common.py
        current_class: int, 0: car, 1: pedestrian, 2: cyclist
        difficulty: int. eval difficulty, 0: easy, 1: normal, 2: hard
        metric: eval type. 0: bbox, 1: bev, 2: 3d
        min_overlap: float, min overlap. official: 
            [[0.7, 0.5, 0.5], [0.7, 0.5, 0.5], [0.7, 0.5, 0.5]] 
            format: [metric, class]. choose one from matrix above.
        num_parts: int. a parameter for fast calculate algorithm

    Returns:
        dict of recall, precision and aos
    """
    assert len(gt_annos) == len(dt_annos)
    num_examples = len(gt_annos)
    split_parts = get_split_parts(num_examples, num_parts)

    rets = calculate_iou_partly(dt_annos, gt_annos, metric, num_parts)
    overlaps, parted_overlaps, total_dt_num, total_gt_num = rets
    N_SAMPLE_PTS = 41
    num_minoverlap = len(min_overlaps)
    num_class = len(current_classes)
    num_difficulty = len(difficultys)
    precision = np.zeros(
        [num_class, num_difficulty, num_minoverlap, N_SAMPLE_PTS])
    recall = np.zeros(
        [num_class, num_difficulty, num_minoverlap, N_SAMPLE_PTS])
    aos = np.zeros([num_class, num_difficulty, num_minoverlap, N_SAMPLE_PTS])
    for m, current_class in enumerate(current_classes):
        for l, difficulty in enumerate(difficultys):
            rets = _prepare_data(gt_annos, dt_annos, current_class, difficulty)
            (gt_datas_list, dt_datas_list, ignored_gts, ignored_dets,
             dontcares, total_dc_num, total_num_valid_gt) = rets
            for k, min_overlap in enumerate(min_overlaps[:, metric, m]):
                thresholdss = []
                for i in range(len(gt_annos)):
                    rets = compute_statistics_jit(
                        overlaps[i],
                        gt_datas_list[i],
                        dt_datas_list[i],
                        ignored_gts[i],
                        ignored_dets[i],
                        dontcares[i],
                        metric,
                        min_overlap=min_overlap,
                        thresh=0.0,
                        compute_fp=False)
                    tp, fp, fn, similarity, thresholds = rets
                    thresholdss += thresholds.tolist()
                thresholdss = np.array(thresholdss)
                thresholds = get_thresholds(thresholdss, total_num_valid_gt)
                thresholds = np.array(thresholds)
                pr = np.zeros([len(thresholds), 4])
                idx = 0
                for j, num_part in enumerate(split_parts):
                    gt_datas_part = np.concatenate(
                        gt_datas_list[idx:idx + num_part], 0)
                    dt_datas_part = np.concatenate(
                        dt_datas_list[idx:idx + num_part], 0)
                    dc_datas_part = np.concatenate(
                        dontcares[idx:idx + num_part], 0)
                    ignored_dets_part = np.concatenate(
                        ignored_dets[idx:idx + num_part], 0)
                    ignored_gts_part = np.concatenate(
                        ignored_gts[idx:idx + num_part], 0)
                    fused_compute_statistics(
                        parted_overlaps[j],
                        pr,
                        total_gt_num[idx:idx + num_part],
                        total_dt_num[idx:idx + num_part],
                        total_dc_num[idx:idx + num_part],
                        gt_datas_part,
                        dt_datas_part,
                        dc_datas_part,
                        ignored_gts_part,
                        ignored_dets_part,
                        metric,
                        min_overlap=min_overlap,
                        thresholds=thresholds,
                        compute_aos=compute_aos)
                    idx += num_part
                for i in range(len(thresholds)):
                    recall[m, l, k, i] = pr[i, 0] / (pr[i, 0] + pr[i, 2])
                    precision[m, l, k, i] = pr[i, 0] / (pr[i, 0] + pr[i, 1])
                    if compute_aos:
                        aos[m, l, k, i] = pr[i, 3] / (pr[i, 0] + pr[i, 1])
                for i in range(len(thresholds)):
                    precision[m, l, k, i] = np.max(
                        precision[m, l, k, i:], axis=-1)
                    recall[m, l, k, i] = np.max(recall[m, l, k, i:], axis=-1)
                    if compute_aos:
                        aos[m, l, k, i] = np.max(aos[m, l, k, i:], axis=-1)
    ret_dict = {
        "recall": recall,
        "precision": precision,
        "orientation": aos,
    }
    return ret_dict
def eval_class_v3 ( gt_annos , dt_annos , current_classes , difficultys , metric , min_overlaps , compute_aos = False , num_parts = 50 ) : assert len ( gt_annos ) == len ( dt_annos ) num_examples = len ( gt_annos ) split_parts = get_split_parts ( num_examples , num_parts ) rets = calculate_iou_partly ( dt_annos , gt_annos , metric , num_parts ) overlaps , parted_overlaps , total_dt_num , total_gt_num = rets N_SAMPLE_PTS = 41 num_minoverlap = len ( min_overlaps ) num_class = len ( current_classes ) num_difficulty = len ( difficultys ) precision = np . zeros ( [ num_class , num_difficulty , num_minoverlap , N_SAMPLE_PTS ] ) recall = np . zeros ( [ num_class , num_difficulty , num_minoverlap , N_SAMPLE_PTS ] ) aos = np . zeros ( [ num_class , num_difficulty , num_minoverlap , N_SAMPLE_PTS ] ) for m , current_class in enumerate ( current_classes ) : for l , difficulty in enumerate ( difficultys ) : rets = _prepare_data ( gt_annos , dt_annos , current_class , difficulty ) ( gt_datas_list , dt_datas_list , ignored_gts , ignored_dets , dontcares , total_dc_num , total_num_valid_gt ) = rets for k , min_overlap in enumerate ( min_overlaps [ : , metric , m ] ) : thresholdss = [ ] for i in range ( len ( gt_annos ) ) : rets = compute_statistics_jit ( overlaps [ i ] , gt_datas_list [ i ] , dt_datas_list [ i ] , ignored_gts [ i ] , ignored_dets [ i ] , dontcares [ i ] , metric , min_overlap = min_overlap , thresh = 0.0 , compute_fp = False ) tp , fp , fn , similarity , thresholds = rets thresholdss += thresholds . tolist ( ) thresholdss = np . array ( thresholdss ) thresholds = get_thresholds ( thresholdss , total_num_valid_gt ) thresholds = np . array ( thresholds ) pr = np . zeros ( [ len ( thresholds ) , 4 ] ) idx = 0 for j , num_part in enumerate ( split_parts ) : gt_datas_part = np . concatenate ( gt_datas_list [ idx : idx + num_part ] , 0 ) dt_datas_part = np . concatenate ( dt_datas_list [ idx : idx + num_part ] , 0 ) dc_datas_part = np . concatenate ( dontcares [ idx : idx + num_part ] , 0 ) ignored_dets_part = np . concatenate ( ignored_dets [ idx : idx + num_part ] , 0 ) ignored_gts_part = np . concatenate ( ignored_gts [ idx : idx + num_part ] , 0 ) fused_compute_statistics ( parted_overlaps [ j ] , pr , total_gt_num [ idx : idx + num_part ] , total_dt_num [ idx : idx + num_part ] , total_dc_num [ idx : idx + num_part ] , gt_datas_part , dt_datas_part , dc_datas_part , ignored_gts_part , ignored_dets_part , metric , min_overlap = min_overlap , thresholds = thresholds , compute_aos = compute_aos ) idx += num_part for i in range ( len ( thresholds ) ) : recall [ m , l , k , i ] = pr [ i , 0 ] / ( pr [ i , 0 ] + pr [ i , 2 ] ) precision [ m , l , k , i ] = pr [ i , 0 ] / ( pr [ i , 0 ] + pr [ i , 1 ] ) if compute_aos : aos [ m , l , k , i ] = pr [ i , 3 ] / ( pr [ i , 0 ] + pr [ i , 1 ] ) for i in range ( len ( thresholds ) ) : precision [ m , l , k , i ] = np . max ( precision [ m , l , k , i : ] , axis = - 1 ) recall [ m , l , k , i ] = np . max ( recall [ m , l , k , i : ] , axis = - 1 ) if compute_aos : aos [ m , l , k , i ] = np . max ( aos [ m , l , k , i : ] , axis = - 1 ) ret_dict = { "recall" : recall , "precision" : precision , "orientation" : aos , } return ret_dict