Spatial-temporal Transformer for Affective Behavior Analysis

Peng Zou, Rui Wang, Kehua Wen, Yasi Peng, Xiao SunarXiv 2023 · DOI

Abstract

Researchers from the Institute of Artificial Intelligence in Hefei have developed a spatial-temporal Transformer framework designed to address the complexities of "in-the-wild" affective behavior analysis. By integrating deep visual features from ResNet-50 backbones with a Multi-Head Attention mechanism, the model effectively predicts emotional states (Valence-Arousal), classifies facial expressions, and detects facial Action Units (AUs). Evaluated on the massive Aff-Wild2 dataset, the proposed architecture demonstrates significant improvements over baseline models, particularly in handling sample imbalance and environmental noise inherent in real-world video data.

Introduction

Understanding human emotions through computer vision is notoriously difficult when transitioning from controlled laboratory settings to "in-the-wild" scenarios. Real-world videos contain significant "noise," including varying head poses, lighting conditions, and diverse demographic factors.

Affective computing typically focuses on three distinct representations:

  1. Valence-Arousal (VA): Measuring the positivity/negativity and intensity of an emotion.
  2. Facial Expressions: Categorizing faces into basic states like "Happy," "Sad," or "Surprise."
  3. Action Units (AU): Identifying specific muscle movements based on the Facial Action Coding System (FACS).

Most existing datasets provide only a subset of these labels. This paper addresses the challenge of building a unified, robust model that can handle all three tasks simultaneously while overcoming the significant problem of sample imbalance, where certain expressions appear much more frequently than others in training data.

Methods

The authors propose a multi-stage pipeline designed to capture both spatial facial geometry and temporal dynamics across video frames.

The proposed spatial-temporal Transformer architecture, featuring Multi-Modal Multi-Head Attention (MMA) and Temporal Multi-Head Attention (TMA) modules.
  • Feature Extraction: The model utilizes ResNet-50 backbones pre-trained on the VGGFace2 and AffectNet datasets. Using VGGFace2 (containing over 3.3 million images) provides the model with a rich understanding of facial geometry and identity-invariant features, which the authors suggest is critical for accurate emotion recognition.
  • Temporal Embedding: To capture the "flow" of a video, the system employs a 1-D temporal convolution network followed by positional encoding. This transforms static frame features into a sequence that retains vital timing information.
  • Spatial-Temporal Transformer: The core of the model is a Transformer Encoder utilizing Multi-Head Attention. Specifically, it employs Multi-Modal Multi-Head Attention (MMA) to fuse different feature sets and Temporal Multi-Head Attention (TMA) to learn long-range dependencies in the video sequence. This allows the model to focus on subtle, fleeting facial movements.
  • Data Augmentation: To combat class imbalance, the team employed various augmentation strategies, preventing the model from becoming biased toward common expressions and improving generalization to unseen test data.

Results

The study relies on the Aff-Wild2 dataset, the benchmark for the 5th ABAW (Affective Behavior Analysis in-the-wild) Competition. This dataset includes approximately 3 million frames annotated for valence and arousal, as well as millions of frames for expression classification and 12 distinct action units.

Performance metrics of the spatial-temporal Transformer across the three primary sub-challenges of the 5th ABAW competition.

As shown in the results table, the model achieved a Concordance Correlation Coefficient (CCC) of 54.5 for V-A Estimation and F1 scores of 30.4% and 38.9% for Expression Classification and AU Detection, respectively. These results represent a significant improvement over the competition's baseline models.

Discussion and Future Work

The success of the spatial-temporal Transformer highlights that identity-aware features and attention mechanisms are highly effective for facial analysis. The Multi-Head Attention mechanism specifically allows the model to bypass the limitations of standard Recurrent Neural Networks (RNNs) by focusing on the most relevant spatial and temporal features.

However, several areas for future growth remain:

  • Multi-modal Fusion: While this implementation focuses on visual features, integrating audio (speech prosody) could further boost accuracy.
  • Computational Efficiency: Future work will involve optimizing the Transformer architecture for real-time analysis on edge devices.
  • Refining "Other" Categories: The "Other" category in expression classification remains a challenge, acting as a catch-all for complex emotional states that are harder for models to learn discretely.

Summary updated

BibTeX
@misc{zou2023spatial,
  author = {Peng Zou and Rui Wang and Kehua Wen and Yasi Peng and Xiao Sun},
  title = {{Spatial-temporal Transformer for Affective Behavior Analysis}},
  year = {2023},
  eprint = {2303.10561},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2303.10561},
}
Figure