Official minimal training release for the paper:
BlendEmo: Structured Set Prediction and Pair-Conditioned Ratio Modeling for Blended Emotion Recognition
This repository contains the core cross-validation training code for BlendEmo, our structured multimodal method for blended emotion recognition on the BlEmoRe / BLEMORE benchmark.
Blended emotion recognition is not a standard flat classification problem. A model must:
- decide whether a clip is single-emotion or mixed-emotion,
- recover the correct emotion set,
- and, for mixed clips, estimate the relative salience ratio.
BlendEmo addresses this by explicitly factorizing prediction into two coupled stages:
- structured set prediction: predict one valid state from the constrained task label space,
- pair-conditioned ratio prediction: if the sample is mixed, predict the discrete dominance ratio inside the selected pair.
The final decoder is fixed and task-consistent, so the output always corresponds to a valid BLEMORE label.
BlendEmo uses four pre-extracted modality streams:
- HiCMAE
- WavLM
- OpenFace
- VideoMAEv2
The model has three main stages.
Each modality is encoded independently and projected into:
- a shared representation for cross-modal interaction,
- a private representation for complementary fusion.
In the current implementation:
- HiCMAE and VideoMAEv2 use lightweight encoders,
- WavLM and OpenFace use sequence encoders.
The shared branch is fused through:
- audio-guided residual interaction,
- prompt-token fusion,
- relation-graph fusion,
- router-based pooling.
The private branch contributes a complementary multiplicative fusion term.
The final fused representation combines:
- additive summary,
- multiplicative summary,
- routed summary.
BlendEmo predicts:
- a 16-way structured set class
- 6 single-emotion classes
- 10 valid blended-pair classes
- a 3-way ratio class for mixed emotions
70/3050/5030/70
The ratio head is pair-conditioned: it uses pair embeddings and pair-specific scalar evidence instead of a single global ratio head.
The main idea of the paper is that pair identity and salience are related but not identical decisions.
A flat classifier can assign plausible scores to two emotions but still fail the benchmark because:
- the predicted pair is invalid,
- the wrong pair is selected,
- or the salience ratio is wrong.
BlendEmo improves this by:
- first predicting a valid set state,
- then predicting the ratio only inside the selected pair.
This matches the hierarchical structure of the benchmark.
BlendEmo/
├── run_train.sh
└── src/
├── train.py
├── model.py
├── backbone.py
├── encoders.py
├── data.py
├── common.py
├── labels.py
└── metrics.py
By default, run_train.sh expects the BLEMORE data directory at:
../ble-datasets
Inside that directory, the following files/folders are expected:
ble-datasets/
├── train_metadata.csv
└── pre_extracted_train_data/
├── HiCMAE_train/
├── WavLM_large_train/
├── OpenFace_3_train/
└── VideoMAEv2_train/
The training code reads:
train_metadata.csvpre_extracted_train_data/HiCMAE_train/*.npypre_extracted_train_data/WavLM_large_train/*.npypre_extracted_train_data/OpenFace_3_train/*.csvpre_extracted_train_data/VideoMAEv2_train/*.npy
This minimal release does not ship a frozen environment file. At minimum, you need:
- Python 3.9+
- PyTorch
- NumPy
- pandas
- tqdm
A CUDA-enabled PyTorch installation is recommended for actual training.
bash run_train.shDefault outputs:
outputs_cv/train.logoutputs_cv/results.csvoutputs_cv/checkpoints/
DATA_DIR=/path/to/ble-datasets OUTPUT_DIR=/path/to/output bash run_train.shpython src/train.py \
--data_dir ../ble-datasets \
--output_dir ./outputs_cvThe provided run_train.sh uses:
- hidden dimension:
192 - dropout:
0.35 - LMF rank:
10 - prompt layers:
1 - batch size:
24 - learning rate:
3e-4 - weight decay:
6e-3 - epochs:
40 - warmup epochs:
3 - patience:
12 - feature-stat frame cap:
80 - mixup alpha:
0.2 - set loss weight:
0.45 - ratio loss weight:
0.25 - soft emotion loss weight:
0.9 - mix loss weight:
0.4 - salience loss weight:
0.35 - R-Drop weight:
0.8 - label smoothing:
0.05 - focal gamma:
2.0
The paper reports the main table under a common epoch-20 checkpoint for fair comparison across methods.
This repository's default script is a generic cross-validation training entrypoint. If you want to match the paper's fixed-checkpoint setting more closely, use the training entry directly and specify:
python src/train.py \
--data_dir ../ble-datasets \
--output_dir ./outputs_cv_epoch20 \
--selection_mode fixed_epoch \
--fixed_epoch 20