Few-Shot Video Classification via Temporal Alignment

Kaidi Cao, Jingwei Ji, Zhangjie Cao, Chien-Yi Chang, Juan Carlos Niebles

Abstract: Difficulty in collecting and annotating large-scale video data raises a growing interest in learning models which can recognize novel classes with only a few training examples. In this paper, we propose the Ordered Temporal Alignment Module (OTAM), a novel few-shot learning framework that can learn to classify a previously unseen video. While most previous work neglects long-term temporal ordering information, our proposed model explicitly leverages the temporal ordering information in video data through ordered temporal alignment. This leads to strong data-efficiency for few-shot learning. In concrete, our proposed pipeline learns a deep distance measurement of the query video with respect to novel class proxies over its alignment path. We adopt an episode-based training scheme and directly optimize the few-shot learning objective. We evaluate OTAM on two challenging real-world datasets, Kinetics and Something-Something-V2, and show that our model leads to significant improvement of few-shot video classification over a wide range of competitive baselines and outperforms state-of-the-art benchmarks by a large margin.

Introduction

Few-shot learning aims to recognize new categories using only one or a few examples—for instance, seeing one video of "unboxing" and being able to recognize others. While this is well-studied for images, video adds a complex temporal dimension that traditional models often struggle to capture effectively.

Most existing video models rely on "temporal pooling," which essentially averages the features of all frames. This approach is "temporally agnostic"; it can identify what objects are in a video but struggles to distinguish between actions where the sequence matters, such as "opening a door" versus "closing a door." Furthermore, different people perform the same action at different speeds or durations, creating non-linear temporal variations that simple averaging cannot handle.

Conceptual overview of temporal alignment between a query video and support set examples.

The Ordered Temporal Alignment Module (OTAM)

The Ordered Temporal Alignment Module (OTAM) is a novel framework that addresses these challenges by explicitly modeling the chronological order of actions. OTAM treats video classification as a sequence matching problem, finding the optimal alignment between a query video and a small set of labeled support examples.

The Pipeline

The OTAM architecture consists of several key stages:

  1. Embedding Module: A ResNet-50 backbone extracts deep features for each frame of the video.
  2. Frame-level Distance Matrix: For a pair of videos (Query and Support), the model calculates a distance matrix where each entry represents the cosine distance between a frame in the query and a frame in the support video.
  3. Ordered Temporal Alignment: Instead of averaging the matrix, OTAM finds the "optimal path" through it using a variant of Dynamic Time Warping (DTW). This path represents the best chronological alignment between the two sequences.
  4. Differentiable Relaxation: Standard DTW is not differentiable, making it difficult to train with neural networks. OTAM utilizes a log-sum-exp approximation to make the alignment process end-to-end trainable.
  5. Flexible Boundaries: Unlike standard DTW, which forces the first and last frames to match, OTAM allows for flexible start and end points. This is crucial because trimmed videos often contain "buffer" frames before or after the actual action.
The OTAM architecture: from frame embedding to ordered temporal alignment and classification.

Key Insights

  • The "Arrow of Time" is Essential: Preserving the order of frames is more important than just having high-quality per-frame features. Even if two videos have similar frames, if the sequence is wrong, OTAM can correctly reject the match.
  • Warping Handles Variation: Because OTAM can "warp" time (matching one frame in video A to multiple frames in video B), it is robust to variations in how fast an action is performed.
  • Learning to Align: Because the module is differentiable, the feature extractor learns to produce representations that are specifically optimized for chronological alignment during the meta-training phase.

Experimental Results

The model was evaluated on two major benchmarks adapted for the few-shot setting (64 classes for training, 12 for validation, and 24 for testing):

  • Kinetics-400: A large-scale dataset of YouTube videos. These are often "appearance-heavy," where the background or objects provide strong clues.
  • Something-Something-V2: A dataset focused on basic human interactions (e.g., "pushing something from left to right"). This dataset is "temporally-heavy," meaning the action cannot be identified without looking at the sequence of movement.

OTAM achieved state-of-the-art results on both datasets, showing particular strength in the 1-shot scenario:

Dataset Metric OTAM (Ours) Previous Best (CMN/TARN)
Kinetics 1-shot Accuracy 73.0% 64.8% (TARN)
Kinetics 5-shot Accuracy 85.8% 78.9% (CMN)
Something-Something 1-shot Accuracy 42.8% 34.4% (CMN++)
Something-Something 5-shot Accuracy 52.3% 43.8% (CMN++)

The 8-9% jump in accuracy on Something-Something is particularly significant, confirming that OTAM excels at tasks where temporal ordering is the primary differentiator.

Conclusion

OTAM demonstrates that explicit temporal alignment is a powerful tool for few-shot video classification. While it introduces more computational complexity than simple mean pooling, the gains in accuracy—especially on temporally-heavy datasets—are substantial. Future work may focus on improving the interpretability of alignment paths and extending this logic to longer, untrimmed video sequences.

Summary updated

BibTeX
@inproceedings{cao2020few,
  author = {Kaidi Cao and Jingwei Ji and Zhangjie Cao and Chien-Yi Chang and Juan Carlos Niebles},
  title = {{Few-Shot Video Classification via Temporal Alignment}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2020},
  url = {https://openreview.net/forum?id=Qao5KaiU3p},
}
Figure