-
Notifications
You must be signed in to change notification settings - Fork 1
/
viz.py
executable file
·30 lines (25 loc) · 971 Bytes
/
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
import os
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
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']['stft_l2'],
color='r', label='STFT_l2_distance')
plt.legend()
fig.savefig(os.path.join(path, 'metric_stft_l2_distance.png'), dpi=200)
plt.close('all')
fig = plt.figure()
plt.plot(history['val']['epoch'], history['val']['envelope_distance'],
color='b', label='envelope_distance')
plt.legend()
fig.savefig(os.path.join(path, 'metric_envelope_distance.png'), dpi=200)
plt.close('all')