CLIP4Clip: An Empirical Study of CLIP for End to End Video Clip Retrieval

Huaishao Luo, Lei Ji, Ming Zhong, Yang Chen, Wen Lei, Nan Duan, Tianrui Li

TL;DR

CLIP4Clip demonstrates how to effectively transfer the massive visual-linguistic knowledge of OpenAI’s CLIP model to the domain of video-text retrieval. By fine-tuning CLIP end-to-end and exploring various temporal modeling strategies, the researchers achieved new state-of-the-art (SOTA) results across five major video benchmarks, proving that image-text pre-training is a powerful foundation for understanding moving pictures.

What Problem Does This Paper Address?

Video-text retrieval—finding the right video based on a text query—is a cornerstone of modern search engines and social media. Historically, researchers approached this in two ways:

  1. Feature-level: Using "frozen" pre-trained video models to extract features and then training a retrieval model on top. This is fast but limits the model's ability to learn task-specific visual nuances.
  2. Pixel-level (End-to-End): Training the entire pipeline from raw pixels. This is more powerful but computationally expensive and often suffers from a lack of massive, high-quality video-text training data.

The authors ask: Can we take CLIP, a model trained on 400 million images and their captions, and "teach" it to understand videos? Specifically, they investigate how to handle the temporal dimension of video and whether the static image knowledge in CLIP translates to the dynamic world of video.

Methods

The authors propose CLIP4Clip, which uses the CLIP (specifically the ViT-B/32 version) as a backbone. The framework consists of a text encoder, a video encoder, and a similarity calculator.

The core of their empirical study lies in how they calculate similarity between a video (a sequence of frames) and a caption:

  • Parameter-free type: A simple approach where frame features are averaged (mean pooling) and compared to the text feature via cosine similarity.
  • Sequential type: Uses an LSTM or a Transformer encoder to model the temporal order of frames before pooling. This adds new learnable parameters to capture "what happens after what."
  • Tight type: A "heavy" interaction model where text and frame features are concatenated and fed into a joint Transformer. This allows for deep, cross-modal attention but is computationally heavier.
Figure 1: The framework of CLIP4Clip, which comprises three components, including two single-modal encoders and a similarity calculator. The model takes a video-text pair as input. For the input video, we first sample the input video into ordinal frames (images). Next, these image frames are reshaped into a sequence of flattened 2D patches. These patches are mapped to the 1D sequence of embeddings with a linear patch embedding layer and input to the image encoder for representation as in ViT (Dosovitskiy et al., 2021). Finally, the similarity calculator predicts the similarity score between the text representation and representation sequence of these frames. We investigate three types of similarity calculators in this work, including parameter-free, sequential, and tight types. ⊗means cosine similarity. We initial the two single-modal encoders with CLIP (ViT-B/32) (Radford et al., 2021).

Additionally, they experimented with 3D Linear Projection. While standard CLIP uses 2D patches for images, the authors tested 3D patches that span across time to better capture motion.

Comparison of 2D vs 3D linear projection for embedding video patches.

Datasets

The model was evaluated on five widely-used benchmarks:

  • MSR-VTT: 10k videos with 200k captions.
  • MSVD: ~2k short video clips.
  • LSMDC: Over 118k clips from movies.
  • ActivityNet: 20k YouTube videos for long-form video-paragraph retrieval.
  • DiDeMo: 10k videos annotated with localized sentences.

For "post-pretraining," they used a 380k video subset of the massive Howto100M dataset.

Key Insights and Ideas

  • End-to-End is King: Fine-tuning the visual backbone (the CLIP weights) on raw pixels significantly outperforms using fixed features. The model learns to "see" video frames in a way that specifically helps it match them to text.
  • Mean Pooling is a "Strong Baseline": Surprisingly, simply averaging frame features (Parameter-free) is often enough to beat previous SOTA models, especially on smaller datasets. It turns out CLIP’s individual frame representations are incredibly descriptive.
  • Temporal Modeling Scales with Data: While mean pooling is great for small datasets, adding a Transformer to model sequence (Sequential type) provides a boost on larger datasets like MSR-VTT (9K split) and LSMDC, where there is enough data to train the new parameters.
  • The 3D Patch Pitfall: Against expectations, 3D linear projections performed worse than 2D. The authors attribute this to the "initialization gap"—CLIP was pre-trained on 2D images, and trying to force those weights into a 3D structure without massive video pre-training disrupts the learned knowledge.

Key Results

CLIP4Clip achieved SOTA results across the board. On the MSR-VTT dataset (1k-A test split), the model reached a Recall@1 of 44.5%, a massive jump from previous leaders like MDMMT (38.9%) and Frozen (31.0%).

On MSVD, the improvement was even more dramatic, reaching 46.2% R@1, compared to the previous best of 37.0% from a zero-shot CLIP baseline. The results consistently show that CLIP4Clip is not just better, but often better by a double-digit margin.

Limitations and Future Work

  • Computational Cost: Training end-to-end on raw video is expensive. The authors' post-pretraining on a relatively small subset (380k videos) took two weeks on 8 V100 GPUs.
  • 3D Initialization: The failure of 3D patches suggests that better ways to initialize temporal layers from image-based weights are needed.
  • Dataset Noise: Large-scale video datasets like Howto100M are notoriously noisy (the audio/text doesn't always match the visual). The authors suggest that exploring more robust pre-training objectives on even larger datasets is a promising next step.

Summary updated

BibTeX
@inproceedings{luo2022clip,
  author = {Huaishao Luo and Lei Ji and Ming Zhong and Yang Chen and Wen Lei and Nan Duan and Tianrui Li},
  title = {{CLIP4Clip: An Empirical Study of CLIP for End to End Video Clip Retrieval}},
  booktitle = {Neurocomputing},
  year = {2022},
  url = {https://openreview.net/forum?id=oG9PstSeJfEy},
}
Figure