File size: 1,927 Bytes
366ff74
 
 
 
 
be2dff4
 
3c6f67b
 
 
 
 
 
 
ac6d97c
611c1c8
c64bd19
1ce654a
 
14b57cc
c54d84f
 
6464f4b
 
 
 
 
 
 
 
 
 
 
 
c54d84f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3c5efc3
c54d84f
 
 
 
 
 
 
 
 
 
 
 
 
975635a
c54d84f
975635a
 
c54d84f
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
---
license: mit
language:
- en
pipeline_tag: audio-classification
tags:
- wavlm
- msp-podcast
- emotion-recognition
- audio
- speech
- valence
- arousal
- dominance
- lucas
---
The model was trained on [MSP-Podcast](https://ecs.utdallas.edu/research/researchlabs/msp-lab/MSP-Podcast.html) for the Odyssey 2024 Emotion Recognition competition baseline<br>
This particular model is the multi-attributed based model which predict arousal, dominance and valence in a range of approximately 0...1. 

For more details:  [demo](https://huggingface.co/spaces/3loi/WavLM-SER-Multi-Baseline-Odyssey2024), [paper/soon]() and [GitHub](https://github.com/MSP-UTD/MSP-Podcast_Challenge/tree/main).


```
@misc{SER_Challenge_2024,
  author = {Goncalves, Lucas and Salman, Ali and Reddy, Abinay and Velazquez, Laureano Moro and Thebaud, Thomas and Garcia, Leibny Paola and Dehak, Najim and Sisman, Berrak and Busso, Carlos},
  title = {Odyssey 2024 - Emotion Recognition Challenge},
  year = {2024},
  publisher = {GitHub},
  journal = {MSP-Podcast Challenge},
  howpublished = {\url{https://github.com/MSP-UTD/MSP-Podcast_Challenge}},
}
```


# Usage
```python
from transformers import AutoModelForAudioClassification
import librosa, torch

#load model
model = AutoModelForAudioClassification.from_pretrained("3loi/SER-Odyssey-Baseline-WavLM-Multi-Attributes", trust_remote_code=True)

#get mean/std
mean = model.config.mean
std = model.config.std


#load an audio file
audio_path = "/path/to/audio.wav"
raw_wav, _ = librosa.load(audio_path, sr=model.config.sampling_rate)

#normalize the audio by mean/std
norm_wav = (raw_wav - mean) / (std+0.000001)

#generate the mask
mask = torch.ones(1, len(norm_wav))
wavs = torch.tensor(norm_wav).unsqueeze(0)


#predict
with torch.no_grad():
    pred = model(wavs, mask)

print(model.config.id2label) 
print(pred)
#{0: 'arousal', 1: 'dominance', 2: 'valence'}
#tensor([[0.3670, 0.4553, 0.4240]])
```