Riemannian Self-Attention Mechanism for SPD Networks

Rui Wang, Xiao-Jun Wu, Hui Li, Josef KittlerarXiv 2023 · DOI

Introduction

In computer vision, Symmetric Positive Definite (SPD) matrices, such as covariance matrices, are powerful tools for capturing spatiotemporal statistics in video and skeleton data. However, these matrices do not belong to a flat Euclidean space; instead, they reside on a curved Riemannian manifold. While specialized architectures like SPDNet have been developed to handle this geometry, they often suffer from "information degradation" as the network depth increases. This paper introduces the SPD Manifold Self-Attention (SMSA) mechanism to address this limitation by mining relationships between features across different layers.

The SMSA-GLM Architecture

The core contribution is the SPD Manifold Self-Attention Mechanism-based Geometric Learning Module (SMSA-GLM). This module acts as a bridge between various hidden layers of a backbone network, using Riemannian attention to generate refined, discriminative representations.

Architecture of the SMSA-GLM, illustrating the flow from backbone features to the manifold-aware attention layers.

To implement self-attention on a manifold, the authors redefined three fundamental operations:

  1. Similarity Measurement (Query & Key): Standard dot-products are replaced by the Log-Euclidean Metric (LEM) to calculate distances between SPD matrices.
  2. Weighting (Softmax): Specialized SIM and SMX layers transform these distances into valid attention weights.
  3. Aggregation (Value): Instead of a simple weighted sum, the module computes a weighted Fréchet Mean. By utilizing the LEM, the authors derived a closed-form solution for this mean, ensuring computational efficiency for backpropagation.

Bridging the Depth Gap

A key insight of the SMSA mechanism is its ability to bridge the gap between different network layers. By selecting features from various depths to serve as Queries (Q), Keys (K), and Values (V), the network can "remember" structural information that might otherwise be lost during nonlinear mappings in deeper stages.

Selection rules for Query (Q), Key (K), and Value (V) matrices from different network layers (H) based on the total number of SMAEs (E).

As shown in the selection rules, the module strategically picks hidden states ($H_i$) to ensure that the attention mechanism effectively integrates multi-scale temporal and structural information. This approach helps maintain performance even as models scale to over 100 layers.

Experimental Evaluation

The SMSA-GLM was evaluated on three major benchmarks:

  • AFEW (Acted Facial Expressions in the Wild): Achieved 38.65% accuracy, outperforming the DSPDNet baseline (36.82%).
  • FPHA (First-Person Hand Action): Reached 88.83% accuracy. Crucially, while baseline performance typically drops with increased depth, the SMSA-equipped version remained stable.
  • UAV-Human: Achieved 44.73% accuracy, demonstrating scalability to large-scale datasets with complex viewpoints.

Visualization of feature maps revealed that SMSA helps "diagonalize" SPD matrices, concentrating energy into principal components and effectively denoising the data representation.

Conclusion and Future Work

The SMSA mechanism successfully mitigates information degradation in deep SPD networks by introducing a geometrically consistent self-attention module. While the reliance on eigenvalue decompositions (EIG) currently presents a computational bottleneck, future work will focus on approximate computation strategies to enable full GPU acceleration and the development of a complete "Riemannian Transformer."

Summary updated

BibTeX
@misc{wang2023riemannian,
  author = {Rui Wang and Xiao-Jun Wu and Hui Li and Josef Kittler},
  title = {{Riemannian Self-Attention Mechanism for SPD Networks}},
  year = {2023},
  eprint = {2311.16738},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2311.16738},
}
Figure