Implementation:Speechbrain Speechbrain Train IEMOCAP
| Knowledge Sources | |
|---|---|
| Domains | ASR, Training |
| Last Updated | 2026-02-09 00:00 GMT |
Overview
Concrete tool for training an emotion recognition system on the IEMOCAP dataset provided by the SpeechBrain library.
Description
This recipe defines the EmoIdBrain class (subclass of sb.Brain) for speech emotion recognition classifying four emotions (anger, happiness, sadness, neutrality). The pipeline uses an ECAPA-TDNN embedding model: features are extracted and normalized, then passed through the embedding model to produce utterance-level representations, which are classified into emotion categories. NLL loss is used for training. The learning rate annealing is applied on a per-batch basis during training.
Usage
Use this recipe to train an emotion recognition model using the ECAPA-TDNN architecture on the IEMOCAP dataset. Requires the corresponding hyperparameter YAML file and data preparation script.
Code Reference
Source Location
- Repository: SpeechBrain
- File: recipes/IEMOCAP/emotion_recognition/train.py
Signature
class EmoIdBrain(sb.Brain):
def compute_forward(self, batch, stage):
"""Computation pipeline based on a encoder + emotion classifier."""
...
def compute_objectives(self, predictions, batch, stage):
"""Computes the loss using speaker-id as label."""
...
Import
# Run as recipe script
python recipes/IEMOCAP/emotion_recognition/train.py hparams/train.yaml --data_folder /path/to/IEMOCAP
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| batch.sig | torch.Tensor | Yes | Input waveform signal |
| batch.emo_encoded | torch.Tensor | Yes | Encoded emotion label |
Outputs
| Name | Type | Description |
|---|---|---|
| outputs | torch.Tensor | Class posterior probabilities over 4 emotion categories |
Usage Examples
python train.py hparams/train.yaml --data_folder /path/to/IEMOCAP