Emotion Detection using Multi Modalities
Code: github.com/PhilippMarquardt/multimodal-emotion-detection
This project came out of a research practical course on interactive learning. The goal was to detect emotions from short videos of people speaking, and to find out how much the face and the voice each contribute. I used the RAVDESS dataset, where actors say the same sentences with 8 different emotions (neutral, calm, happy, sad, angry, fearful, disgust, surprised), and trained video-only, audio-only and combined audio-video models in PyTorch.
Read the full report here, or the short seminar paper about the different modalities you can use for emotion detection.
Data pipeline
Each sample is a clip of 16 or 64 frames, taken from a random position in the video. The audio is cut to exactly the same time window, so the two modalities always line up. Audio is converted to mono and then either:
- kept as a raw waveform for 1D convolutional models, or
- turned into a mel spectrogram, normalised to [0, 1] and resized to 512×1024 so a standard image CNN can read it.
The data is split 80/20 into training and validation.
Models
I tried several architectures to compare the modalities:
- Video, frame by frame: a pretrained ResNet-50 embeds each frame, and either a Transformer encoder or a bidirectional LSTM models how the face changes over time.
- Video, end to end: a pretrained MViTv2-S video transformer from torchvision that processes the whole clip at once.
- Audio only: a 1D ResNet-style network on the raw waveform, and a ResNet-50 on the mel spectrogram.
- Audio + video fusion: the ResNet-50 + BiLSTM video branch and a ResNet-50 spectrogram branch. The audio embedding is attached to every frame's video embedding, and the combined features are classified per frame.
All models were trained with Adam (learning rate 3e-5, weight decay 0.01) and cross-entropy loss, with TensorBoard logging and the best validation checkpoint saved.
Clip splicing for per-frame predictions
RAVDESS has exactly one emotion per clip, so a model can get away with predicting a single label for the whole video. I wanted it to notice when the emotion changes. To get that, the multimodal training splices clips together: with a 50% chance, the last few frames of a sample (and the matching piece of audio) are replaced with a segment from another random clip, and the per-frame labels change at the splice point. The fusion model predicts an emotion for every frame, so it has to learn to follow the change instead of just guessing one label per clip.
Code
The repository has two scripts: train_audio_only.py for the single-modality experiments and train_multimodal.py for the fused audio-video model with clip splicing.