Downloads · 30 days
12
44% of all-time downloads
jihedjabnoun/hubert-emotion-recognition-v2
hubert-emotion-recognition-v2 is a machine learning model from jihedjabnoun. Use it for the machine learning task on the model card, and read the license before you ship it in a product. The card lists the license as mit.
Fine-tuned HuBERT model for 7-class speech emotion recognition achieving 71.8% accuracy.
Downloads · 30 days
12
44% of all-time downloads
All-time downloads
27
Public
Parameters
94.6M
757 MB on disk
Likes
1
Public
Click a slice to open those files.
.safetensors378 MB · 100%
From the Hugging Face model README
Fine-tuned HuBERT model for 7-class speech emotion recognition achieving 71.8% accuracy.
The model can classify audio into 7 emotional categories:
from transformers import Wav2Vec2FeatureExtractor, Wav2Vec2ForSequenceClassification
import librosa
import torch
import numpy as np
# Load model and feature extractor
model = Wav2Vec2ForSequenceClassification.from_pretrained("jihedjabnoun/hubert-emotion-recognition-v2")
feature_extractor = Wav2Vec2FeatureExtractor.from_pretrained("jihedjabnoun/hubert-emotion-recognition-v2")
# Load and process audio (16kHz sample rate)
audio, sr = librosa.load("your_audio.wav", sr=16000)
# Preprocess audio
inputs = feature_extractor(
audio,
sampling_rate=16000,
return_tensors="pt",
padding=True
)
# Predict emotion
with torch.no_grad():
logits = model(**inputs).logits
predicted_id = torch.argmax(logits, dim=-1).item()
# Get prediction confidence
probabilities = torch.softmax(logits, dim=-1)[0]
confidence = probabilities[predicted_id].item()
# Emotion labels
emotions = ['Anger', 'Disgust', 'Fear', 'Happiness', 'Neutral', 'Sadness', 'Surprise']
print(f"Predicted Emotion: {emotions[predicted_id]}")
print(f"Confidence: {confidence:.3f}")
# Get all emotion probabilities
for i, emotion in enumerate(emotions):
prob = probabilities[i].item()
print(f"{emotion}: {prob:.3f}")
| Emotion | Precision | Recall | F1-Score | Support |
|---|---|---|---|---|
| Anger | 0.776 | 0.828 | 0.801 | 443 |
| Disgust | 0.747 | 0.620 | 0.677 | 442 |
| Fear | 0.758 | 0.673 | 0.713 | 443 |
| Happiness | 0.777 | 0.614 | 0.686 | 443 |
| Neutral | 0.761 | 0.838 | 0.797 | 437 |
| Sadness | 0.667 | 0.614 | 0.639 | 443 |
| Surprise | 0.593 | 0.846 | 0.697 | 421 |
Best performing emotions: Anger, Neutral, Surprise
Most challenging emotions: Sadness, Happiness
The model was trained on a diverse collection of emotional speech datasets:
Total: 12,285 training samples, 3,072 validation samples
If you use this model in your research, please cite:
@misc{hubert-emotion-recognition-2025,
title={Speech Emotion Recognition with Fine-tuned HuBERT},
author={Jihed Jabnoun},
year={2025},
url={https://huggingface.co/jihedjabnoun/hubert-emotion-recognition-v2},
note={Fine-tuned HuBERT model for 7-class emotion recognition}
}
This model is released under the MIT License. The base HuBERT model follows its original license terms.
Last updated: June 2025