(gt_annos,
                             dt_annos,
                             current_classes,
                             difficultys=[0, 1, 2],
                             z_axis=1,
                             z_center=1.0)
return {
        "result": result,
        "detail": detail,
    }
gt_annos and dt_annos must contains following keys:
        [bbox, location, dimensions, rotation_y, score]
gt_annos and dt_annos must contains following keys:
        [bbox, location, dimensions, rotation_y, score]
gt_annos and dt_annos must contains following keys : [ bbox location dimensions rotation_y score ]
def get_official_eval_result(gt_annos,
                             dt_annos,
                             current_classes,
                             difficultys=[0, 1, 2],
                             z_axis=1,
                             z_center=1.0):
    """
        gt_annos and dt_annos must contains following keys:
        [bbox, location, dimensions, rotation_y, score]
    """
    overlap_mod = np.array([[0.7, 0.5, 0.5, 0.7, 0.5, 0.7, 0.7, 0.7],
                            [0.7, 0.5, 0.5, 0.7, 0.5, 0.7, 0.7, 0.7],
                            [0.7, 0.5, 0.5, 0.7, 0.5, 0.7, 0.7, 0.7]])
    overlap_easy = np.array([[0.7, 0.5, 0.5, 0.7, 0.5, 0.5, 0.5, 0.5],
                            [0.5, 0.25, 0.25, 0.5, 0.25, 0.5, 0.5, 0.5],
                            [0.5, 0.25, 0.25, 0.5, 0.25, 0.5, 0.5, 0.5]])
    min_overlaps = np.stack([overlap_mod, overlap_easy], axis=0)  # [2, 3, 5]
    class_to_name = {
        0: 'Car',
        1: 'Pedestrian',
        2: 'Cyclist',
        3: 'Van',
        4: 'Person_sitting',
        5: 'car',
        6: 'tractor',
        7: 'trailer',
    }
    name_to_class = {v: n for n, v in class_to_name.items()}
    if not isinstance(current_classes, (list, tuple)):
        current_classes = [current_classes]
    current_classes_int = []
    for curcls in current_classes:
        if isinstance(curcls, str):
            current_classes_int.append(name_to_class[curcls])
        else:
            current_classes_int.append(curcls)
    current_classes = current_classes_int
    min_overlaps = min_overlaps[:, :, current_classes]
    result = ''
    # check whether alpha is valid
    compute_aos = False
    for anno in dt_annos:
        if anno['alpha'].shape[0] != 0:
            if anno['alpha'][0] != -10:
                compute_aos = True
            break
    metrics = do_eval_v3(
        gt_annos,
        dt_annos,
        current_classes,
        min_overlaps,
        compute_aos,
        difficultys,
        z_axis=z_axis,
        z_center=z_center)
    detail = {}
    for j, curcls in enumerate(current_classes):
        # mAP threshold array: [num_minoverlap, metric, class]
        # mAP result: [num_class, num_diff, num_minoverlap]
        class_name = class_to_name[curcls]
        detail[class_name] = {}
        for i in range(min_overlaps.shape[0]):
            mAPbbox = get_mAP(metrics["bbox"]["precision"][j, :, i])
            mAPbev = get_mAP(metrics["bev"]["precision"][j, :, i])
            mAP3d = get_mAP(metrics["3d"]["precision"][j, :, i])
            detail[class_name][f"bbox@{min_overlaps[i, 0, j]:.2f}"] = mAPbbox.tolist()
            detail[class_name][f"bev@{min_overlaps[i, 1, j]:.2f}"] = mAPbev.tolist()
            detail[class_name][f"3d@{min_overlaps[i, 2, j]:.2f}"] = mAP3d.tolist()

            result += print_str(
                (f"{class_to_name[curcls]} "
                 "AP(Average Precision)@{:.2f}, {:.2f}, {:.2f}:".format(*min_overlaps[i, :, j])))
            mAPbbox = ", ".join(f"{v:.2f}" for v in mAPbbox)
            mAPbev = ", ".join(f"{v:.2f}" for v in mAPbev)
            mAP3d = ", ".join(f"{v:.2f}" for v in mAP3d)
            result += print_str(f"bbox AP:{mAPbbox}")
            result += print_str(f"bev  AP:{mAPbev}")
            result += print_str(f"3d   AP:{mAP3d}")
            if compute_aos:
                mAPaos = get_mAP(metrics["bbox"]["orientation"][j, :, i])
                detail[class_name][f"aos"] = mAPaos.tolist()
                mAPaos = ", ".join(f"{v:.2f}" for v in mAPaos)
                result += print_str(f"aos  AP:{mAPaos}")
    return {
        "result": result,
        "detail": detail,
    }
def get_official_eval_result ( gt_annos , dt_annos , current_classes , difficultys = [ 0 , 1 , 2 ] , z_axis = 1 , z_center = 1.0 ) : overlap_mod = np . array ( [ [ 0.7 , 0.5 , 0.5 , 0.7 , 0.5 , 0.7 , 0.7 , 0.7 ] , [ 0.7 , 0.5 , 0.5 , 0.7 , 0.5 , 0.7 , 0.7 , 0.7 ] , [ 0.7 , 0.5 , 0.5 , 0.7 , 0.5 , 0.7 , 0.7 , 0.7 ] ] ) overlap_easy = np . array ( [ [ 0.7 , 0.5 , 0.5 , 0.7 , 0.5 , 0.5 , 0.5 , 0.5 ] , [ 0.5 , 0.25 , 0.25 , 0.5 , 0.25 , 0.5 , 0.5 , 0.5 ] , [ 0.5 , 0.25 , 0.25 , 0.5 , 0.25 , 0.5 , 0.5 , 0.5 ] ] ) min_overlaps = np . stack ( [ overlap_mod , overlap_easy ] , axis = 0 ) # [2, 3, 5] class_to_name = { 0 : 'Car' , 1 : 'Pedestrian' , 2 : 'Cyclist' , 3 : 'Van' , 4 : 'Person_sitting' , 5 : 'car' , 6 : 'tractor' , 7 : 'trailer' , } name_to_class = { v : n for n , v in class_to_name . items ( ) } if not isinstance ( current_classes , ( list , tuple ) ) : current_classes = [ current_classes ] current_classes_int = [ ] for curcls in current_classes : if isinstance ( curcls , str ) : current_classes_int . append ( name_to_class [ curcls ] ) else : current_classes_int . append ( curcls ) current_classes = current_classes_int min_overlaps = min_overlaps [ : , : , current_classes ] result = '' # check whether alpha is valid compute_aos = False for anno in dt_annos : if anno [ 'alpha' ] . shape [ 0 ] != 0 : if anno [ 'alpha' ] [ 0 ] != - 10 : compute_aos = True break metrics = do_eval_v3 ( gt_annos , dt_annos , current_classes , min_overlaps , compute_aos , difficultys , z_axis = z_axis , z_center = z_center ) detail = { } for j , curcls in enumerate ( current_classes ) : # mAP threshold array: [num_minoverlap, metric, class] # mAP result: [num_class, num_diff, num_minoverlap] class_name = class_to_name [ curcls ] detail [ class_name ] = { } for i in range ( min_overlaps . shape [ 0 ] ) : mAPbbox = get_mAP ( metrics [ "bbox" ] [ "precision" ] [ j , : , i ] ) mAPbev = get_mAP ( metrics [ "bev" ] [ "precision" ] [ j , : , i ] ) mAP3d = get_mAP ( metrics [ "3d" ] [ "precision" ] [ j , : , i ] ) detail [ class_name ] [ f"bbox@{min_overlaps[i, 0, j]:.2f}" ] = mAPbbox . tolist ( ) detail [ class_name ] [ f"bev@{min_overlaps[i, 1, j]:.2f}" ] = mAPbev . tolist ( ) detail [ class_name ] [ f"3d@{min_overlaps[i, 2, j]:.2f}" ] = mAP3d . tolist ( ) result += print_str ( ( f"{class_to_name[curcls]} " "AP(Average Precision)@{:.2f}, {:.2f}, {:.2f}:" . format ( * min_overlaps [ i , : , j ] ) ) ) mAPbbox = ", " . join ( f"{v:.2f}" for v in mAPbbox ) mAPbev = ", " . join ( f"{v:.2f}" for v in mAPbev ) mAP3d = ", " . join ( f"{v:.2f}" for v in mAP3d ) result += print_str ( f"bbox AP:{mAPbbox}" ) result += print_str ( f"bev  AP:{mAPbev}" ) result += print_str ( f"3d   AP:{mAP3d}" ) if compute_aos : mAPaos = get_mAP ( metrics [ "bbox" ] [ "orientation" ] [ j , : , i ] ) detail [ class_name ] [ f"aos" ] = mAPaos . tolist ( ) mAPaos = ", " . join ( f"{v:.2f}" for v in mAPaos ) result += print_str ( f"aos  AP:{mAPaos}" ) return { "result" : result , "detail" : detail , }