Spaces:
Running
Running
update
Browse files
examples/spectrum_dfnet_aishell/step_3_evaluation.py
CHANGED
@@ -213,14 +213,16 @@ def main():
|
|
213 |
speech_spec: torch.Tensor = stft_power.forward(speech_wave)
|
214 |
mix_spec: torch.Tensor = stft_power.forward(mix_wave)
|
215 |
|
216 |
-
noise_spec = noise_spec[:, :-1, :]
|
217 |
-
speech_spec = speech_spec[:, :-1, :]
|
218 |
-
mix_spec = mix_spec[:, :-1, :]
|
219 |
-
|
220 |
speech_spec_complex: torch.Tensor = stft_complex.forward(speech_wave)
|
221 |
mix_spec_complex: torch.Tensor = stft_complex.forward(mix_wave)
|
222 |
# mix_spec_complex shape: [batch_size, freq_dim (257), time_steps, 2]
|
223 |
|
|
|
|
|
|
|
|
|
|
|
|
|
224 |
speech_irm = speech_spec / (noise_spec + speech_spec)
|
225 |
speech_irm = torch.pow(speech_irm, 1.0)
|
226 |
|
|
|
213 |
speech_spec: torch.Tensor = stft_power.forward(speech_wave)
|
214 |
mix_spec: torch.Tensor = stft_power.forward(mix_wave)
|
215 |
|
|
|
|
|
|
|
|
|
216 |
speech_spec_complex: torch.Tensor = stft_complex.forward(speech_wave)
|
217 |
mix_spec_complex: torch.Tensor = stft_complex.forward(mix_wave)
|
218 |
# mix_spec_complex shape: [batch_size, freq_dim (257), time_steps, 2]
|
219 |
|
220 |
+
noise_spec = noise_spec[:, :-1, :]
|
221 |
+
speech_spec = speech_spec[:, :-1, :]
|
222 |
+
mix_spec = mix_spec[:, :-1, :]
|
223 |
+
speech_spec_complex = speech_spec_complex[:, :-1, :]
|
224 |
+
mix_spec_complex = mix_spec_complex[:, :-1, :]
|
225 |
+
|
226 |
speech_irm = speech_spec / (noise_spec + speech_spec)
|
227 |
speech_irm = torch.pow(speech_irm, 1.0)
|
228 |
|