README.md
4.1 KB · 114 lines · markdown Raw
1 ---
2 language: "en"
3 thumbnail:
4 tags:
5 - audio-classification
6 - speechbrain
7 - Emotion
8 - Recognition
9 - wav2vec2
10 - pytorch
11 license: "apache-2.0"
12 datasets:
13 - iemocap
14 metrics:
15 - Accuracy
16 inference: false
17 ---
18
19 <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>
20 <br/><br/>
21
22 # Emotion Recognition with wav2vec2 base on IEMOCAP
23
24 This repository provides all the necessary tools to perform emotion recognition with a fine-tuned wav2vec2 (base) model using SpeechBrain.
25 It is trained on IEMOCAP training data.
26
27
28 For a better experience, we encourage you to learn more about
29 [SpeechBrain](https://speechbrain.github.io). The model performance on IEMOCAP test set is:
30
31 | Release | Accuracy(%) |
32 |:-------------:|:--------------:|
33 | 19-10-21 | 78.7 (Avg: 75.3) |
34
35
36 ## Pipeline description
37
38 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.
39
40 The system is trained with recordings sampled at 16kHz (single channel).
41 The code will automatically normalize your audio (i.e., resampling + mono channel selection) when calling *classify_file* if needed.
42
43
44 ## Install SpeechBrain
45
46 First of all, please install the **development** version of SpeechBrain with the following command:
47
48 ```
49 pip install git+https://github.com/speechbrain/speechbrain.git@develop
50 ```
51
52 Please notice that we encourage you to read our tutorials and learn more about
53 [SpeechBrain](https://speechbrain.github.io).
54
55 ### Perform Emotion recognition
56
57 An external `py_module_file=custom.py` is used as an external Predictor class into this HF repos. We use `foreign_class` function from `speechbrain.pretrained.interfaces` that allow you to load you custom model.
58
59 ```python
60 from speechbrain.inference.interfaces import foreign_class
61 classifier = foreign_class(source="speechbrain/emotion-recognition-wav2vec2-IEMOCAP", pymodule_file="custom_interface.py", classname="CustomEncoderWav2vec2Classifier")
62 out_prob, score, index, text_lab = classifier.classify_file("speechbrain/emotion-recognition-wav2vec2-IEMOCAP/anger.wav")
63 print(text_lab)
64 ```
65 The prediction tensor will contain a tuple of (embedding, id_class, label_name).
66
67 ### Inference on GPU
68 To perform inference on the GPU, add `run_opts={"device":"cuda"}` when calling the `from_hparams` method.
69
70 ### Training
71 The model was trained with SpeechBrain (aa018540).
72 To train it from scratch follows these steps:
73 1. Clone SpeechBrain:
74 ```bash
75 git clone https://github.com/speechbrain/speechbrain/
76 ```
77 2. Install it:
78 ```
79 cd speechbrain
80 pip install -r requirements.txt
81 pip install -e .
82 ```
83
84 3. Run Training:
85 ```
86 cd recipes/IEMOCAP/emotion_recognition
87 python train_with_wav2vec2.py hparams/train_with_wav2vec2.yaml --data_folder=your_data_folder
88 ```
89
90 You can find our training results (models, logs, etc) [here](https://drive.google.com/drive/folders/15dKQetLuAhSyg4sNOtbSDnuxFdEeU4zQ?usp=sharing).
91
92 ### Limitations
93 The SpeechBrain team does not provide any warranty on the performance achieved by this model when used on other datasets.
94
95 # **Citing SpeechBrain**
96 Please, cite SpeechBrain if you use it for your research or business.
97
98 ```bibtex
99 @misc{speechbrain,
100 title={{SpeechBrain}: A General-Purpose Speech Toolkit},
101 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},
102 year={2021},
103 eprint={2106.04624},
104 archivePrefix={arXiv},
105 primaryClass={eess.AS},
106 note={arXiv:2106.04624}
107 }
108 ```
109
110 # **About SpeechBrain**
111 - Website: https://speechbrain.github.io/
112 - Code: https://github.com/speechbrain/speechbrain/
113 - HuggingFace: https://huggingface.co/speechbrain/
114