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 4848import matplotlib .pyplot as plt
4949
5050######################################################################
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- #
5551
5652from IPython .display import Audio
57- from mir_eval import separation
5853from torchaudio .pipelines import HDEMUCS_HIGH_MUSDB_PLUS
5954from torchaudio .utils import download_asset
6055
@@ -247,10 +242,8 @@ def plot_spectrogram(stft, title="Spectrogram"):
247242
248243
249244def 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()`
254247 plot_spectrogram (stft (predicted_source )[0 ], f"Spectrogram - { source } " )
255248 return Audio (predicted_source , rate = sample_rate )
256249
You can’t perform that action at this time.
0 commit comments