Views
No views yet
| Categorical Setup | |||||||
|---|---|---|---|---|---|---|---|
| Test 3 | Development | ||||||
| F1-Mic. | F1-Ma. | Prec. | Rec. | F1-Mic. | F1-Ma. | Prec. | Rec. |
| 0.327 | 0.311 | 0.332 | 0.325 | 0.409 | 0.307 | 0.316 | 0.345 |
@InProceedings{Goncalves_2024,
author={L. Goncalves and A. N. Salman and A. {Reddy Naini} and L. Moro-Velazquez and T. Thebaud and L. {Paola Garcia} and N. Dehak and B. Sisman and C. Busso},
title={Odyssey2024 - Speech Emotion Recognition Challenge: Dataset, Baseline Framework, and Results},
booktitle={Odyssey 2024: The Speaker and Language Recognition Workshop)},
volume={To appear},
year={2024},
month={June},
address = {Quebec, Canada},
}1from transformers import AutoModelForAudioClassification
2import librosa, torch
3
4#load model
5model = AutoModelForAudioClassification.from_pretrained("3loi/SER-Odyssey-Baseline-WavLM-Categorical-Attributes", trust_remote_code=True)
6
7#get mean/std
8mean = model.config.mean
9std = model.config.std
10
11
12#load an audio file
13audio_path = "/path/to/audio.wav"
14raw_wav, _ = librosa.load(audio_path, sr=model.config.sampling_rate)
15
16#normalize the audio by mean/std
17norm_wav = (raw_wav - mean) / (std+0.000001)
18
19#generate the mask
20mask = torch.ones(1, len(norm_wav))
21
22#batch it (add dim)
23wavs = torch.tensor(norm_wav).unsqueeze(0)
24
25
26#predict
27with torch.no_grad():
28 pred = model(wavs, mask)
29
30print(model.config.id2label)
31print(pred)
32#{0: 'Angry', 1: 'Sad', 2: 'Happy', 3: 'Surprise', 4: 'Fear', 5: 'Disgust', 6: 'Contempt', 7: 'Neutral'}
33#tensor([[0.0015, 0.3651, 0.0593, 0.0315, 0.0600, 0.0125, 0.0319, 0.4382]])
34
35#convert logits to probability
36probabilities = torch.nn.functional.softmax(pred, dim=1)
37print(probabilities)
38#[[0.0015, 0.3651, 0.0593, 0.0315, 0.0600, 0.0125, 0.0319, 0.4382]]