myEvaluation.py
def eval_and_print(detection, IOU_threshold):
    """
    Purpose: calculate args of evaluation and print
    Args: 
        detection: bndbox, rotbox, seg
    """
    if detection is DETECTION.bndbox:
        for c in categoryDict.values():
            c.eval_bdb()
        tb = PrettyTable()
        tb.field_names = ["class", "GT", "DET", "TP", "recall", "precision", "F-score"]
        for c in categoryDict.values():
            tb.add_row([c.categoryName(), c.bdb.gt_num(), c.bdb.rs_num(), c.bdb.tp_num(), c.bdb.get_recall(), c.bdb.get_precision(), c.bdb.get_Fscore()])
        tb.add_row(["mean", "", "", "", calc_mean_recall(detection), calc_mean_precision(detection), calc_mean_fscore(detection)])
        print("\n================== bndbox @IoU = {} ===================".format(IOU_threshold))
        print(tb)
        bdb_mP_list.append(calc_mean_precision(detection))
        bdb_mR_list.append(calc_mean_recall(detection))
        bdb_mF_list.append(calc_mean_fscore(detection))
    elif detection is DETECTION.rotbox:
        for c in categoryDict.values():
            c.eval_obb()
        tb = PrettyTable()
        tb.field_names = ["class", "GT", "DET", "TP", "recall", "precision", "F-score"]
        for c in categoryDict.values():
            tb.add_row([c.categoryName(), c.obb.gt_num(), c.obb.rs_num(), c.obb.tp_num(), c.obb.get_recall(), c.obb.get_precision(), c.obb.get_Fscore()])
        tb.add_row(["mean", "", "", "", calc_mean_recall(detection), calc_mean_precision(detection), calc_mean_fscore(detection)])
        print("\n================== rotbox @IoU = {} ==================".format(IOU_threshold))
        print(tb)
        obb_mP_list.append(calc_mean_precision(detection))
        obb_mR_list.append(calc_mean_recall(detection))
        obb_mF_list.append(calc_mean_fscore(detection))
    elif detection is DETECTION.seg:
        for c in categoryDict.values():
            c.eval_seg()
        tb = PrettyTable()
        tb.field_names = ["class", "GT", "DET", "TP", "recall", "precision", "F-score"]
        for c in categoryDict.values():
            tb.add_row([c.categoryName(), c.seg.gt_num(), c.seg.rs_num(), c.seg.tp_num(), c.seg.get_recall(), c.seg.get_precision(), c.seg.get_Fscore()])
        tb.add_row(["mean", "", "", "", calc_mean_recall(detection), calc_mean_precision(detection), calc_mean_fscore(detection)])
        print("\n================== seg @IoU = {} ==================".format(IOU_threshold))
        print(tb)
        seg_mP_list.append(calc_mean_precision(detection))
        seg_mR_list.append(calc_mean_recall(detection))
        seg_mF_list.append(calc_mean_fscore(detection))
    else:
        raise Exception("No Such Detection!")

    Purpose: calculate args of evaluation and print
    Args: 
        detection: bndbox, rotbox, seg
    
calculate args of evaluation and print
calculate args of evaluation and print
def eval_and_print(detection, IOU_threshold):
    if detection is DETECTION.bndbox:
        for c in categoryDict.values():
            c.eval_bdb()
        tb = PrettyTable()
        tb.field_names = ["class", "GT", "DET", "TP", "recall", "precision", "F-score"]
        for c in categoryDict.values():
            tb.add_row([c.categoryName(), c.bdb.gt_num(), c.bdb.rs_num(), c.bdb.tp_num(), c.bdb.get_recall(), c.bdb.get_precision(), c.bdb.get_Fscore()])
        tb.add_row(["mean", "", "", "", calc_mean_recall(detection), calc_mean_precision(detection), calc_mean_fscore(detection)])
        print("\n================== bndbox @IoU = {} ===================".format(IOU_threshold))
        print(tb)
        bdb_mP_list.append(calc_mean_precision(detection))
        bdb_mR_list.append(calc_mean_recall(detection))
        bdb_mF_list.append(calc_mean_fscore(detection))
    elif detection is DETECTION.rotbox:
        for c in categoryDict.values():
            c.eval_obb()
        tb = PrettyTable()
        tb.field_names = ["class", "GT", "DET", "TP", "recall", "precision", "F-score"]
        for c in categoryDict.values():
            tb.add_row([c.categoryName(), c.obb.gt_num(), c.obb.rs_num(), c.obb.tp_num(), c.obb.get_recall(), c.obb.get_precision(), c.obb.get_Fscore()])
        tb.add_row(["mean", "", "", "", calc_mean_recall(detection), calc_mean_precision(detection), calc_mean_fscore(detection)])
        print("\n================== rotbox @IoU = {} ==================".format(IOU_threshold))
        print(tb)
        obb_mP_list.append(calc_mean_precision(detection))
        obb_mR_list.append(calc_mean_recall(detection))
        obb_mF_list.append(calc_mean_fscore(detection))
    elif detection is DETECTION.seg:
        for c in categoryDict.values():
            c.eval_seg()
        tb = PrettyTable()
        tb.field_names = ["class", "GT", "DET", "TP", "recall", "precision", "F-score"]
        for c in categoryDict.values():
            tb.add_row([c.categoryName(), c.seg.gt_num(), c.seg.rs_num(), c.seg.tp_num(), c.seg.get_recall(), c.seg.get_precision(), c.seg.get_Fscore()])
        tb.add_row(["mean", "", "", "", calc_mean_recall(detection), calc_mean_precision(detection), calc_mean_fscore(detection)])
        print("\n================== seg @IoU = {} ==================".format(IOU_threshold))
        print(tb)
        seg_mP_list.append(calc_mean_precision(detection))
        seg_mR_list.append(calc_mean_recall(detection))
        seg_mF_list.append(calc_mean_fscore(detection))
    else:
        raise Exception("No Such Detection!")
def eval_and_print ( detection , IOU_threshold ) : if detection is DETECTION . bndbox : for c in categoryDict . values ( ) : c . eval_bdb ( ) tb = PrettyTable ( ) tb . field_names = [ "class" , "GT" , "DET" , "TP" , "recall" , "precision" , "F-score" ] for c in categoryDict . values ( ) : tb . add_row ( [ c . categoryName ( ) , c . bdb . gt_num ( ) , c . bdb . rs_num ( ) , c . bdb . tp_num ( ) , c . bdb . get_recall ( ) , c . bdb . get_precision ( ) , c . bdb . get_Fscore ( ) ] ) tb . add_row ( [ "mean" , "" , "" , "" , calc_mean_recall ( detection ) , calc_mean_precision ( detection ) , calc_mean_fscore ( detection ) ] ) print ( "\n================== bndbox @IoU = {} ===================" . format ( IOU_threshold ) ) print ( tb ) bdb_mP_list . append ( calc_mean_precision ( detection ) ) bdb_mR_list . append ( calc_mean_recall ( detection ) ) bdb_mF_list . append ( calc_mean_fscore ( detection ) ) elif detection is DETECTION . rotbox : for c in categoryDict . values ( ) : c . eval_obb ( ) tb = PrettyTable ( ) tb . field_names = [ "class" , "GT" , "DET" , "TP" , "recall" , "precision" , "F-score" ] for c in categoryDict . values ( ) : tb . add_row ( [ c . categoryName ( ) , c . obb . gt_num ( ) , c . obb . rs_num ( ) , c . obb . tp_num ( ) , c . obb . get_recall ( ) , c . obb . get_precision ( ) , c . obb . get_Fscore ( ) ] ) tb . add_row ( [ "mean" , "" , "" , "" , calc_mean_recall ( detection ) , calc_mean_precision ( detection ) , calc_mean_fscore ( detection ) ] ) print ( "\n================== rotbox @IoU = {} ==================" . format ( IOU_threshold ) ) print ( tb ) obb_mP_list . append ( calc_mean_precision ( detection ) ) obb_mR_list . append ( calc_mean_recall ( detection ) ) obb_mF_list . append ( calc_mean_fscore ( detection ) ) elif detection is DETECTION . seg : for c in categoryDict . values ( ) : c . eval_seg ( ) tb = PrettyTable ( ) tb . field_names = [ "class" , "GT" , "DET" , "TP" , "recall" , "precision" , "F-score" ] for c in categoryDict . values ( ) : tb . add_row ( [ c . categoryName ( ) , c . seg . gt_num ( ) , c . seg . rs_num ( ) , c . seg . tp_num ( ) , c . seg . get_recall ( ) , c . seg . get_precision ( ) , c . seg . get_Fscore ( ) ] ) tb . add_row ( [ "mean" , "" , "" , "" , calc_mean_recall ( detection ) , calc_mean_precision ( detection ) , calc_mean_fscore ( detection ) ] ) print ( "\n================== seg @IoU = {} ==================" . format ( IOU_threshold ) ) print ( tb ) seg_mP_list . append ( calc_mean_precision ( detection ) ) seg_mR_list . append ( calc_mean_recall ( detection ) ) seg_mF_list . append ( calc_mean_fscore ( detection ) ) else : raise Exception ( "No Such Detection!" )
Purpose: calculate args of evaluation and print
Purpose : calculate args of evaluation and print
"""
    Purpose: calculate args of evaluation and print
    Args: 
        detection: bndbox, rotbox, seg
    """
detection
bndbox, rotbox, seg
bndbox rotbox seg
IOU_threshold