Jump to content

Connect Leeroopedia MCP: Equip your AI agents to search best practices, build plans, verify code, diagnose failures, and look up hyperparameter defaults.

Implementation:Speechbrain Speechbrain Prepare IEMOCAP

From Leeroopedia


Knowledge Sources
Domains Emotion_Recognition, Data_Preparation
Last Updated 2026-02-09 00:00 GMT

Overview

Concrete tool for preparing the IEMOCAP dataset for emotion recognition provided by the SpeechBrain library.

Description

This script creates JSON data manifest files for the IEMOCAP (Interactive Emotional Dyadic Motion Capture) dataset. It parses session directories, extracts emotion labels from evaluation files, segments audio utterances, and supports two splitting strategies: random ratio-based splits and speaker-disjoint splits for leave-two-speaker-out cross-validation across 10 speakers. The dataset contains 5,531 utterances with categorical emotion annotations.

Usage

Use this when preparing the IEMOCAP dataset for emotion recognition training with SpeechBrain recipes.

Code Reference

Source Location

Signature

def prepare_data(
    data_original,
    save_json_train,
    save_json_valid,
    save_json_test,
    split_ratio=[80, 10, 10],
    different_speakers=False,
    test_spk_id=1,
    seed=12,
):

Import

from recipes.IEMOCAP.emotion_recognition.iemocap_prepare import prepare_data

I/O Contract

Inputs

Name Type Required Description
data_original str Yes Path to the folder where the original IEMOCAP dataset is stored
save_json_train str Yes Path where the train data specification file will be saved
save_json_valid str Yes Path where the validation data specification file will be saved
save_json_test str Yes Path where the test data specification file will be saved
split_ratio list No Ratios for train/valid/test splits (default: [80, 10, 10])
different_speakers bool No If True, ensure speakers are not shared among splits (default: False)
test_spk_id int No Speaker ID for test set in leave-two-speaker-out mode (default: 1)
seed int No Random seed for reproducibility (default: 12)

Outputs

Name Type Description
train.json JSON Training split manifest with audio paths and emotion labels
valid.json JSON Validation split manifest
test.json JSON Test split manifest

Usage Examples

from recipes.IEMOCAP.emotion_recognition.iemocap_prepare import prepare_data

prepare_data(
    data_original="/path/to/IEMOCAP",
    save_json_train="train.json",
    save_json_valid="valid.json",
    save_json_test="test.json",
    split_ratio=[80, 10, 10],
    different_speakers=False,
)

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment