-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy patheval_mot20.py
81 lines (57 loc) · 2.43 KB
/
eval_mot20.py
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
74
75
76
77
78
79
80
81
import glob
import os
from eval.eval import eval
if __name__ == '__main__':
dataset_path = "./data/MOT20/train"
out_path = "output/mot20"
exp_name = "val"
seqmap = os.path.join(out_path,exp_name, "val_seqmap.txt")
# 生成val_seqmap.txt文件
with open(seqmap,"w") as f:
f.write("name\n")
for file in glob.glob(os.path.join(out_path, exp_name, "*txt")):
if "MOT" not in file:
continue
f.write(f"{file.split(os.sep)[-1].split('.')[0]}\n")
HOTA,IDF1,MOTA,AssA = eval(dataset_path,out_path, seqmap, exp_name,1,False)
print(f"{HOTA}, {IDF1}, {MOTA}, {AssA}")
def eval_HOTA(wx, wy, a, vmax, dataset_path, out_path, exp_name):
seqmap = os.path.join(out_path,exp_name, "val_seqmap.txt")
# 生成val_seqmap.txt文件
with open(seqmap,"w") as f:
f.write("name\n")
for file in glob.glob(os.path.join(out_path, exp_name, "*txt")):
if "MOT" not in file:
continue
f.write(f"{file.split(os.sep)[-1].split('.')[0]}\n")
HOTA,IDF1,MOTA,AssA = eval(dataset_path,out_path, seqmap, exp_name,1,False)
sum_ = wx / 30 + wy / 30 + vmax / 3 + a / 100
HOTA = float(HOTA) - sum_ / 400
return -HOTA
def eval_AssA(wx, wy, a, vmax, dataset_path, out_path, exp_name):
seqmap = os.path.join(out_path,exp_name, "val_seqmap.txt")
# 生成val_seqmap.txt文件
with open(seqmap,"w") as f:
f.write("name\n")
for file in glob.glob(os.path.join(out_path, exp_name, "*txt")):
if "MOT" not in file:
continue
f.write(f"{file.split(os.sep)[-1].split('.')[0]}\n")
HOTA,IDF1,MOTA,AssA = eval(dataset_path,out_path, seqmap, exp_name,1,False)
sum_ = wx / 30 + wy / 30 + vmax / 3 + a / 100
AssA = float(AssA) - sum_ / 400
return -AssA
def eval_IDF1(wx, wy, a, vmax, out_path, exp_name):
dataset_path = "./data/MOT17/train"
seqmap = os.path.join(out_path,exp_name, "val_seqmap.txt")
# 生成val_seqmap.txt文件
with open(seqmap,"w") as f:
f.write("name\n")
for file in glob.glob(os.path.join(out_path, exp_name, "*txt")):
if "MOT" not in file:
continue
f.write(f"{file.split(os.sep)[-1].split('.')[0]}\n")
HOTA,IDF1,MOTA,AssA = eval(dataset_path,out_path, seqmap, exp_name,1,False)
sum_ = wx / 30 + wy / 30 + vmax / 3 + a / 100
IDF1 = float(IDF1) - sum_ / 400
return -IDF1