-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathviz.py
77 lines (66 loc) · 2.62 KB
/
viz.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import os
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
def plot_loss_loc_sep_acc_metrics(path, history):
fig = plt.figure()
plt.plot(history['train']['epoch'], history['train']['err'],
color='b', label='training')
plt.plot(history['val']['epoch'], history['val']['err'],
color='c', label='validation')
plt.legend()
fig.savefig(os.path.join(path, 'loss.png'), dpi=200)
plt.close('all')
fig = plt.figure()
plt.plot(history['train']['epoch'], history['train']['err_loc'],
color='b', label='training')
plt.plot(history['val']['epoch'], history['val']['err_loc'],
color='c', label='validation')
plt.legend()
fig.savefig(os.path.join(path, 'loss_loc.png'), dpi=200)
plt.close('all')
fig = plt.figure()
plt.plot(history['train']['epoch'], history['train']['err_sep'],
color='b', label='training')
plt.plot(history['val']['epoch'], history['val']['err_sep'],
color='c', label='validation')
plt.legend()
fig.savefig(os.path.join(path, 'loss_sep.png'), dpi=200)
plt.close('all')
fig = plt.figure()
plt.plot(history['train']['epoch'], history['train']['acc'],
color='b', label='training')
plt.plot(history['val']['epoch'], history['val']['acc'],
color='c', label='validation')
plt.legend()
fig.savefig(os.path.join(path, 'acc.png'), dpi=200)
plt.close('all')
fig = plt.figure()
plt.plot(history['val']['epoch'], history['val']['sdr'],
color='r', label='SDR')
plt.plot(history['val']['epoch'], history['val']['sir'],
color='g', label='SIR')
plt.plot(history['val']['epoch'], history['val']['sar'],
color='b', label='SAR')
plt.legend()
fig.savefig(os.path.join(path, 'metrics.png'), dpi=200)
plt.close('all')
def plot_loss_metrics(path, history):
fig = plt.figure()
plt.plot(history['train']['epoch'], history['train']['err'],
color='b', label='training')
plt.plot(history['val']['epoch'], history['val']['err'],
color='c', label='validation')
plt.legend()
fig.savefig(os.path.join(path, 'loss.png'), dpi=200)
plt.close('all')
fig = plt.figure()
plt.plot(history['val']['epoch'], history['val']['sdr'],
color='r', label='SDR')
plt.plot(history['val']['epoch'], history['val']['sir'],
color='g', label='SIR')
plt.plot(history['val']['epoch'], history['val']['sar'],
color='b', label='SAR')
plt.legend()
fig.savefig(os.path.join(path, 'metrics.png'), dpi=200)
plt.close('all')