Skip to content

Commit f9a3936

Browse files
committed
update csv logging
1 parent 116cfd6 commit f9a3936

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

csv_logger.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import os
22

3-
def log_csv(epoch, acc, loss):
3+
def log_csv(epoch, train_acc, val_acc, loss):
44
# check if directory exists
55
if not os.path.exists('log'):
66
os.makedirs('log')
77
with open('log/kt_log.csv', 'a') as f:
8-
f.write('{},{},{}\n'.format(epoch, acc, loss))
8+
f.write('{},{},{},{}\n'.format(epoch, train_acc, val_acc, loss))

train.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ def save_checkpoint(state, filename='checkpoint/checkpoint.pth.tar'):
128128
'optimizer': optimizer.state_dict(),
129129
'scheduler': scheduler.state_dict()
130130
})
131-
log_csv(epoch, accuracy, epoch_loss)
131+
log_csv(epoch, train_accuracy, accuracy, epoch_loss)
132132

133133
scheduler.step()
134134

0 commit comments

Comments
 (0)