-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathshow_results.py
53 lines (47 loc) · 1.96 KB
/
show_results.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
import pdb
import numpy as np
import re
import os
prependpaths = [
os.path.join("results", "results-pelu-div-mul"),
os.path.join("results", "results-bn-pelu-div-mul"),
os.path.join("results", "results-elu"),
os.path.join("results", "results-bn-elu"),
os.path.join("results", "results-bn-relu"),
os.path.join("results", "results-bn-prelu"),
os.path.join("results", "results-pelu-div-div"),
os.path.join("results", "results-pelu-mul-div"),
os.path.join("results", "results-pelu-mul-mul"),
]
depths = [110]
datasets = [
"cifar10",
"cifar100"
]
for prependpath in prependpaths:
for dataset in datasets:
medians_min = [None for _ in range(len(depths))]
medians_mean = [None for _ in range(len(depths))]
for i, depth in enumerate(depths):
errors = []
for t in range(1,6):
resultspath = os.path.join("try{:d}", dataset, "{:d}").format(t, depth)
filepath = os.path.join(prependpath, resultspath, 'nohup.out')
# print(filepath)
try:
with open(filepath, "r") as fh:
content = fh.read(-1)
cur_errors = re.findall("top1:\s*\d+\.\d+", content)
del cur_errors[-1]
cur_errors = [[float(re.findall("\d+\.\d+", i)[0])] for i in cur_errors]
cur_errors = np.array(cur_errors)
if len(cur_errors) != 200:
raise Exception("")
errors.append(cur_errors)
except:
print("Error reading {:s}".format(filepath))
if len(errors) != 0:
errors_median = np.median(np.hstack(errors), 1)
medians_mean[i] = errors_median[-5:].mean()
medians_min[i] = errors_median.min()
print("{:s} - {}: mean {}, min {}".format(prependpath, dataset, medians_mean, medians_min))