NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Temporal Transformer Networks: Joint Learning of Invariant and Discriminative Time Warping.

Suhas Lohit, Qiao Wang, Pavan K. Turaga

Abstract

Many time-series classification problems involve developing metrics that are invariant to temporal misalignment. In human activity analysis, temporal misalignment arises due to various reasons including differing initial phase, sensor sampling rates, and elastic time-warps due to subject-specific biomechanics. Past work in this area has only looked at reducing intra-class variability by elastic temporal alignment. In this paper, we propose a hybrid model-based and data-driven approach to learn warping functions that not just reduce intra-class variability, but also increase inter-class separation. We call this a temporal transformer network (TTN). TTN is an interpretable differentiable module, which can be easily integrated at the front end of a classification network. The module is capable of reducing intra-class variance by generating input-dependent warping functions which lead to rate-robust representations. At the same time, it increases inter-class variance by learning warping functions that are more discriminative. We show improvements over strong baselines in 3D action recognition on challenging datasets using the proposed framework. The improvements are especially pronounced when training sets are smaller.

Introduction

Temporal misalignment is a pervasive challenge in time-series analysis, particularly in human activity recognition. Variations in execution speed, initial phase, and individual biomechanics lead to significant intra-class variance. While traditional methods like Dynamic Time Warping (DTW) address alignment, they are often computationally heavy, non-differentiable, and class-agnostic. Deep learning models like LSTMs attempt to learn these variations but require vast amounts of data to achieve rate-invariance. We present the Temporal Transformer Network (TTN), a differentiable module that learns input-dependent warping functions to simultaneously reduce intra-class variability and increase inter-class separation.

Methodology: The Temporal Transformer Network

The TTN is designed as a front-end module that can be integrated into any standard classification pipeline. It performs selective temporal warping on input sequences to produce rate-robust representations.

Overview of the Temporal Transformer Network (TTN) integrated with a classifier.

The architecture consists of three primary stages:

  1. Trainable Layers: A sub-network (typically CNN or Fully Connected) processes the input sequence to predict a warping derivative vector.
  2. Constraint Satisfaction: To ensure the warping is a valid diffeomorphism (smooth, order-preserving, and boundary-constrained), the network's output is mapped onto a probability simplex. A cumulative sum of this simplex yields a monotonically increasing warping function that maps the sequence's start and end points correctly.
  3. Differentiable Resampling: The input sequence is resampled according to the predicted warping function using linear interpolation. This differentiability allows the entire TTN-Classifier system to be optimized via backpropagation.
Visualization of the temporal warping process on a 3D skeleton action sequence.

Key Insights

Discriminative Warping

Unlike traditional alignment methods that are class-agnostic, the TTN is discriminative. It learns to warp different classes in ways that maximize their separation in the feature space. By exploiting the non-uniqueness of signal alignment, the network identifies the specific temporal transformation that best aids classification.

Explainability and Data Efficiency

The TTN offers a degree of interpretability often missing in deep learning. The 1D warping function can be visualized to see how the model stretches or compresses specific parts of an action. Furthermore, by imposing geometric constraints on temporal variation, the TTN significantly improves performance on smaller datasets where models otherwise struggle to learn rate-invariance.

Experimental Results

The TTN was evaluated on several benchmarks, including the ICL First-Person Hand Action and NTU RGB-D datasets.

  • ICL Hand Action: Adding TTN to a TCN-32 baseline improved accuracy from 81.74% to 82.75%. More impressively, when the data was subjected to random affine warps, the TTN-equipped model maintained 78.26% accuracy, while the baseline dropped to 70.43%.
  • NTU RGB-D: On this large-scale dataset, the TCN + TTN combination achieved state-of-the-art results with 77.55% (Cross-Subject) and 84.25% (Cross-View) accuracy.

Conclusion

Temporal Transformer Networks provide a robust, interpretable, and differentiable solution to temporal misalignment in time-series data. By jointly learning invariant and discriminative warps, TTNs enhance classification performance and robustness, particularly in data-constrained scenarios. Future work includes extending this framework to raw video data and exploring unsupervised pattern discovery.

Summary updated

BibTeX
@inproceedings{lohit2019temporal,
  author = {Suhas Lohit and Qiao Wang and Pavan K. Turaga},
  title = {{Temporal Transformer Networks: Joint Learning of Invariant and Discriminative Time Warping.}},
  booktitle = {CVPR},
  year = {2019},
  url = {https://openreview.net/forum?id=ri-VNaMxd6S},
}
Figure