File size: 7,890 Bytes
a94f2da
b9cf7cb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6535f5e
 
 
 
 
a90f314
6535f5e
 
 
 
 
 
a90f314
 
a94f2da
b9cf7cb
 
 
 
 
7bfce13
b9cf7cb
271251e
 
 
 
cc95829
 
 
 
7bfce13
b9cf7cb
 
3a8ab9d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b9cf7cb
 
cc95829
 
 
b9cf7cb
 
 
cc95829
b9cf7cb
cc95829
 
 
b9cf7cb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7bfce13
b9cf7cb
 
 
 
cc95829
 
 
b9cf7cb
 
cc95829
 
b9cf7cb
 
 
 
 
 
 
cc95829
 
 
b9cf7cb
cc95829
b9cf7cb
 
 
 
cc95829
b9cf7cb
cc95829
b9cf7cb
 
 
 
 
cc95829
 
 
 
 
 
b9cf7cb
 
cc95829
b9cf7cb
 
 
 
14bebf4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
cc95829
b9cf7cb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14bebf4
b9cf7cb
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
---
language:
- en
thumbnail:
tags:
- audio-classification
- speechbrain
- embeddings
- Accent
- Identification
- pytorch
- ECAPA-TDNN
- TDNN
- CommonAccent
license: "mit"
datasets:
- CommonVoice
metrics:
- Accuracy
widget:
- example_title: Africa-English
  src: https://huggingface.co/Jzuluaga/accent-id-commonaccent_ecapa/resolve/main/data/african_1.wav
- example_title: Australia-English
  src: https://huggingface.co/Jzuluaga/accent-id-commonaccent_ecapa/resolve/main/data/australia_1.wav
- example_title: India-English
  src: https://huggingface.co/Jzuluaga/accent-id-commonaccent_ecapa/resolve/main/data/indian_1.wav
- example_title: Ireland-English
  src: https://huggingface.co/Jzuluaga/accent-id-commonaccent_ecapa/resolve/main/data/ireland_1.wav
- example_title: Malaysia-English
  src: https://huggingface.co/Jzuluaga/accent-id-commonaccent_ecapa/resolve/main/data/malaysia_1.wav
- example_title: Canada-English
  src: https://huggingface.co/Jzuluaga/accent-id-commonaccent_ecapa/resolve/main/data/canada_1.wav
- example_title: SouthAtlantic-English
  src: https://huggingface.co/Jzuluaga/accent-id-commonaccent_ecapa/resolve/main/data/southatlantic_1.wav
---


<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>
<br/><br/>

# Accent Identification from Speech Recordings with ECAPA-TDNN embeddings on CommonAccent


**Abstract**: The recognition of accented speech still remains a dominant problem in Automatic Speech Recognition (ASR) systems. We approach the classification of accented English speech through the Emphasized Channel Attention, Propagation and Aggregation Time Delay Neural Network (ECAPA-TDNN) architecture which has been shown to perform well on a variety of speech tasks. Three models are proposed: one trained from scratch, another two models (one using data augmentation and a baseline model) fine-tuned from the checkpoints of speechbrain/spkrec-ecapa-voxceleb (VoxCeleb). Our results show that the model fine-tuned with data augmentation yield the best results. Most of the misclassifications were structured and expected due to accent similarities, such as the American and Canadian accents. We also explored the internal categorization of embeddings through t-SNE, a dimensionality reduction technique, and found that there was a level of clustering based on phonological similarity. For future work, we would like to explore the implementation of this accent classification system in our suggested framework to improve ASR performance by making it more inclusive to accented speech. 


This repository provides all the necessary tools to perform accent identification from speech recordings with [SpeechBrain](https://github.com/speechbrain/speechbrain).
The system uses a model pretrained on the CommonAccent dataset in English (16 accents). This system is based on the CommonLanguage Recipe located here: https://github.com/speechbrain/speechbrain/tree/develop/recipes/CommonLanguage


The provided system can recognize the following 16 accents from short speech recordings in English (EN):

```
african
australia
bermuda
canada
england
hongkong
indian
ireland
malaysia
newzealand
philippines
scotland
singapore
southatlandtic
us
wales
```

<a href="https://github.com/JuanPZuluaga/accent-recog-slt2022"> <img alt="GitHub" src="https://img.shields.io/badge/GitHub-Open%20source-green"> </a> Github repository link: https://github.com/JuanPZuluaga/accent-recog-slt2022


For a better experience, we encourage you to learn more about
[SpeechBrain](https://speechbrain.github.io). The given model performance on the test set is:

| Release (dd/mm/yyyy) | Accuracy (%)
|:-------------:|:--------------:|
| 01-08-2023 (this model) | 87 | 
| 01-08-2023 (this model trained without data augmentation) | 85 | 
| 01-08-2023 (this model trained from scratch, no paremeter transfer) | 82 | 


## Pipeline description
This system is composed of an ECAPA model coupled with statistical pooling. A classifier, trained with Categorical Cross-Entropy Loss, is applied on top of that.

The system is trained with recordings sampled at 16kHz (single channel).
The code will automatically normalize your audio (i.e., resampling + mono channel selection) when calling *classify_file* if needed. Make sure your input tensor is compliant with the expected sampling rate if you use *encode_batch* and *classify_batch*.

## Install SpeechBrain

First of all, please install SpeechBrain with the following command:

```
pip install speechbrain
```

Please notice that we encourage you to read our tutorials and learn more about
[SpeechBrain](https://speechbrain.github.io).

### Perform Accent Identification from Speech Recordings

```python
import torchaudio
from speechbrain.pretrained import EncoderClassifier
classifier = EncoderClassifier.from_hparams(source="Jzuluaga/accent-id-commonaccent_ecapa", savedir="pretrained_models/accent-id-commonaccent_ecapa")
# Irish Example
out_prob, score, index, text_lab = classifier.classify_file('Jzuluaga/accent-id-commonaccent_ecapa/data/ireland_1.wav')
print(text_lab)

# Malaysia Example
out_prob, score, index, text_lab = classifier.classify_file('Jzuluaga/accent-id-commonaccent_ecapa/data/malaysia_1.wav')
print(text_lab)
```

### Inference on GPU
To perform inference on the GPU, add  `run_opts={"device":"cuda"}`  when calling the `from_hparams` method.

### Training

The model was trained with SpeechBrain.

To train it from scratch follow these steps:

1. Clone SpeechBrain:
```bash
git clone https://github.com/speechbrain/speechbrain/
```

2. Install it:
```bash
cd speechbrain
pip install -r requirements.txt
pip install -e .
```

3. Clone our repository in https://github.com/JuanPZuluaga/accent-recog-slt2022:

```bash
git clone https://github.com/JuanPZuluaga/accent-recog-slt2022
cd CommonAccent/accent_id
python train.py hparams/train_ecapa_tdnn.yaml
```

You can find our training results (models, logs, etc) in this repository's `Files and versions` page.

### Limitations
The SpeechBrain team does not provide any warranty on the performance achieved by this model when used on other datasets.



#### Cite our work: CommonAccent

If you find useful this work, please cite our work as: 

```
@article{zuluaga2023commonaccent,
  title={CommonAccent: Exploring Large Acoustic Pretrained Models for Accent Classification Based on Common Voice},
  author={Zuluaga-Gomez, Juan and Ahmed, Sara and Visockas, Danielius and Subakan, Cem},
  journal={Interspeech 2023},
  url={https://arxiv.org/abs/2305.18283},
  year={2023}
}
```

#### Cite ECAPA-TDNN model

```@inproceedings{DBLP:conf/interspeech/DesplanquesTD20,
  author    = {Brecht Desplanques and
               Jenthe Thienpondt and
               Kris Demuynck},
  editor    = {Helen Meng and
               Bo Xu and
               Thomas Fang Zheng},
  title     = {{ECAPA-TDNN:} Emphasized Channel Attention, Propagation and Aggregation
               in {TDNN} Based Speaker Verification},
  booktitle = {Interspeech 2020},
  pages     = {3830--3834},
  publisher = {{ISCA}},
  year      = {2020},
}
```


# **Cite SpeechBrain**
Please, cite SpeechBrain if you use it for your research or business.


```bibtex
@misc{speechbrain,
  title={{SpeechBrain}: A General-Purpose Speech Toolkit},
  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},
  year={2021},
  eprint={2106.04624},
  archivePrefix={arXiv},
  primaryClass={eess.AS},
  note={arXiv:2106.04624}
}
```