File tree 2 files changed +13
-12
lines changed
2 files changed +13
-12
lines changed Original file line number Diff line number Diff line change @@ -48,29 +48,24 @@ def extract(paths, avg_inc=False):
48
48
raise NotImplementedError (type (data ["results" ][0 ]))
49
49
50
50
if avg_inc :
51
- accs = compute_avg_inc_acc ( accs )
51
+ raise NotImplementedError ( "Deprecated" )
52
52
53
53
runs_accs .append (accs )
54
54
55
55
return runs_accs
56
56
57
57
58
- def compute_avg_inc_acc (accs ):
58
+ def compute_avg_inc_acc (results ):
59
59
"""Computes the average incremental accuracy as defined in iCaRL.
60
60
61
61
The average incremental accuracies at task X are the average of accuracies
62
62
at task 0, 1, ..., and X.
63
63
64
- :param accs: A list of accuracies .
65
- :return: A list of average incremental accuracies .
64
+ :param accs: A list of dict for per-class accuracy at each step .
65
+ :return: A float .
66
66
"""
67
- avg_inc_accs = []
68
-
69
- for i in range (len (accs )):
70
- sub_accs = [accs [j ] for j in range (0 , i + 1 )]
71
- avg_inc_accs .append (sum (sub_accs ) / len (sub_accs ))
72
-
73
- return avg_inc_accs
67
+ tasks_accuracy = [r ["total" ] for r in results ]
68
+ return sum (tasks_accuracy ) / len (tasks_accuracy )
74
69
75
70
76
71
def aggregate (runs_accs ):
Original file line number Diff line number Diff line change @@ -18,7 +18,7 @@ def train(args):
18
18
19
19
start_time = time .time ()
20
20
_train (args )
21
- print ("Training finished in {}s." .format (time .time () - start_time ))
21
+ print ("Training finished in {}s." .format (int ( time .time () - start_time ) ))
22
22
23
23
24
24
def _train (args ):
@@ -65,6 +65,12 @@ def _train(args):
65
65
66
66
memory = model .get_memory ()
67
67
68
+ print (
69
+ "Average Incremental Accuracy: {}." .format (
70
+ results_utils .compute_avg_inc_acc (results ["results" ])
71
+ )
72
+ )
73
+
68
74
if args ["name" ]:
69
75
results_utils .save_results (results , args ["name" ])
70
76
You can’t perform that action at this time.
0 commit comments