Video-Language Alignment via Spatio-Temporal Graph Transformer

Shi-Xue Zhang, Hongfa Wang, Xiaobin Zhu, Weibo Gu, Tianjin Zhang, Chun Yang, Wei Liu, Xu-Cheng YinarXiv 2024

Abstract

Video-language alignment is a crucial multi-modal task that benefits various downstream applications, e.g., video-text retrieval and video question answering. Existing methods either utilize multi-modal information in video-text pairs or apply global and local alignment techniques to promote alignment precision. However, these methods often fail to fully explore the spatio-temporal relationships among vision tokens within video and across different video-text pairs. In this paper, we propose a novel Spatio-Temporal Graph Transformer module to uniformly learn spatial and temporal contexts for video-language alignment pre-training (dubbed STGT). Specifically, our STGT combines spatio-temporal graph structure information with attention in transformer block, effectively utilizing the spatio-temporal contexts. In this way, we can model the relationships between vision tokens, promoting video-text alignment precision for benefiting downstream tasks. In addition, we propose a self-similarity alignment loss to explore the inherent self-similarity in the video and text. With the initial optimization achieved by contrastive learning, it can further promote the alignment accuracy between video and text. Experimental results on challenging downstream tasks, including video-text retrieval and video question answering, verify the superior performance of our method.

Introduction

Aligning video with natural language is inherently challenging because videos are more than just a sequence of images; they contain complex spatial and temporal dependencies. Current alignment methods often suffer from two primary limitations. First, Coarse Fusion techniques frequently average frame-level features, which washes out fine-grained "who-is-doing-what-where" information. Second, the "Hard Negative" Fallacy in standard contrastive learning treats every video-text pair that isn't an exact match as a "negative" sample. In large-scale datasets, two different videos might share significant semantic content (e.g., "a dog playing in a park"). Forcing the model to treat these as completely dissimilar creates noisy gradients that hinder effective learning.

Spatio-temporal relationships and cross-similarity challenges in video-language alignment.

Methodology

To address these challenges, we introduce the Spatio-Temporal Graph Transformer (STGT) framework. This framework integrates graph-based structural modeling with transformer attention and a novel cross-similarity alignment loss to achieve high-precision multi-modal alignment.

Spatio-Temporal Graph Transformer (STGT)

Instead of treating video patches (vision tokens) as a flat sequence, STGT treats them as nodes in a graph.

  • Graph Construction: The model calculates similarity between tokens within a frame (spatial) and across adjacent frames (temporal). If the similarity exceeds a threshold ($\hbar$), an edge is created, allowing the model to focus on related objects as they move through time.
  • Topology-Aware Attention: This graph structure is integrated directly into the Transformer's attention mechanism. This allows the model to track specific objects across frames while ignoring irrelevant background noise.
  • Efficiency: To maintain computational efficiency, a Max-Pooling Sampling strategy is used to down-sample local features without losing critical information.
Overview of the STGT framework architecture, including the vision feature encoder, STGT module, and cross-similarity alignment loss.

Cross-Similarity Alignment Loss (CSAL)

To mitigate the "hard negative" problem, we introduce the Cross-Similarity Alignment Loss (CSAL). This loss function evaluates the inherent similarity between different videos and different text descriptions before performing the final alignment. By acknowledging that semantic meaning exists on a spectrum rather than a binary match/no-match, CSAL allows the model to assign similar embeddings to semantically related pairs, even if they are not exact ground-truth matches.

Experiments and Results

The model was pre-trained on massive video-language datasets, including WebVid-2M, WebVid-10M, CC3M, and VIDAL-10M. Evaluation on downstream tasks demonstrates the superior performance of STGT:

  • Video-Text Retrieval: On the MSRVTT dataset, STGT achieved a 13.7% gain in Mean Recall (R-Mean) over Clover and a 9.3% gain over CLIP4Clip in zero-shot settings.
  • Video Question Answering: When paired with a Large Language Model (Vicuna-7B), the system reached 58.8% accuracy on MSRVTT-QA, a significant leap over the previous state-of-the-art (Clover at 44.1%).
  • Efficiency: Despite the added graph complexity, the model is nearly twice as efficient as competitors like ALPRO in terms of Frames Per Second (FPS), thanks to its sparse graph design and max-pooling sampling.

Conclusion

The Spatio-Temporal Graph Transformer (STGT) significantly improves video-language alignment by effectively modeling spatio-temporal contexts and addressing the limitations of standard contrastive learning via the CSAL loss. Future work includes exploring the integration of additional modalities like audio or depth into the graph structure to create a more holistic video understanding agent.

Summary updated

BibTeX
@misc{zhang2024video,
  author = {Shi-Xue Zhang and Hongfa Wang and Xiaobin Zhu and Weibo Gu and Tianjin Zhang and Chun Yang and Wei Liu and Xu-Cheng Yin},
  title = {{Video-Language Alignment via Spatio-Temporal Graph Transformer}},
  year = {2024},
  eprint = {2407.11677},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2407.11677},
}
Figure