Skip to content

Video understanding, tracking, generation, and world models · Video self-supervision · VID028 · Model

InternVideo

Combines complementary generative and discriminative video-learning objectives to build broadly useful video representations.

Explained here Component demo, not a trained model CodeSplash's run and the reference's record

In CodeSplash

Documented in the Academy only. There's no Set up button.

Availability
Explained here
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

Combines complementary generative and discriminative video-learning objectives to build broadly useful video representations. It connects masked video learning with cross-modal alignment, supporting recognition, retrieval and other understanding tasks.

Question / objective

Learn transferable video representations from automatically constructed targets or weak cross-modal supervision. This is a learning or inference objective, not a test of a statistical null hypothesis.

Method type and supervision

model · Video self-supervision. Self-supervised pretraining; cross-modal variants also use weak paired language supervision.

Architecture / computational structure

Generative masked-video branch and discriminative/cross-modal learning components.

Assumptions

Inputs must satisfy the temporal, modality and annotation protocol described below. Video-text data adds weak language supervision, so the entire system is not purely unsupervised. Dataset overlap and correlated captions can inflate apparent generality.

Formula / computational definition

L=λgLmasked+λdLcontrastiveL=\lambda_gL_{masked}+\lambda_dL_{contrastive} summarizes the objective families, where λg,λd\lambda_g,\lambda_d weight reconstruction-like and discriminative terms. This schematic does not imply every published stage optimizes both terms simultaneously.

Parameters and notation

Learned/estimated quantities: Encoder and predictor/projection weights are learned; target-network EMA values are state updates, and masks/negative policies are design choices. Symbols specific to the objective are defined with the equation. Hyperparameters and design choices: Encoder choices, objective stages, modality pairing, data mixture, loss weights and downstream heads must be fixed.

Fitting, fine-tuning, and adaptation

Choose the representation branch that matches the task. Tune task heads before selectively unfreezing branches; maintain an evaluation set for both alignment and recognition to detect forgetting. 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. Evaluate multiple tasks with frozen and adapted encoders, reporting which data and modules each result uses.

Example application

Use a shared video foundation representation for recognition and retrieval.

Interpretation / pitfalls

Watch out

An optimized training objective or a favorable example does not establish generalization. Evaluate multiple tasks with frozen and adapted encoders, reporting which data and modules each result uses. The example below isolates one mechanism and cannot substantiate a full-model benchmark claim.

Python and R code examples

Component: Track distinct masked and discriminative objective components. 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: Use the paper-linked training and evaluation configurations; keep generative and cross-modal stages identifiable. R: Bridge feature extraction and compute retrieval/recognition analysis in R; native R reproduction requires implementing both training branches.

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.

Python

Component demo, not a trained model — Track distinct masked and discriminative objective components.

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()
masked_prediction = np.array([.3,.7]); target = np.array([.2,.8])
masked_loss = np.mean((masked_prediction-target)**2)
contrastive_loss = -np.log(softmax(np.array([2.,0.,-1.]))[0])
weights = (.5,1.)
print({"masked":masked_loss,"contrastive":contrastive_loss,
       "illustrative_total":weights[0]*masked_loss+weights[1]*contrastive_loss})
R

Component demo, not a trained model — Track distinct masked and discriminative objective components.

Shared setup for this chapter
softmax <- function(x) {
  e <- exp(x - max(x))
  e / sum(e)
}
masked_loss <- mean((c(.3,.7)-c(.2,.8))^2)
contrastive_loss <- -log(softmax(c(2,0,-1))[1])
print(c(masked=masked_loss,contrastive=contrastive_loss,
        illustrative_total=.5*masked_loss+contrastive_loss))

Sources

From the CodeSplash reference, entry VID028.