Spoken language ID: Sinhala / Tamil / English
speechbrain/lang-id-voxlingua107-ecapa (ECAPA-TDNN) fine-tuned into a 3-class classifier (si: Sinhala, ta: Tamil, en: English) to route audio to
language-specific ASR models. The output layer was initialised from the pretrained rows of these 3 languages,
so the zero-shot numbers below are the original model restricted to the same 3 classes.
Test results
Each clip is classified from its first N seconds (what a streaming router sees); full = up to 10 s.
Test sets: up to 1500 clips per (language, source), speaker-diverse, from the test_* splits.
| zero-shot acc | fine-tuned acc | zero-shot macro-F1 | fine-tuned macro-F1 | |
|---|---|---|---|---|
| 1s | 0.6625 | 0.8810 | 0.5807 | 0.8829 |
| 2s | 0.9078 | 0.9745 | 0.8920 | 0.9731 |
| 3s | 0.9588 | 0.9892 | 0.9532 | 0.9883 |
| full | 0.9838 | 0.9943 | 0.9833 | 0.9938 |
Accuracy per (language, source):
| 1s | 2s | 3s | full | |
|---|---|---|---|---|
| acc_en__libritts_r | 0.9753 | 0.9993 | 1.0000 | 1.0000 |
| acc_si__openslr_sinhala | 0.9600 | 0.9793 | 0.9887 | 0.9940 |
| acc_ta__common_voice_tamil | 0.6400 | 0.9433 | 0.9813 | 0.9873 |
| acc_ta__indic_tts_tamil | 0.9487 | 0.9760 | 0.9867 | 0.9960 |
Best epoch: 5 (selected on mean val macro-F1 over 1s, 2s, 3s, full).
Usage
from speechbrain.inference.classifiers import EncoderClassifier
lid = EncoderClassifier.from_hparams(source="TriLinSL/lid-ecapa-voxlingua107-si-ta-en", savedir="pretrained_lid")
out_prob, score, index, label = lid.classify_file("audio.wav") # 16 kHz mono
print(label[0], out_prob.exp()[0]) # out_prob are log-probabilities
For routing, classify the first 2–3 s; if the top probability is below ~0.8, wait for more audio and classify again.
Training
- Data:
TriLingDATA/si-ta-en-asr, 20 h per language, balanced across sources, round-robin by speaker, val/test speakers removed from training. Selected clip ids are indata_selection/.
| clips | hours | speakers | |
|---|---|---|---|
| en | indic_tts_tamil | 77.0000 | 0.2200 |
| en | libritts_r | 10984.0000 | 20.0000 |
| en | openslr_sinhala | 1352.0000 | 1.4400 |
| si | openslr_sinhala | 16509.0000 | 20.0000 |
| ta | common_voice_tamil | 5617.0000 | 10.0000 |
| ta | indic_tts_tamil | 1592.0000 | 10.0000 |
- Random 1–4 s crops; speed, synthetic reverb, telephone band, noise and gain augmentation; equal sampling per language every step.
- 12 epochs × 250 steps, batch 64, head-only for 1 epoch(s), AdamW (backbone 0.0001, head 0.001), warm-up 200 + cosine, label smoothing 0.05, seed 3407.
Limitations
- Each language comes from few recording setups (Sinhala: read sentences; Tamil: IndicTTS talk-style speech and Common Voice; English: LibriTTS-R audiobooks). The model may partly rely on recording conditions. Check it on audio from your real users before relying on it.
- English training data is native-accented audiobook speech, not Sri Lankan English.
- Code-mixed speech is labelled by its main language; utterance-level output only.