forked from Finspire13/RL-Surgical-Gesture-Segmentation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexport_csv.py
35 lines (24 loc) · 823 Bytes
/
export_csv.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
import numpy as np
import os
import pdb
# To be modified
datasets = os.listdir('./result')
for dataset in datasets:
file = open('summary_{}.csv'.format(dataset),'w')
result_dir = os.path.join('./result', dataset)
entries = os.listdir(result_dir)
entries.sort()
for entry in entries:
if 'run_' in entry:
continue
result_file = os.path.join(result_dir, entry)
if entry.startswith('trpo'):
entry_result = np.load(result_file).mean(0).mean(0).mean(0).mean(0)
elif entry.startswith('tcn'):
entry_result = np.load(result_file).mean(0).mean(0)
line = str(entry)
for i in range(len(entry_result)):
line += ','
line += str(entry_result[i])
line += '\n'
file.write(line)