sangeet2020
commited on
Commit
•
3fd6072
1
Parent(s):
5df46bf
pusing model files
Browse files- README.md +105 -1
- brain.ckpt +3 -0
- config.json +3 -0
- decoder.ckpt +3 -0
- encoder.ckpt +3 -0
- example_rescuespeech16k.wav +0 -0
- hyperparams.yaml +195 -0
README.md
CHANGED
@@ -1,3 +1,107 @@
|
|
1 |
---
|
2 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
---
|
2 |
+
language: "de"
|
3 |
+
thumbnail:
|
4 |
+
tags:
|
5 |
+
- audio-to-audio
|
6 |
+
- Speech Enhancement
|
7 |
+
- RescueSpeech
|
8 |
+
- SepFormer
|
9 |
+
- Transformer
|
10 |
+
- pytorch
|
11 |
+
- speechbrain
|
12 |
+
license: "apache-2.0"
|
13 |
+
datasets:
|
14 |
+
- RescueSpeech
|
15 |
+
metrics:
|
16 |
+
- SI-SNR
|
17 |
+
- PESQ
|
18 |
+
- SDR
|
19 |
+
|
20 |
---
|
21 |
+
|
22 |
+
<iframe src="https://ghbtns.com/github-btn.html?user=speechbrain&repo=speechbrain&type=star&count=true&size=large&v=2" frameborder="0" scrolling="0" width="170" height="30" title="GitHub"></iframe>
|
23 |
+
<br/><br/>
|
24 |
+
|
25 |
+
# SepFormer trained on RescueSpeech for speech enhancement (16k sampling frequency)
|
26 |
+
This repository provides all the necessary tools to perform speech enhancement (denoising) with a [SepFormer](https://arxiv.org/abs/2010.13154v2) model, implemented with SpeechBrain. The model was first trained on Microsoft-DNS 4 dataset and further fine-tuned on RescueSpeech dataset 16k sampling frequency. For a better experience we encourage you to learn more about [SpeechBrain](https://speechbrain.github.io). Given below is model performance on RescueSpeech test set.
|
27 |
+
|
28 |
+
|
29 |
+
| Release | Test-Set SI-SNRi | Test-Set SI-SDRi |Test-Set PESQ |
|
30 |
+
|:-------------:|:--------------:|:--------------:|:--------------:|
|
31 |
+
| 07-01-23 | 7.849 | 8.414 | 2.24 |
|
32 |
+
|
33 |
+
where SI-SNRi and SI-SDRi indicates the improvement in SI-SNR and SI-SDR metric.
|
34 |
+
|
35 |
+
## Install SpeechBrain
|
36 |
+
|
37 |
+
First of all, please install SpeechBrain with the following command:
|
38 |
+
|
39 |
+
```
|
40 |
+
pip install speechbrain
|
41 |
+
```
|
42 |
+
|
43 |
+
Please notice that we encourage you to read our tutorials and learn more about [SpeechBrain](https://speechbrain.github.io).
|
44 |
+
|
45 |
+
### Perform speech enhancement on your own audio file
|
46 |
+
|
47 |
+
```python
|
48 |
+
from speechbrain.pretrained import SepformerSeparation as separator
|
49 |
+
import torchaudio
|
50 |
+
|
51 |
+
model = separator.from_hparams(source="speechbrain/RescueSpeech_Sepformer", savedir='pretrained_models/RescueSpeech_Sepformer')
|
52 |
+
|
53 |
+
# for custom file, change path
|
54 |
+
est_sources = model.separate_file(path='speechbrain/RescueSpeech_Sepformer/example_rescuespeech16k.wav')
|
55 |
+
|
56 |
+
torchaudio.save("enhanced_rescuespeech16k.wav.wav", est_sources[:, :, 0].detach().cpu(), 16000)
|
57 |
+
|
58 |
+
```
|
59 |
+
|
60 |
+
### Inference on GPU
|
61 |
+
To perform inference on the GPU, add `run_opts={"device":"cuda"}` when calling the `from_hparams` method.
|
62 |
+
|
63 |
+
### Limitations
|
64 |
+
The SpeechBrain team does not provide any warranty on the performance achieved by this model when used on other datasets.
|
65 |
+
|
66 |
+
#### Referencing SpeechBrain
|
67 |
+
|
68 |
+
```bibtex
|
69 |
+
@misc{speechbrain,
|
70 |
+
title={{SpeechBrain}: A General-Purpose Speech Toolkit},
|
71 |
+
author={Mirco Ravanelli and Titouan Parcollet and Peter Plantinga and Aku Rouhe and Samuele Cornell and Loren Lugosch and Cem Subakan and Nauman Dawalatabad and Abdelwahab Heba and Jianyuan Zhong and Ju-Chieh Chou and Sung-Lin Yeh and Szu-Wei Fu and Chien-Feng Liao and Elena Rastorgueva and François Grondin and William Aris and Hwidong Na and Yan Gao and Renato De Mori and Yoshua Bengio},
|
72 |
+
year={2021},
|
73 |
+
eprint={2106.04624},
|
74 |
+
archivePrefix={arXiv},
|
75 |
+
primaryClass={eess.AS},
|
76 |
+
note={arXiv:2106.04624}
|
77 |
+
}
|
78 |
+
```
|
79 |
+
|
80 |
+
|
81 |
+
#### Referencing SepFormer
|
82 |
+
```bibtex
|
83 |
+
@inproceedings{subakan2021attention,
|
84 |
+
title={Attention is All You Need in Speech Separation},
|
85 |
+
author={Cem Subakan and Mirco Ravanelli and Samuele Cornell and Mirko Bronzi and Jianyuan Zhong},
|
86 |
+
year={2021},
|
87 |
+
booktitle={ICASSP 2021}
|
88 |
+
}
|
89 |
+
```
|
90 |
+
|
91 |
+
### Referencing RescueSpeech
|
92 |
+
```bibtex
|
93 |
+
@misc{sagar2023rescuespeech,
|
94 |
+
title={RescueSpeech: A German Corpus for Speech Recognition in Search and Rescue Domain},
|
95 |
+
author={Sangeet Sagar and Mirco Ravanelli and Bernd Kiefer and Ivana Kruijff Korbayova and Josef van Genabith},
|
96 |
+
year={2023},
|
97 |
+
eprint={2306.04054},
|
98 |
+
archivePrefix={arXiv},
|
99 |
+
primaryClass={eess.AS}
|
100 |
+
}
|
101 |
+
```
|
102 |
+
|
103 |
+
|
104 |
+
# **About SpeechBrain**
|
105 |
+
- Website: https://speechbrain.github.io/
|
106 |
+
- Code: https://github.com/speechbrain/speechbrain/
|
107 |
+
- HuggingFace: https://huggingface.co/speechbrain/
|
brain.ckpt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:33809a026a2c1febce7b03c8aafaee4ddfc851b2c70f180f8c06bf1017f4df5c
|
3 |
+
size 46
|
config.json
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"speechbrain_interface": "SepformerSeparation"
|
3 |
+
}
|
decoder.ckpt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:00d272f965100f627a4a43d45dd919a7caf867372035139a91b8ece174c8b5f1
|
3 |
+
size 17195
|
encoder.ckpt
ADDED
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
1 |
+
version https://git-lfs.github.com/spec/v1
|
2 |
+
oid sha256:a04882b82c623a27af12376cc05dc0eb6cc1d59fb483bfb463d89d7d6072ac4d
|
3 |
+
size 17259
|
example_rescuespeech16k.wav
ADDED
Binary file (445 kB). View file
|
|
hyperparams.yaml
ADDED
@@ -0,0 +1,195 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Generated 2023-06-20 from:
|
2 |
+
# /netscratch/sagar/thesis/speechbrain/recipes/RescueSpeech/Enhancement/fine-tuning/hparams/sepformer_16k.yaml
|
3 |
+
# yamllint disable
|
4 |
+
# ################################
|
5 |
+
# Model: SepFormer for source separation
|
6 |
+
# https://arxiv.org/abs/2010.13154
|
7 |
+
#
|
8 |
+
# Author: Sangeet Sagar 2022
|
9 |
+
# Dataset : RescueSpeech
|
10 |
+
# ################################
|
11 |
+
|
12 |
+
# Basic parameters
|
13 |
+
# Seed needs to be set at top of yaml, before objects with parameters are made
|
14 |
+
seed: 8201
|
15 |
+
__set_seed: !apply:torch.manual_seed [8201]
|
16 |
+
experiment_name: sepformer-enhancement
|
17 |
+
output_folder: results/sepformer-enhancement/8201
|
18 |
+
train_log: results/sepformer-enhancement/8201/train_log.txt
|
19 |
+
save_folder: results/sepformer-enhancement/8201/save
|
20 |
+
|
21 |
+
# Dataset prep parameters
|
22 |
+
data_folder: ../../dataset/audio_sythesis/Task_enhancement/ # !PLACEHOLDER
|
23 |
+
csv_dir: csv_files
|
24 |
+
train_csv: csv_files/train.csv
|
25 |
+
valid_csv: csv_files/dev.csv
|
26 |
+
test_csv: csv_files/test.csv
|
27 |
+
skip_prep: false
|
28 |
+
sample_rate: 16000
|
29 |
+
task: enhance
|
30 |
+
|
31 |
+
dereverberate: false
|
32 |
+
shuffle_train_data: true
|
33 |
+
|
34 |
+
# Pretrained models
|
35 |
+
pretrained_model_path:
|
36 |
+
/netscratch/sagar/thesis/speechbrain/recipes/RescueSpeech/pre-trained/sepformer_dns_16k # !PLACEHOLDER # sepformer_dns_16k model
|
37 |
+
|
38 |
+
# Basic parameters
|
39 |
+
use_tensorboard: false
|
40 |
+
tensorboard_logs: results/sepformer-enhancement/8201/logs/
|
41 |
+
|
42 |
+
# Experiment params
|
43 |
+
auto_mix_prec: true # Set it to True for mixed precision
|
44 |
+
test_only: false
|
45 |
+
num_spks: 1
|
46 |
+
noprogressbar: false
|
47 |
+
save_audio: true # Save estimated sources on disk
|
48 |
+
downsample: false
|
49 |
+
n_audio_to_save: 500
|
50 |
+
|
51 |
+
# Training parameters
|
52 |
+
N_epochs: 150
|
53 |
+
batch_size: 1
|
54 |
+
batch_size_test: 1
|
55 |
+
lr: 0.00015
|
56 |
+
clip_grad_norm: 5
|
57 |
+
loss_upper_lim: 999999 # this is the upper limit for an acceptable loss
|
58 |
+
# if True, the training sequences are cut to a specified length
|
59 |
+
limit_training_signal_len: false
|
60 |
+
# this is the length of sequences if we choose to limit
|
61 |
+
# the signal length of training sequences
|
62 |
+
training_signal_len: 32000
|
63 |
+
ckpt_interval_minutes: 60
|
64 |
+
|
65 |
+
# Parameters for data augmentation
|
66 |
+
use_wavedrop: false
|
67 |
+
use_speedperturb: true
|
68 |
+
use_rand_shift: false
|
69 |
+
min_shift: -8000
|
70 |
+
max_shift: 8000
|
71 |
+
|
72 |
+
speedperturb: !new:speechbrain.lobes.augment.TimeDomainSpecAugment
|
73 |
+
perturb_prob: 1.0
|
74 |
+
drop_freq_prob: 0.0
|
75 |
+
drop_chunk_prob: 0.0
|
76 |
+
sample_rate: 16000
|
77 |
+
speeds: [95, 100, 105]
|
78 |
+
|
79 |
+
wavedrop: !new:speechbrain.lobes.augment.TimeDomainSpecAugment
|
80 |
+
perturb_prob: 0.0
|
81 |
+
drop_freq_prob: 1.0
|
82 |
+
drop_chunk_prob: 1.0
|
83 |
+
sample_rate: 16000
|
84 |
+
|
85 |
+
# loss thresholding -- this thresholds the training loss
|
86 |
+
threshold_byloss: true
|
87 |
+
threshold: -30
|
88 |
+
|
89 |
+
# Encoder parameters
|
90 |
+
N_encoder_out: 256
|
91 |
+
out_channels: 256
|
92 |
+
kernel_size: 16
|
93 |
+
kernel_stride: 8
|
94 |
+
|
95 |
+
# Dataloader options
|
96 |
+
dataloader_opts:
|
97 |
+
batch_size: 1
|
98 |
+
num_workers: 3
|
99 |
+
|
100 |
+
dataloader_opts_valid:
|
101 |
+
batch_size: 1
|
102 |
+
num_workers: 3
|
103 |
+
|
104 |
+
dataloader_opts_test:
|
105 |
+
batch_size: 1
|
106 |
+
num_workers: 3
|
107 |
+
|
108 |
+
# Specifying the network
|
109 |
+
Encoder: &id003 !new:speechbrain.lobes.models.dual_path.Encoder
|
110 |
+
kernel_size: 16
|
111 |
+
out_channels: 256
|
112 |
+
|
113 |
+
SBtfintra: &id001 !new:speechbrain.lobes.models.dual_path.SBTransformerBlock
|
114 |
+
num_layers: 8
|
115 |
+
d_model: 256
|
116 |
+
nhead: 8
|
117 |
+
d_ffn: 1024
|
118 |
+
dropout: 0
|
119 |
+
use_positional_encoding: true
|
120 |
+
norm_before: true
|
121 |
+
|
122 |
+
SBtfinter: &id002 !new:speechbrain.lobes.models.dual_path.SBTransformerBlock
|
123 |
+
num_layers: 8
|
124 |
+
d_model: 256
|
125 |
+
nhead: 8
|
126 |
+
d_ffn: 1024
|
127 |
+
dropout: 0
|
128 |
+
use_positional_encoding: true
|
129 |
+
norm_before: true
|
130 |
+
|
131 |
+
MaskNet: &id005 !new:speechbrain.lobes.models.dual_path.Dual_Path_Model
|
132 |
+
|
133 |
+
num_spks: 1
|
134 |
+
in_channels: 256
|
135 |
+
out_channels: 256
|
136 |
+
num_layers: 2
|
137 |
+
K: 250
|
138 |
+
intra_model: *id001
|
139 |
+
inter_model: *id002
|
140 |
+
norm: ln
|
141 |
+
linear_layer_after_inter_intra: false
|
142 |
+
skip_around_intra: true
|
143 |
+
|
144 |
+
Decoder: &id004 !new:speechbrain.lobes.models.dual_path.Decoder
|
145 |
+
in_channels: 256
|
146 |
+
out_channels: 1
|
147 |
+
kernel_size: 16
|
148 |
+
stride: 8
|
149 |
+
bias: false
|
150 |
+
|
151 |
+
optimizer: !name:torch.optim.Adam
|
152 |
+
lr: 0.00015
|
153 |
+
weight_decay: 0
|
154 |
+
|
155 |
+
loss: !name:speechbrain.nnet.losses.get_si_snr_with_pitwrapper
|
156 |
+
|
157 |
+
lr_scheduler: &id007 !new:speechbrain.nnet.schedulers.ReduceLROnPlateau
|
158 |
+
|
159 |
+
factor: 0.5
|
160 |
+
patience: 2
|
161 |
+
dont_halve_until_epoch: 85
|
162 |
+
|
163 |
+
epoch_counter: &id006 !new:speechbrain.utils.epoch_loop.EpochCounter
|
164 |
+
limit: 150
|
165 |
+
|
166 |
+
modules:
|
167 |
+
encoder: *id003
|
168 |
+
decoder: *id004
|
169 |
+
masknet: *id005
|
170 |
+
save_all_checkpoints: false
|
171 |
+
checkpointer: !new:speechbrain.utils.checkpoints.Checkpointer
|
172 |
+
checkpoints_dir: results/sepformer-enhancement/8201/save
|
173 |
+
recoverables:
|
174 |
+
encoder: *id003
|
175 |
+
decoder: *id004
|
176 |
+
masknet: *id005
|
177 |
+
counter: *id006
|
178 |
+
lr_scheduler: *id007
|
179 |
+
train_logger: !new:speechbrain.utils.train_logger.FileTrainLogger
|
180 |
+
save_file: results/sepformer-enhancement/8201/train_log.txt
|
181 |
+
|
182 |
+
## Uncomment if you wish to fine-tune a pre-trained model.
|
183 |
+
pretrained_enhancement: !new:speechbrain.utils.parameter_transfer.Pretrainer
|
184 |
+
collect_in: results/sepformer-enhancement/8201/save
|
185 |
+
loadables:
|
186 |
+
encoder: *id003
|
187 |
+
decoder: *id004
|
188 |
+
masknet: *id005
|
189 |
+
paths:
|
190 |
+
encoder:
|
191 |
+
/netscratch/sagar/thesis/speechbrain/recipes/RescueSpeech/pre-trained/sepformer_dns_16k/encoder.ckpt
|
192 |
+
decoder:
|
193 |
+
/netscratch/sagar/thesis/speechbrain/recipes/RescueSpeech/pre-trained/sepformer_dns_16k/decoder.ckpt
|
194 |
+
masknet:
|
195 |
+
/netscratch/sagar/thesis/speechbrain/recipes/RescueSpeech/pre-trained/sepformer_dns_16k/masknet.ckpt
|