Update app.py
Browse files
app.py
CHANGED
@@ -49,13 +49,13 @@ def visualize(hr, lr, recon):
|
|
49 |
window = np.hanning(window_size)
|
50 |
|
51 |
stft_hr = librosa.core.spectrum.stft(hr, n_fft=window_size, hop_length=512, window=window)
|
52 |
-
stft_hr = 2 * np.abs(stft_hr) / np.sum(window)
|
53 |
|
54 |
stft_lr = librosa.core.spectrum.stft(lr, n_fft=window_size, hop_length=512, window=window)
|
55 |
-
stft_lr = 2 * np.abs(stft_lr) / np.sum(window)
|
56 |
|
57 |
stft_recon = librosa.core.spectrum.stft(recon, n_fft=window_size, hop_length=512, window=window)
|
58 |
-
stft_recon = 2 * np.abs(stft_recon) / np.sum(window)
|
59 |
|
60 |
fig, (ax1, ax2, ax3) = plt.subplots(3, 1, sharey=True, sharex=True, figsize=(16, 12))
|
61 |
ax1.title.set_text('Оригинальный сигнал')
|
@@ -63,9 +63,9 @@ def visualize(hr, lr, recon):
|
|
63 |
ax3.title.set_text('Улучшенный сигнал')
|
64 |
|
65 |
canvas = FigureCanvas(fig)
|
66 |
-
p = librosa.display.specshow(librosa.amplitude_to_db(stft_hr), ax=ax1, y_axis='log', x_axis='time', sr=sr)
|
67 |
-
p = librosa.display.specshow(librosa.amplitude_to_db(stft_lr), ax=ax2, y_axis='log', x_axis='time', sr=sr)
|
68 |
-
p = librosa.display.specshow(librosa.amplitude_to_db(stft_recon), ax=ax3, y_axis='log', x_axis='time', sr=sr)
|
69 |
return fig
|
70 |
|
71 |
packet_size = CONFIG.DATA.EVAL.packet_size
|
|
|
49 |
window = np.hanning(window_size)
|
50 |
|
51 |
stft_hr = librosa.core.spectrum.stft(hr, n_fft=window_size, hop_length=512, window=window)
|
52 |
+
#stft_hr = 2 * np.abs(stft_hr) / np.sum(window)
|
53 |
|
54 |
stft_lr = librosa.core.spectrum.stft(lr, n_fft=window_size, hop_length=512, window=window)
|
55 |
+
#stft_lr = 2 * np.abs(stft_lr) / np.sum(window)
|
56 |
|
57 |
stft_recon = librosa.core.spectrum.stft(recon, n_fft=window_size, hop_length=512, window=window)
|
58 |
+
#stft_recon = 2 * np.abs(stft_recon) / np.sum(window)
|
59 |
|
60 |
fig, (ax1, ax2, ax3) = plt.subplots(3, 1, sharey=True, sharex=True, figsize=(16, 12))
|
61 |
ax1.title.set_text('Оригинальный сигнал')
|
|
|
63 |
ax3.title.set_text('Улучшенный сигнал')
|
64 |
|
65 |
canvas = FigureCanvas(fig)
|
66 |
+
p = librosa.display.specshow(librosa.amplitude_to_db(stft_hr, ref=np.max), ax=ax1, y_axis='log', x_axis='time', sr=sr)
|
67 |
+
p = librosa.display.specshow(librosa.amplitude_to_db(stft_lr, ref=np.max), ax=ax2, y_axis='log', x_axis='time', sr=sr)
|
68 |
+
p = librosa.display.specshow(librosa.amplitude_to_db(stft_recon, ref=np.max), ax=ax3, y_axis='log', x_axis='time', sr=sr)
|
69 |
return fig
|
70 |
|
71 |
packet_size = CONFIG.DATA.EVAL.packet_size
|