Views
No views yet
| Model | Accuracy |
|---|---|
| SVM Baseline | 65.9% |
| Wav2Vec2 (this model) | 83.1% |
| Improvement | +17.2% |
| Emotion | Precision | Recall | F1 |
|---|---|---|---|
| Angry | 0.87 | 0.95 | 0.91 |
| Happy | 0.85 | 0.75 | 0.80 |
| Neutral | 0.72 | 0.86 | 0.79 |
| Sad | 0.87 | 0.77 | 0.82 |
label_encoder.json — emotion class index mappingtraining_config.json — full training configurationtraining_results.json — metrics and dataset statsconfusion_matrix_wav2vec2.png — Wav2Vec2 confusion matrixconfusion_matrix_svm.png — SVM baseline confusion matrixdomain_shift_comparison.png — angry probability across steering conditionswav2vec2_inference_results.csv — per-file predictions on PersonaPlex outputssvm_inference_results.csv — SVM predictions on PersonaPlex outputscaa_waveform.png — example CAA steered audio waveform1from transformers import Wav2Vec2ForSequenceClassification, Wav2Vec2Processor
2from huggingface_hub import hf_hub_download
3import torch, librosa, numpy as np, json
4
5model = Wav2Vec2ForSequenceClassification.from_pretrained('YOUR_USERNAME/personaplex-ser-classifier')
6processor = Wav2Vec2Processor.from_pretrained('YOUR_USERNAME/personaplex-ser-classifier')
7
8le_file = hf_hub_download('YOUR_USERNAME/personaplex-ser-classifier', 'label_encoder.json')
9with open(le_file) as f:
10 classes = json.load(f)
11
12def predict(audio_path, sr=16000, duration=3):
13 y, _ = librosa.load(audio_path, sr=sr, duration=duration)
14 if len(y) < sr * duration:
15 y = np.pad(y, (0, sr * duration - len(y)))
16 inputs = processor(y, sampling_rate=sr, return_tensors='pt')
17 with torch.no_grad():
18 logits = model(**inputs).logits
19 probs = torch.softmax(logits, dim=-1).numpy()[0]
20 return classes[np.argmax(probs)], dict(zip(classes, probs.tolist()))