Clustering and Recognition of Spatiotemporal Features through Interpretable Embedding of Sequence to Sequence Recurrent Neural Networks

Kun Su, Eli Shlizerman · DOI

Abstract

Encoder-decoder recurrent neural network models (RNN Seq2Seq) have achieved great success in ubiquitous areas of computation and applications. It was shown to be successful in modeling data with both temporal and spatial dependencies for translation or prediction tasks. In this study, we propose an embedding approach to visualize and interpret the representation of data by these models. Furthermore, we show that the embedding is an effective method for unsupervised learning and can be utilized to estimate the optimality of model training. In particular, we demonstrate that embedding space projections of the decoder states of RNN Seq2Seq model trained on sequences prediction are organized in clusters capturing similarities and differences in the dynamics of these sequences. Such performance corresponds to an unsupervised clustering of any spatio-temporal features and can be employed for time-dependent problems such as temporal segmentation, clustering of dynamic activity, self-supervised classification, action recognition, failure prediction, etc. We test and demonstrate the application of the embedding methodology to time-sequences of 3D human body poses. We show that the methodology provides a high-quality unsupervised categorization of movements.

Introduction

While Sequence-to-Sequence (Seq2Seq) models have become standard tools for predicting spatiotemporal data, such as human motion or sensor readings, they are often treated as "black boxes." Understanding how their internal hidden states represent the essence of a movement is critical for both interpretability and ensuring training optimality. This research addresses these challenges by proposing a framework to create an interpretable embedding of the network's internal states, allowing researchers to visualize the latent representations constructed during training.

Methodology

Seq2Seq Architecture

The study utilizes a standard RNN Seq2Seq architecture, specifically employing Gated Recurrent Units (GRUs). The encoder processes an input sequence $X = [x_1, ..., x_{T_e}]$, while the decoder predicts the future sequence $\hat{Y} = [\hat{y}_1, ..., \hat{y}_{T_d}]$.

The Seq2Seq RNN architecture used for spatiotemporal sequence prediction, showing the flow from encoder states to decoder outputs.

Interpretable Embedding via Dimensionality Reduction

To make the high-dimensional hidden states readable, the authors apply Proper Orthogonal Decomposition (POD) via Singular Value Decomposition (SVD). Hidden state matrices from the encoder ($E$) and decoder ($D$) are stacked into "snapshot matrices." By projecting these states onto the top 2 or 3 Principal Components (PCs), a 3D map of the network's internal logic is created.

Overview of the embedding methodology: stacking hidden states into snapshot matrices and projecting them into low-dimensional principal component spaces to reveal attractor dynamics.

A key insight of this work is the "steering" role of the encoder. Rather than only the final state being important, the entire encoder trajectory moves the representation from a neutral origin toward a specific "attractor" in the embedding space. Once the decoder takes over, its evolution follows a trajectory within these attractors, which represent specific identities or classes of motion (e.g., walking vs. sitting).

Experimental Results

Unsupervised Action Recognition

The methodology was validated using the Human 3.6 Million (H3.6M) and CMU Motion Capture datasets. By applying K-means++ clustering to the decoder's hidden states in the embedding space, the researchers achieved an unsupervised action recognition accuracy of 94.75% on the CMU dataset. This significantly outperforms previous state-of-the-art unsupervised methods like TSSC-LC (86.08%) and ACA (84.50%).

Monitoring Training and Overfitting

The geometric properties of the embedding space serve as a visual diagnostic tool for training. Well-trained models show distinct, separable clusters for different actions. If the model begins to overfit—for instance, if it is trained too heavily on a single action type—the embedding space collapses, and all inputs are pulled toward a single attractor regardless of their actual dynamics. This provides a clear indicator of when a model has stopped learning generalizable features.

Conclusion

This embedding approach demonstrates that the internal logic of complex RNNs is surprisingly low-dimensional, with 90-99% of state variance often captured by fewer than 20 modes. Beyond action recognition, this interpretability framework opens doors for real-time temporal segmentation and failure prediction, where a model's deviation from known attractors can signal an impending error. Future work may extend these findings to deeper architectures and automated cluster parameter selection.

Summary updated

Abstract

Encoder-decoder recurrent neural network models (RNN Seq2Seq) have achieved great success in ubiquitous areas of computation and applications. It was shown to be successful in modeling data with both temporal and spatial dependencies for translation or prediction tasks. In this study, we propose an embedding approach to visualize and interpret the representation of data by these models. Furthermore, we show that the embedding is an effective method for unsupervised learning and can be utilized to estimate the optimality of model training. In particular, we demonstrate that embedding space projections of the decoder states of RNN Seq2Seq model trained on sequences prediction are organized in clusters capturing similarities and differences in the dynamics of these sequences. Such performance corresponds to an unsupervised clustering of any spatio-temporal features and can be employed for time-dependent problems such as temporal segmentation, clustering of dynamic activity, self-supervised classification, action recognition, failure prediction, etc. We test and demonstrate the application of the embedding methodology to time-sequences of 3D human body poses. We show that the methodology provides a high-quality unsupervised categorization of movements.
BibTeX
@article{su2020clustering,
  author = {Kun Su and Eli Shlizerman},
  title = {{Clustering and Recognition of Spatiotemporal Features through Interpretable Embedding of Sequence to Sequence Recurrent Neural Networks}},
  journal = {Frontiers Artif. Intell.},
  year = {2020},
  doi = {10.3389/frai.2020.00070},
}
Figure