3loi commited on
Commit
c54d84f
1 Parent(s): ffe5c49

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +37 -3
README.md CHANGED
@@ -4,8 +4,42 @@ language:
4
  - en
5
  pipeline_tag: audio-classification
6
  ---
7
- 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).
8
-
9
  This particular model is the multi-attributed based model which predict arousal, dominance and valence in a range of approximately 0...1.
10
 
11
- For more details: [paper/soon]() and [tutorial](https://github.com/MSP-UTD/MSP-Podcast_Challenge/tree/main).
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  - en
5
  pipeline_tag: audio-classification
6
  ---
7
+ 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>
 
8
  This particular model is the multi-attributed based model which predict arousal, dominance and valence in a range of approximately 0...1.
9
 
10
+ For more details: [paper/soon]() and [GitHub](https://github.com/MSP-UTD/MSP-Podcast_Challenge/tree/main).
11
+
12
+
13
+ # Usage
14
+ ```python
15
+ from transformers import AutoModelForAudioClassification
16
+ import librosa, torch
17
+
18
+ #load model
19
+ model = AutoModelForAudioClassification.from_pretrained("3loi/SER-Odyssey-Baseline-WavLM-Multi-Attributes", trust_remote_code=True)
20
+
21
+ #get mean/std
22
+ mean = model.config.mean
23
+ std = model.config.std
24
+
25
+
26
+ #load an audio file
27
+ audio_path = "/path/to/audio.wav"
28
+ raw_wav, _ = librosa.load(audio_path, sr=16000)
29
+
30
+ #normalize the audio by mean/std
31
+ norm_wav = (raw_wav - mean) / (std+0.000001)
32
+
33
+ #generate the mask
34
+ mask = torch.ones(1, len(norm_wav))
35
+ wavs = torch.tensor(norm_wav).unsqueeze(0)
36
+
37
+
38
+ #predict
39
+ with torch.no_grad():
40
+ pred = model(wavs, mask)
41
+
42
+ print(model.config.id2label) #arousal, dominance, valence
43
+ print(pred)
44
+
45
+ ```