|
--- |
|
license: mit |
|
language: |
|
- en |
|
pipeline_tag: audio-classification |
|
--- |
|
The model was developed for the Odyssey 2024 Emotion Recognition competition trained on [MSP-Podcast](https://ecs.utdallas.edu/research/researchlabs/msp-lab/MSP-Podcast.html).<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: [paper/soon]() and [GitHub](https://github.com/MSP-UTD/MSP-Podcast_Challenge/tree/main). |
|
|
|
|
|
# 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]]) |
|
``` |