Learning by Aligning Videos in Time

Sanjay Haresh, Sateesh Kumar, Huseyin Coskun, Shahram Najam Syed, Andrey Konin, Muhammad Zeeshan Zia, Quoc-Huy Tran

Abstract

Learning robust video representations typically requires extensive frame-level annotations. This paper introduces Learning by Aligning Videos (LAV), a self-supervised framework that learns from temporal alignment. By utilizing a differentiable Soft-DTW loss combined with a novel Contrastive Inverse Difference Moment (IDM) regularization, LAV maps videos of the same action into a shared embedding space. This approach effectively captures the global structure of activities, outperforming existing methods in phase classification and few-shot learning across diverse datasets like IKEA ASM and Penn Action.

Introduction

Deep learning has significantly advanced video understanding, yet it remains constrained by the high cost of manual annotation. Labeling every frame of thousands of videos to identify specific action phases—such as the start of a "pour" or the impact of a "golf swing"—is prohibitively expensive. While self-supervised learning (SSL) offers a path forward, many current methods focus on local temporal cues rather than the global progression of an activity.

The proposed Learning by Aligning Videos (LAV) method addresses this by introducing a pretext task: Temporal Video Alignment. The goal is to map two videos of the same action (e.g., pouring water) into a shared embedding space where corresponding phases align temporally, regardless of variations in appearance or camera angle.

Overview of the Temporal Video Alignment framework mapping image space to a shared embedding space.

Methodology

The LAV framework consists of three primary components designed to learn structured temporal representations without explicit labels.

1. Soft-DTW Alignment Loss

The model employs a differentiable version of Dynamic Time Warping (DTW). Unlike standard DTW, Soft-DTW allows for backpropagation, enabling the neural network to find an optimal alignment path between two video sequences in the embedding space.

2. Contrastive-IDM Regularization

A significant challenge in alignment-based training is "representation collapse," where the network maps all frames to a single point to achieve a perfect alignment score. To counter this, the authors introduce Contrastive Inverse Difference Moment (IDM). This regularization term enforces temporal spread by pushing distant frames apart in the embedding space while keeping adjacent frames close.

3. Architecture

The system utilizes a ResNet-50 backbone for feature extraction, followed by 3D convolutional layers to capture multi-frame temporal context. The final output is a 128-dimensional linear projection representing the video state.

Detailed architecture of the LAV encoder and the dual-loss training objective involving Soft-DTW and Contrastive-IDM.

Experimental Evaluation

The model was benchmarked on three datasets: Pouring, Penn Action (for which the authors provided new dense annotations), and IKEA ASM.

Key Results

  • Phase Classification: On the complex IKEA ASM dataset, LAV achieved ~30% accuracy, outperforming the previous state-of-the-art Temporal Cycle Consistency (TCC) method (~25%).
  • Fine-Grained Retrieval: LAV demonstrated superior precision in frame retrieval tasks, achieving an AP@5 of 89.13% on the Pouring dataset.
  • Label Efficiency: LAV excels in low-data regimes. For the "Bowling" action in Penn Action, a model trained with LAV and a single labeled video performed comparably to a fully supervised model trained on 134 videos.

Discussion and Future Work

LAV effectively captures the global "flow" of activities by aligning entire sequences rather than individual frames. The Contrastive-IDM term is crucial for preventing trivial solutions and ensuring the learned embeddings reflect the progression of the action. Furthermore, the method exhibits strong viewpoint invariance, focusing on the state of the action rather than environmental factors.

Current limitations include the requirement for pre-paired videos of the same action and a reliance on linear temporal progression. Future research may explore more flexible alignment losses capable of handling non-linear sub-step ordering and untrimmed video streams.

Summary updated

BibTeX
@inproceedings{haresh2021learning,
  author = {Sanjay Haresh and Sateesh Kumar and Huseyin Coskun and Shahram Najam Syed and Andrey Konin and Muhammad Zeeshan Zia and Quoc-Huy Tran},
  title = {{Learning by Aligning Videos in Time}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2021},
  url = {https://openreview.net/forum?id=r75UpoJzcEW},
}
Figure