sahita commited on
Commit
c1f4b6d
1 Parent(s): 85e9df1

Create README.md

Browse files
Files changed (1) hide show
  1. README.md +163 -0
README.md ADDED
@@ -0,0 +1,163 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language:
3
+ - multilingual
4
+ - en
5
+ - hi
6
+ - ot
7
+ thumbnail:
8
+ tags:
9
+ - audio-classification
10
+ - speechbrain
11
+ - embeddings
12
+ - Language
13
+ - Identification
14
+ - pytorch
15
+ - ECAPA-TDNN
16
+ - TDNN
17
+ - VoxLingua107
18
+ license: "apache-2.0"
19
+ datasets:
20
+ - VoxLingua107
21
+ metrics:
22
+ - Accuracy
23
+ widget:
24
+ - example_title: English Sample
25
+ src: https://cdn-media.huggingface.co/speech_samples/LibriSpeech_61-70968-0000.flac
26
+ ---
27
+
28
+ # VoxLingua107 ECAPA-TDNN Spoken Language Identification Model
29
+
30
+ ## Model description
31
+
32
+ This is a spoken language recognition model trained on the VoxLingua107 dataset using SpeechBrain.
33
+ The model uses the ECAPA-TDNN architecture that has previously been used for speaker recognition. However, it uses
34
+ more fully connected hidden layers after the embedding layer, and cross-entropy loss was used for training.
35
+ We observed that this improved the performance of extracted utterance embeddings for downstream tasks.
36
+
37
+ The system is trained with recordings sampled at 16kHz (single channel).
38
+ The code will automatically normalize your audio (i.e., resampling + mono channel selection) when calling *classify_file* if needed.
39
+
40
+ The model can classify a speech utterance according to the language spoken.
41
+ It covers 107 different languages (
42
+ English,
43
+ Hindi,
44
+ Other.
45
+
46
+ ## Intended uses & limitations
47
+
48
+ The model has two uses:
49
+
50
+ - use 'as is' for spoken language recognition
51
+ - use as an utterance-level feature (embedding) extractor, for creating a dedicated language ID model on your own data
52
+
53
+ The model is trained on automatically collected YouTube data. For more
54
+ information about the dataset, see [here](http://bark.phon.ioc.ee/voxlingua107/).
55
+
56
+
57
+ #### How to use
58
+
59
+ ```python
60
+ import torchaudio
61
+ from speechbrain.pretrained import EncoderClassifier
62
+ language_id = EncoderClassifier.from_hparams(source="sahita/language-identification", savedir="tmp")
63
+ # Download Thai language sample from Omniglot and cvert to suitable form
64
+ signal = language_id.load_audio("https://omniglot.com/soundfiles/udhr/udhr_th.mp3")
65
+ prediction = language_id.classify_batch(signal)
66
+ print(prediction)
67
+ # (tensor([[-2.8646e+01, -3.0346e+01, -2.0748e+01, -2.9562e+01, -2.2187e+01,
68
+ # -3.2668e+01, -3.6677e+01, -3.3573e+01, -3.2545e+01, -2.4365e+01,
69
+ # -2.4688e+01, -3.1171e+01, -2.7743e+01, -2.9918e+01, -2.4770e+01,
70
+ # -3.2250e+01, -2.4727e+01, -2.6087e+01, -2.1870e+01, -3.2821e+01,
71
+ # -2.2128e+01, -2.2822e+01, -3.0888e+01, -3.3564e+01, -2.9906e+01,
72
+ # -2.2392e+01, -2.5573e+01, -2.6443e+01, -3.2429e+01, -3.2652e+01,
73
+ # -3.0030e+01, -2.4607e+01, -2.2967e+01, -2.4396e+01, -2.8578e+01,
74
+ # -2.5153e+01, -2.8475e+01, -2.6409e+01, -2.5230e+01, -2.7957e+01,
75
+ # -2.6298e+01, -2.3609e+01, -2.5863e+01, -2.8225e+01, -2.7225e+01,
76
+ # -3.0486e+01, -2.1185e+01, -2.7938e+01, -3.3155e+01, -1.9076e+01,
77
+ # -2.9181e+01, -2.2160e+01, -1.8352e+01, -2.5866e+01, -3.3636e+01,
78
+ # -4.2016e+00, -3.1581e+01, -3.1894e+01, -2.7834e+01, -2.5429e+01,
79
+ # -3.2235e+01, -3.2280e+01, -2.8786e+01, -2.3366e+01, -2.6047e+01,
80
+ # -2.2075e+01, -2.3770e+01, -2.2518e+01, -2.8101e+01, -2.5745e+01,
81
+ # -2.6441e+01, -2.9822e+01, -2.7109e+01, -3.0225e+01, -2.4566e+01,
82
+ # -2.9268e+01, -2.7651e+01, -3.4221e+01, -2.9026e+01, -2.6009e+01,
83
+ # -3.1968e+01, -3.1747e+01, -2.8156e+01, -2.9025e+01, -2.7756e+01,
84
+ # -2.8052e+01, -2.9341e+01, -2.8806e+01, -2.1636e+01, -2.3992e+01,
85
+ # -2.3794e+01, -3.3743e+01, -2.8332e+01, -2.7465e+01, -1.5085e-02,
86
+ # -2.9094e+01, -2.1444e+01, -2.9780e+01, -3.6046e+01, -3.7401e+01,
87
+ # -3.0888e+01, -3.3172e+01, -1.8931e+01, -2.2679e+01, -3.0225e+01,
88
+ # -2.4995e+01, -2.1028e+01]]), tensor([-0.0151]), tensor([94]), ['th'])
89
+ # The scores in the prediction[0] tensor can be interpreted as log-likelihoods that
90
+ # the given utterance belongs to the given language (i.e., the larger the better)
91
+ # The linear-scale likelihood can be retrieved using the following:
92
+ print(prediction[1].exp())
93
+ # tensor([0.9850])
94
+ # The identified language ISO code is given in prediction[3]
95
+ print(prediction[3])
96
+ # ['th: Thai']
97
+
98
+ # Alternatively, use the utterance embedding extractor:
99
+ emb = language_id.encode_batch(signal)
100
+ print(emb.shape)
101
+ # torch.Size([1, 1, 256])
102
+ ```
103
+ To perform inference on the GPU, add `run_opts={"device":"cuda"}` when calling the `from_hparams` method.
104
+
105
+ The system is trained with recordings sampled at 16kHz (single channel).
106
+ 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*.
107
+
108
+ #### Limitations and bias
109
+
110
+ Since the model is trained on VoxLingua107, it has many limitations and biases, some of which are:
111
+
112
+ - Probably it's accuracy on smaller languages is quite limited
113
+ - Probably it works worse on female speech than male speech (because YouTube data includes much more male speech)
114
+ - Based on subjective experiments, it doesn't work well on speech with a foreign accent
115
+ - Probably it doesn't work well on children's speech and on persons with speech disorders
116
+
117
+
118
+ ## Training data
119
+
120
+ The model is trained on [VoxLingua107](http://bark.phon.ioc.ee/voxlingua107/).
121
+
122
+ VoxLingua107 is a speech dataset for training spoken language identification models.
123
+ The dataset consists of short speech segments automatically extracted from YouTube videos and labeled according the language of the video title and description, with some post-processing steps to filter out false positives.
124
+
125
+ VoxLingua107 contains data for 107 languages. The total amount of speech in the training set is 6628 hours.
126
+ The average amount of data per language is 62 hours. However, the real amount per language varies a lot. There is also a seperate development set containing 1609 speech segments from 33 languages, validated by at least two volunteers to really contain the given language.
127
+
128
+ ## Training procedure
129
+
130
+ See the [SpeechBrain recipe](https://github.com/speechbrain/speechbrain/tree/voxlingua107/recipes/VoxLingua107/lang_id).
131
+
132
+ ## Evaluation results
133
+
134
+ Error rate: 6.7% on the VoxLingua107 development dataset
135
+
136
+ #### Referencing SpeechBrain
137
+ ```bibtex
138
+ @misc{speechbrain,
139
+ title={{SpeechBrain}: A General-Purpose Speech Toolkit},
140
+ 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},
141
+ year={2021},
142
+ eprint={2106.04624},
143
+ archivePrefix={arXiv},
144
+ primaryClass={eess.AS},
145
+ note={arXiv:2106.04624}
146
+ }
147
+ ```
148
+
149
+ ### Referencing VoxLingua107
150
+
151
+ ```bibtex
152
+ @inproceedings{valk2021slt,
153
+ title={{VoxLingua107}: a Dataset for Spoken Language Recognition},
154
+ author={J{\"o}rgen Valk and Tanel Alum{\"a}e},
155
+ booktitle={Proc. IEEE SLT Workshop},
156
+ year={2021},
157
+ }
158
+ ```
159
+
160
+ #### About SpeechBrain
161
+ SpeechBrain is an open-source and all-in-one speech toolkit. It is designed to be simple, extremely flexible, and user-friendly. Competitive or state-of-the-art performance is obtained in various domains.
162
+ Website: https://speechbrain.github.io/
163
+ GitHub: https://github.com/speechbrain/speechbrain