Update README.md
Browse files
README.md
CHANGED
@@ -71,17 +71,23 @@ Please notice that we encourage you to read our tutorials and learn more about [
|
|
71 |
|
72 |
```python
|
73 |
from speechbrain.pretrained import SepformerSeparation as separator
|
|
|
74 |
from speechbrain.pretrained.interfaces import SNREstimator as snrest
|
|
|
75 |
import torchaudio
|
76 |
|
77 |
-
# 1-
|
78 |
-
|
79 |
-
|
|
|
|
|
|
|
80 |
|
81 |
-
#
|
82 |
snr_est_model = snrest.from_hparams(source="speechbrain/REAL-M-sisnr-estimator",savedir='pretrained_models/REAL-M-sisnr-estimator')
|
83 |
mix, fs = torchaudio.load('test_mixture.wav')
|
84 |
snrhat = snr_est_model.estimate_batch(mix, est_sources)
|
|
|
85 |
|
86 |
```
|
87 |
|
|
|
71 |
|
72 |
```python
|
73 |
from speechbrain.pretrained import SepformerSeparation as separator
|
74 |
+
from speechbrain.pretrained.interfaces import fetch
|
75 |
from speechbrain.pretrained.interfaces import SNREstimator as snrest
|
76 |
+
|
77 |
import torchaudio
|
78 |
|
79 |
+
# 1- Download a test mixture
|
80 |
+
fetch("test_mixture.wav", source="speechbrain/sepformer-whamr", savedir=".", save_filename="test_mixture.wav")
|
81 |
+
|
82 |
+
# 2- Separate the mixture with a pretrained model (sepformer-whamr in this case)
|
83 |
+
model = separator.from_hparams(source="speechbrain/sepformer-whamr", savedir='pretrained_models/sepformer-whamr')
|
84 |
+
est_sources = model.separate_file(path='test_mixture.wav')
|
85 |
|
86 |
+
# 3- Estimate the performance
|
87 |
snr_est_model = snrest.from_hparams(source="speechbrain/REAL-M-sisnr-estimator",savedir='pretrained_models/REAL-M-sisnr-estimator')
|
88 |
mix, fs = torchaudio.load('test_mixture.wav')
|
89 |
snrhat = snr_est_model.estimate_batch(mix, est_sources)
|
90 |
+
print(snrhat) # Estimates are in dB
|
91 |
|
92 |
```
|
93 |
|