Learning Discriminative Prototypes With Dynamic Time Warping

Xiaobin Chang, Frederick Tung, Greg Mori

Abstract

Temporal data analysis, encompassing domains from financial forecasting to video understanding, is frequently complicated by variations in sequence length and execution speed. While Dynamic Time Warping (DTW) is the standard for aligning such "warped" sequences, traditional prototype-based methods often lack the discriminative power necessary for high-accuracy classification. This paper introduces Discriminative Prototype Dynamic Time Warping (DP-DTW), a novel framework that learns representative sequences (prototypes) as trainable parameters within an end-to-end deep learning pipeline. By optimizing prototypes to be both representative and discriminative, the model achieves state-of-the-art performance in time series classification and weakly supervised action segmentation, while simultaneously providing automated video summarization capabilities.

Introduction

Analyzing temporal sequences is inherently difficult because instances of the same class rarely share identical temporal structures. For example, two people performing the same action may do so at different speeds or with varying durations. Traditional DTW solves the alignment problem but is often used as a fixed distance metric rather than a learnable component.

Existing techniques like DTW Barycenter Averaging (DBA) generate prototypes by simply averaging samples within a class. This approach suffers from two primary limitations: it ignores inter-class differences, leading to prototypes that may not be sufficiently distinct for classification, and it typically operates outside of the feature learning process. DP-DTW addresses these gaps by integrating prototype learning directly into backpropagation-based optimization.

Methodology

DP-DTW treats prototypes as learnable parameters, allowing them to evolve alongside the feature extractor (e.g., a Gated Recurrent Unit or GRU).

Time Series Classification (TSC)

In the TSC setting, the model learns one prototype per category. It employs a dual-objective loss function:

  1. Cross-Entropy Loss: This ensures that an input sequence is significantly closer to its ground-truth class prototype than to prototypes of other classes, thereby maximizing inter-class discrimination.
  2. Distance Loss: This regularizes the prototype to ensure it remains a faithful, representative "anchor" for the samples within its class.

Weakly Supervised Action Segmentation

The framework's most significant application is in weakly supervised video analysis, where frame-level annotations are unavailable. Instead, the model is provided only with a transcript—an ordered list of actions (e.g., "Add teabag" followed by "Pour water").

Overview of DP-DTW for weakly supervised action segmentation training and testing.

During training, DP-DTW concatenates the learned prototypes for each action in the transcript to form a "master" sequence. A Hinge Loss is then applied to ensure the video's features align more closely with this correct ordering than with random or incorrect permutations. Because the alignment is explicit, the model naturally learns to localize actions within the video stream.

Experimental Results

The authors evaluated DP-DTW across diverse benchmarks, demonstrating its robustness and versatility.

Time Series Benchmarks

On the UCR Archive, which contains 128 univariate datasets, DP-DTW outperformed the traditional 1-Nearest Neighbor + DTW approach on 82.8% of the datasets. Crucially, it significantly surpassed the previous state-of-the-art prototype method, DBA, across every single dataset in the archive. Statistical analysis via Critical Difference (CD) diagrams confirms that DP-DTW holds the highest average rank among competing methods.

Critical Difference diagram showing the statistical superiority of DP-DTW over baselines on the UCR archive.

Action Segmentation and Summarization

In video analysis, the model was tested on the Hollywood Extended and Breakfast datasets. On Hollywood Extended, DP-DTW improved frame-level accuracy by 10.6% over the previous state-of-the-art (CDFL).

Beyond classification, the explicit alignment between video frames and prototypes enables "for-free" video summarization. By selecting frames that best match the learned prototype steps, the model generates action-based summaries. These summaries achieved 62.5% accuracy in selecting representative frames, a substantial improvement over the 40.8% achieved by uniform sampling.

Discussion and Conclusion

DP-DTW represents a significant step forward in temporal data modeling by turning prototypes into active, discriminative reasoning tools. By providing an explicit mapping between input data and learned references, the model offers a degree of interpretability often missing in deep learning.

However, limitations remain. The model currently uses fixed-length prototypes, which may not capture the full complexity of actions with high temporal variance. Additionally, while the model excels at localizing the core of an action, pinpointing exact boundaries between consecutive actions remains a challenge. Future research will likely focus on adaptive prototype lengths and improving boundary precision to further refine the segmentation process.

Summary updated

BibTeX
@inproceedings{chang2021learning,
  author = {Xiaobin Chang and Frederick Tung and Greg Mori},
  title = {{Learning Discriminative Prototypes With Dynamic Time Warping}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2021},
  doi = {10.1109/cvpr46437.2021.00829},
}
Figure