yangwang825 commited on
Commit
44ddddf
1 Parent(s): df3aae2

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +106 -1
README.md CHANGED
@@ -1,3 +1,108 @@
1
  ---
2
- license: apache-2.0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
+ language: "en"
3
+ thumbnail:
4
+ tags:
5
+ - speechbrain
6
+ - embeddings
7
+ - Speaker
8
+ - Verification
9
+ - Identification
10
+ - pytorch
11
+ - ECAPA-TDNN
12
+ license: "apache-2.0"
13
+ datasets:
14
+ - voxceleb
15
+ metrics:
16
+ - EER
17
+ - Accuracy
18
+ inference: true
19
+ widget:
20
+ - example_title: VoxCeleb Speaker id10003
21
+ src: https://cdn-media.huggingface.co/speech_samples/VoxCeleb1_00003.wav
22
+ - example_title: VoxCeleb Speaker id10004
23
+ src: https://cdn-media.huggingface.co/speech_samples/VoxCeleb_00004.wav
24
  ---
25
+
26
+ # Speaker Identification with ECAPA-TDNN embeddings on Voxceleb
27
+
28
+ This repository provides a pretrained TDNN model (x-vector) using SpeechBrain. The system can be used to extract speaker embeddings as well. Since we can't find any resource that has SpeechBrain or HuggingFace compatible checkpoints that has only been trained on VoxCeleb2 development data, so we decide to pre-train an TDNN system from scratch.
29
+
30
+ # Pipeline description
31
+
32
+ This system is composed of an TDNN model (x-vector). It is a combination of convolutional and residual blocks. The embeddings are extracted using temporal statistical pooling. The system is trained with Additive Margin Softmax Loss.
33
+
34
+ We use FBank (16kHz, 25ms frame length, 10ms hop length, 80 filter-bank channels) as the input features. It was trained using initial learning rate of 0.001 and batch size of 512 with linear scheduler for 30 epochs on 4 A100 GPUs. We employ additive noises and reverberation from [MUSAN](http://www.openslr.org/17/) and [RIR](http://www.openslr.org/28/) datasets to enrich the supervised information. The pre-training progress takes approximately seven days for the TDNN model.
35
+
36
+ # Performance
37
+
38
+ **VoxCeleb1-O** is the original verification test set from VoxCeleb1 consisting of 40 speakers. All speakers with names starting with "E" are reserved for testing. **VoxCeleb1-E** uses the entire VoxCeleb1 dataset, covering 1251 speakers. **VoxCeleb1-H** is a hard version of evaluation set consisting of 552536 pairs with 1190 speakers with the same nationality and gender. There are 18 nationality-gender combinations each with at least 5 individuals.
39
+
40
+ | Splits | Backend | S-norm | EER(%) | minDCF(0.01) |
41
+ |:-------------:|:--------------:|:--------------:|:--------------:|:--------------:|
42
+ | VoxCeleb1-O | cosine | no | TBD | TBD |
43
+ | VoxCeleb1-O | cosine | yes | TBD | TBD |
44
+ | VoxCeleb1-E | cosine | no | TBD | TBD |
45
+ | VoxCeleb1-E | cosine | yes | TBD | TBD |
46
+ | VoxCeleb1-H | cosine | no | TBD | TBD |
47
+ | VoxCeleb1-H | cosine | yes | TBD | TBD |
48
+
49
+ - VoxCeleb1-O: includes 37611 test pairs with 40 speakers.
50
+ - VoxCeleb1-E: includes 579818 test pairs with 1251 speakers.
51
+ - VoxCeleb1-H: includes 550894 test pairs with 1190 speakers.
52
+
53
+ # Compute the speaker embeddings
54
+
55
+ The system is trained with recordings sampled at 16kHz (single channel).
56
+
57
+ ```python
58
+ import torch
59
+ import torchaudio
60
+ from speechbrain.pretrained.interfaces import Pretrained
61
+ from speechbrain.pretrained import EncoderClassifier
62
+
63
+
64
+ class Encoder(Pretrained):
65
+
66
+ MODULES_NEEDED = [
67
+ "compute_features",
68
+ "mean_var_norm",
69
+ "embedding_model"
70
+ ]
71
+
72
+ def __init__(self, *args, **kwargs):
73
+ super().__init__(*args, **kwargs)
74
+
75
+ def encode_batch(self, wavs, wav_lens=None, normalize=False):
76
+ # Manage single waveforms in input
77
+ if len(wavs.shape) == 1:
78
+ wavs = wavs.unsqueeze(0)
79
+
80
+ # Assign full length if wav_lens is not assigned
81
+ if wav_lens is None:
82
+ wav_lens = torch.ones(wavs.shape[0], device=self.device)
83
+
84
+ # Storing waveform in the specified device
85
+ wavs, wav_lens = wavs.to(self.device), wav_lens.to(self.device)
86
+ wavs = wavs.float()
87
+
88
+ # Computing features and embeddings
89
+ feats = self.mods.compute_features(wavs)
90
+ feats = self.mods.mean_var_norm(feats, wav_lens)
91
+ embeddings = self.mods.embedding_model(feats, wav_lens)
92
+ if normalize:
93
+ embeddings = self.hparams.mean_var_norm_emb(
94
+ embeddings,
95
+ torch.ones(embeddings.shape[0], device=self.device)
96
+ )
97
+ return embeddings
98
+
99
+
100
+ classifier = Encoder.from_hparams(
101
+ source="yangwang825/tdnn-vox2"
102
+ )
103
+ signal, fs = torchaudio.load('spk1_snt1.wav')
104
+ embeddings = classifier.encode_batch(signal)
105
+ >>> torch.Size([1, 1, 192])
106
+ ```
107
+
108
+ We will release our training results (models, logs, etc) shortly.