Video understanding, tracking, generation, and world models · Video-language learning · VID044 · Model
CLIP4Clip
Adapts pretrained CLIP image-text representations to video retrieval by comparing temporal aggregation and similarity strategies.
In CodeSplash
Running this needs images, audio, video, graphs or another data type CodeSplash doesn't load yet.
- Availability
- Needs a data type CodeSplash doesn't load yet
- Code example
- Component demo, not a trained model
- Who ran it
- CodeSplash's run and the reference's record
- CodeSplash's run
- The reference's example ran in Python and R here, and they agree.
- The reference's record
- Python: Ran in the reference's review. The report doesn't record which version of the code ran. R: Reviewed but not run: R wasn't available to the reference's authors.
Purpose
Adapts pretrained CLIP image-text representations to video retrieval by comparing temporal aggregation and similarity strategies. It is useful for understanding how far a strong image-language model can go when combined with sparse video frames.
Question / objective
Align video evidence with language for retrieval, recognition, captioning or grounded answers. This is a learning or inference objective, not a test of a statistical null hypothesis.
Method type and supervision
model · Video-language learning. Weak paired video/text pretraining and/or supervised instruction learning, depending on the entry.
Architecture / computational structure
CLIP frame encoder and text encoder with a selected temporal similarity/aggregation module.
Assumptions
Inputs must satisfy the temporal, modality and annotation protocol described below. Mean pooling loses order, so reverse actions can share representations. Strong retrieval scores may reflect scene or object overlap without precise event understanding.
Formula / computational definition
, ; the temporal operator may be simple pooling or a learned module.
Parameters and notation
Learned/estimated quantities: Modality encoders, connectors, projections and language-model weights may be learned or frozen according to the stated stage; token IDs and timestamps are inputs. Symbols specific to the objective are defined with the equation. Hyperparameters and design choices: Frame sampling, temporal operator, which encoder layers are tuned, temperature and video/text batch pairing matter.
Fitting, fine-tuning, and adaptation
Train the temporal module or projection first, then optionally tune late CLIP layers. Retain image-text evaluation to check that video adaptation has not erased broad alignment. Use a separate adaptation validation split, monitor the target metric and retention of previously useful behavior, and save the exact preprocessing and training configuration.
How to use and calibrate
Fix the input protocol and target before fitting; choose design settings on held-out source videos, then freeze the evaluation procedure. Compare pooling and learned temporal variants under identical data, plus order-reversal and hard-caption tests.
Example application
Rank short videos against a text search query.
Interpretation / pitfalls
Watch out
An optimized training objective or a favorable example does not establish generalization. Compare pooling and learned temporal variants under identical data, plus order-reversal and hard-caption tests. The example below isolates one mechanism and cannot substantiate a full-model benchmark claim.
Python and R code examples
Component: Show why mean-pooled video embeddings lose temporal order. Dependencies: NumPy in Python; base R in R; run the shared setup above. Python component: executed successfully. R component: unexecuted. No complete model training or pretrained inference was executed.
Full implementation route — Python: Encode sampled frames with a verified CLIP implementation, reproduce the chosen temporal variant and fine-tuning recipe. R: Aggregate frame embeddings and compute retrieval metrics directly in R; bridge the CLIP encoders rather than assume native weight compatibility.
Python and R
The reference's own programs, shown as written. A component demo shows one central piece of the method; it doesn't train a full model.
Component demo, not a trained model — Show why mean-pooled video embeddings lose temporal order.
Shared setup for this chapter
import numpy as np
def softmax(x):
z = np.asarray(x, dtype=float)
e = np.exp(z - z.max())
return e / e.sum()
frames = np.array([[1.,0.],[0.,1.],[.5,.5]])
forward = frames.mean(axis=0); reverse = frames[::-1].mean(axis=0)
text = np.array([1.,0.])
print("same pooled representation",np.allclose(forward,reverse))
print("text similarity",forward@text/np.linalg.norm(forward))
Component demo, not a trained model — Show why mean-pooled video embeddings lose temporal order.
Shared setup for this chapter
softmax <- function(x) {
e <- exp(x - max(x))
e / sum(e)
}
frames <- rbind(c(1,0),c(0,1),c(.5,.5))
forward <- colMeans(frames); reverse <- colMeans(frames[3:1,])
print(isTRUE(all.equal(forward,reverse)))
print(sum(forward*c(1,0))/sqrt(sum(forward^2)))
Sources
- Source 1arxiv.org
From the CodeSplash reference, entry VID044.