-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathparse_txtfile.py
More file actions
44 lines (40 loc) · 1.89 KB
/
parse_txtfile.py
File metadata and controls
44 lines (40 loc) · 1.89 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
import cv2
import numpy as np
if __name__ == '__main__':
txt_filepath = "/Users/yuandong/Downloads/log_eval_gp3d2.txt"
print_list = ['eval chair Average Precision',
'eval sofa Average Precision',
'eval table Average Precision',
'eval fridge Average Precision',
'eval sink Average Precision',
'eval door Average Precision',
'eval floor_lamp Average Precision',
'eval bottom_cabinet Average Precision',
'eval top_cabinet Average Precision',
'eval sofa_chair Average Precision',
'eval dryer Average Precision']
print_list_gp3d = ['eval INFO: chair Average Precision',
'eval INFO: sofa Average Precision',
'eval INFO: table Average Precision',
'eval INFO: fridge Average Precision',
'eval INFO: sink Average Precision',
'eval INFO: door Average Precision',
'eval INFO: floor_lamp Average Precision',
'eval INFO: bottom_cabinet Average Precision',
'eval INFO: top_cabinet Average Precision',
'eval INFO: sofa_chair Average Precision',
'eval INFO: dryer Average Precision']
all_ap = []
with open(txt_filepath,"r") as f:
line_list = []
for line in f.readlines():
line = line.split('\n')
line_list.append(line[0])
for print_name in print_list_gp3d:
for current_line in line_list:
if (print_name in current_line):
print(current_line)
split_file = current_line.split(print_name)
all_ap.append(float(split_file[1]))
mean_ap = np.mean(np.array(all_ap))
print("mean ap(11): ",mean_ap)