-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvisualization.py
More file actions
42 lines (34 loc) · 1.28 KB
/
visualization.py
File metadata and controls
42 lines (34 loc) · 1.28 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
from matplotlib import pyplot as plt
conv_log_path = 'main_conv.log'
deform_conv_log_path = 'main.log'
def load_data(file_path):
train_acc, test_acc = [], []
with open(file_path) as f:
lines = f.readlines()
for line in lines:
if 'accuracy' not in line:
continue
line = line.split()
train_acc.append(float(line[3].rstrip('%,')))
test_acc.append(float(line[-1].rstrip('%')))
if len(test_acc) == 70:
return train_acc, test_acc
return train_acc, test_acc
def plot_acc():
pass
def main():
conv_train_acc, conv_test_acc = load_data(conv_log_path)
deform_train_acc, deform_test_acc = load_data(deform_conv_log_path)
epochs = list(range(70))
plt.figure()
plt.plot(epochs, conv_train_acc, color='blue', linestyle='-', label='conv_train')
plt.plot(epochs, conv_test_acc, color='blue', linestyle='--', label='conv_test')
plt.plot(epochs, deform_train_acc, color='red', linestyle='-', label='deform_conv_train')
plt.plot(epochs, deform_test_acc, color='red', linestyle='--', label='deform_conv_test')
plt.legend()
plt.xlabel('Epochs')
plt.ylabel('Accuracy')
plt.show()
plt.savefig('comparision.png')
if __name__ == '__main__':
main()