aheba31 commited on
Commit
1bad610
1 Parent(s): 3bfc49f

add README.MD

Browse files
Files changed (1) hide show
  1. README.md +117 -0
README.md ADDED
@@ -0,0 +1,117 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ language: "en"
3
+ thumbnail:
4
+ tags:
5
+ - speechbrain
6
+ - classification
7
+ - Emotion
8
+ - Recognition
9
+ - wav2vec2
10
+ - pytorch
11
+ license: "apache-2.0"
12
+ datasets:
13
+ - iemocap
14
+ metrics:
15
+ - Accuracy
16
+ ---
17
+
18
+ <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>
19
+ <br/><br/>
20
+
21
+ # Emotion Recognition with wav2vec2 base on IEMOCAP
22
+
23
+ This repository provides all the necessary tools to perform emotion recognition with a fine-tuned wav2vec2 (base) model using SpeechBrain.
24
+ It is trained on IEMOCAP training data.
25
+
26
+
27
+ For a better experience, we encourage you to learn more about
28
+ [SpeechBrain](https://speechbrain.github.io). The model performance on IEMOCAP test set is:
29
+
30
+ | Release | Accuracy(%) |
31
+ |:-------------:|:--------------:|
32
+ | 19-10-21 | 78.7 (Avg: 75.3) |
33
+
34
+
35
+ ## Pipeline description
36
+
37
+ This system is composed of an wav2vec2 model. It is a combination of convolutional and residual blocks. The embeddings are extracted using attentive statistical pooling. The system is trained with Additive Margin Softmax Loss. Speaker Verification is performed using cosine distance between speaker embeddings.
38
+
39
+ ## Install SpeechBrain
40
+
41
+ First of all, please install SpeechBrain with the following command:
42
+
43
+ ```
44
+ pip install speechbrain
45
+ ```
46
+
47
+ Please notice that we encourage you to read our tutorials and learn more about
48
+ [SpeechBrain](https://speechbrain.github.io).
49
+
50
+ ### Compute your speaker embeddings
51
+
52
+ ```python
53
+ import torchaudio
54
+ from speechbrain.pretrained import EncoderClassifier
55
+ classifier = EncoderClassifier.from_hparams(source="speechbrain/spkrec-ecapa-voxceleb")
56
+ signal, fs =torchaudio.load('samples/audio_samples/example1.wav')
57
+ embeddings = classifier.encode_batch(signal)
58
+ ```
59
+
60
+ ### Perform Speaker Verification
61
+
62
+ ```python
63
+ import torchaudio
64
+ from speechbrain.pretrained.interfaces import EncoderWav2vecClassifier
65
+ classifier = EncoderWav2vecClassifier.from_hparams(source="speechbrain/emotion-recognition-wav2vec2")
66
+ signal, fs =torchaudio.load('/workspace/emotion-recognition-wav2vec2/anger.wav')
67
+ prediction = classifier.classify_batch(sig)
68
+ ```
69
+ The prediction tensor will contain a tuple of (embedding, id_class, label_name).
70
+
71
+ ### Inference on GPU
72
+ To perform inference on the GPU, add `run_opts={"device":"cuda"}` when calling the `from_hparams` method.
73
+
74
+ ### Training
75
+ The model was trained with SpeechBrain (aa018540).
76
+ To train it from scratch follows these steps:
77
+ 1. Clone SpeechBrain:
78
+ ```bash
79
+ git clone https://github.com/speechbrain/speechbrain/
80
+ ```
81
+ 2. Install it:
82
+ ```
83
+ cd speechbrain
84
+ pip install -r requirements.txt
85
+ pip install -e .
86
+ ```
87
+
88
+ 3. Run Training:
89
+ ```
90
+ cd recipes/IEMOCAP/emotion_recognition
91
+ python train_with_wav2vec2.py hparams/train_with_wav2vec2.yaml --data_folder=your_data_folder
92
+ ```
93
+
94
+ You can find our training results (models, logs, etc) [here](https://drive.google.com/drive/folders/15dKQetLuAhSyg4sNOtbSDnuxFdEeU4zQ?usp=sharing).
95
+
96
+ ### Limitations
97
+ The SpeechBrain team does not provide any warranty on the performance achieved by this model when used on other datasets.
98
+
99
+ # **Citing SpeechBrain**
100
+ Please, cite SpeechBrain if you use it for your research or business.
101
+
102
+ ```bibtex
103
+ @misc{speechbrain,
104
+ title={{SpeechBrain}: A General-Purpose Speech Toolkit},
105
+ 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},
106
+ year={2021},
107
+ eprint={2106.04624},
108
+ archivePrefix={arXiv},
109
+ primaryClass={eess.AS},
110
+ note={arXiv:2106.04624}
111
+ }
112
+ ```
113
+
114
+ # **About SpeechBrain**
115
+ - Website: https://speechbrain.github.io/
116
+ - Code: https://github.com/speechbrain/speechbrain/
117
+ - HuggingFace: https://huggingface.co/speechbrain/