You may refer to the report for more details on the project results.
This project implements a Speech Emotion Recognition (SER) system using the Wav2Vec2 pre-trained model. The system analyzes speech audio and classifies it into four emotional categories: Neutral, Happy, Sad, and Angry. This implementation is based on the paper "3-D Convolutional Recurrent Neural Networks With Attention Model for Speech Emotion Recognition" but with significant modifications to use modern transformer-based architectures.
Speech Emotion Recognition is a challenging task in audio processing that requires understanding subtle variations in speech patterns, tone, and acoustic features. Traditional approaches often struggle with:
- Capturing temporal dependencies in speech
- Handling variable-length inputs
- Generalizing across different speakers
- Dealing with limited labeled data
Our solution leverages the power of pre-trained models and modern deep learning techniques:
- Feature Extractor: Facebook's Wav2Vec2 pre-trained model
- Pre-trained on 960 hours of LibriSpeech
- Provides robust speech representations
- Custom Classifier Head:
- Linear layers with batch normalization
- Dropout for regularization
- ReLU activation functions
The Interactive Emotional Dyadic Motion Capture (IEMOCAP) database is used for training and evaluation:
- Total Sessions: 5 sessions with 2 speakers each (1 male, 1 female)
- Split:
- Training: Sessions 2-5
- Validation: Session 1 (Male)
- Test: Session 1 (Female)
- Class Distribution:
Angry (A): 874 samples Happy (H): 1358 samples Neutral (N): 1324 samples Sad (S): 890 samples
- Batch Size: 128 (T4-15GB GPU) / 256 (A100-40GB GPU) / 16 (RTX 3090 Ti)
- Optimizer: AdamW with weight decay
- Learning Rate: 1e-4 with scheduling
- Loss Function: Cross Entropy
- Training Time: ~30-60 minutes depending on GPU
To improve model robustness, we implement several augmentation strategies:
- Time Stretching
- Pitch Shifting
- Background Noise Injection
- Time Masking
Our model achieves significant improvements over the baseline:
| Model Version | Test-UAR | GPU | Time Taken |
|---|---|---|---|
| Baseline | 54.53% | T4 | < 1 hour |
| Our Model | 69.02% | RTX 3090 Ti | ~45 mins |
-
Data Processing
- Audio loading and preprocessing
- Feature extraction using Wav2Vec2
- Data augmentation pipeline
-
Model Training
- Custom training loop
- Learning rate scheduling
- Early stopping
- Gradient clipping
-
Evaluation
- Confusion matrix analysis
- Per-class metrics
- Cross-validation results
-
Model Architecture
- Experiment with different attention mechanisms
- Implement multi-task learning
- Try other pre-trained models (HuBERT, WavLM)
-
Data Processing
- Additional augmentation techniques
- Cross-lingual adaptation
- Speaker normalization
-
Training Strategy
- Curriculum learning
- Adversarial training
- Semi-supervised learning with unlabeled data
- Python 3
- pip
- CUDA capable GPU i.e. T4 or A100 (Google Colab) or any other GPU (Local Machine)
Once you have the prerequisites, you can install the required packages by running:
pip install -r requirements.txt