-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathtest.py
More file actions
73 lines (62 loc) · 3.39 KB
/
test.py
File metadata and controls
73 lines (62 loc) · 3.39 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# coding=utf-8
from evaluation import *
import sys
import argparse
cfg = {'file_dir': './',
'overlapRatio': 0.5,
'cls': 2,
'presicion': False,
'recall': False,
'threshold': 0.5,
'FPPIW': False,
'roc': False,
'pr': False}
def parse_args():
"""Parse input arguments."""
parser = argparse.ArgumentParser(description='Detection Results Test!')
parser.add_argument('-dir', dest='dir', nargs='+', help='Two folders with detection results and ground truth in '
'each of them, put detection path in front', type=str)
parser.add_argument('-ratio', dest='overlapRatio', help='Should be in [0, 1], float type, which means the IOU '
'threshold, default = 0.5', default=0.5, type=float)
parser.add_argument('-thre', dest='threshold', help='Should be in [0, 1], float type, if you need [precision] '
', [recall], [FPPI] or [FPPW], default = 0.7', default=0.6, type=float)
parser.add_argument('-cls', dest='cls', help='Should be > 1, which means number of categories(background included),'
'default = 2', default=2, type=int)
parser.add_argument('-prec', dest='precision', help='Should be True or False, which means return precision or not, '
'default = True', default=True, type=bool)
parser.add_argument('-rec', dest='recall', help='Should be True or False, which means return recall or not, '
'default = True', default=True, type=bool)
parser.add_argument('-FPPIW', dest='FPPIW', help='Should be True or False, which means return FPPI and FPPW or not,'
'default = True', default=True, type=bool)
parser.add_argument('-roc', dest='roc', help='Should be True or False, which means drawing ROC curve or not, '
'default = True', default=True, type=bool)
parser.add_argument('-pr', dest='pr', help='Should be True or False, which means drawing PR curve or not, '
'default = True', default=True, type=bool)
args_in = parser.parse_args()
return args_in
if __name__ == "__main__":
args = parse_args()
args.dir = ['/Users/wangzhe/data/zhengdanongmu/eval/voc_coco_only/converted_voc_coco_only', '/Users/wangzhe/data/zhengdanongmu/eval/voc_coco_only/gt_voc_coco']
args.cls = 4
args.overlapRatio = 0.5
args.threshold = 0.5
len(sys.argv)
print ("Your Folder's path: {}".format(args.dir))
print ("Overlap Ratio: {}".format(args.overlapRatio))
print ("Threshold: {}".format(args.threshold))
print ("Num of Categories: {}".format(args.cls))
print ("Precision: {}".format(args.precision))
print ("Recall: {}".format(args.recall))
print ("FPPIW: {}".format(args.FPPIW))
print("Calculating......")
cfg['file_dir'] = args.dir
cfg['overlapRatio'] = args.overlapRatio
cfg['cls'] = args.cls
cfg['precision'] = args.precision
cfg['recall'] = args.recall
cfg['threshold'] = args.threshold
cfg['FPPIW'] = args.FPPIW
cfg['roc'] = args.roc
cfg['pr'] = args.pr
eval = evaluation(cfg)
eval.run()