File tree Expand file tree Collapse file tree 1 file changed +2
-9
lines changed Expand file tree Collapse file tree 1 file changed +2
-9
lines changed Original file line number Diff line number Diff line change 48
48
import matplotlib .pyplot as plt
49
49
50
50
######################################################################
51
- # In addition to ``torchaudio``, ``mir_eval`` is required to perform
52
- # signal-to-distortion ratio (SDR) calculations. To install ``mir_eval``
53
- # please use ``pip3 install mir_eval``.
54
- #
55
51
56
52
from IPython .display import Audio
57
- from mir_eval import separation
58
53
from torchaudio .pipelines import HDEMUCS_HIGH_MUSDB_PLUS
59
54
from torchaudio .utils import download_asset
60
55
@@ -247,10 +242,8 @@ def plot_spectrogram(stft, title="Spectrogram"):
247
242
248
243
249
244
def output_results (original_source : torch .Tensor , predicted_source : torch .Tensor , source : str ):
250
- print (
251
- "SDR score is:" ,
252
- separation .bss_eval_sources (original_source .detach ().numpy (), predicted_source .detach ().numpy ())[0 ].mean (),
253
- )
245
+ # If you have installed the mir_eval package, you can calculate the SDR score with
246
+ # `mir_eval.separation.bss_eval_sources(original_source.detach().numpy(), predicted_source.detach().numpy())[0].mean()`
254
247
plot_spectrogram (stft (predicted_source )[0 ], f"Spectrogram - { source } " )
255
248
return Audio (predicted_source , rate = sample_rate )
256
249
You can’t perform that action at this time.
0 commit comments