Video understanding, tracking, generation, and world models · Video self-supervision · VID024 · Training method
VideoMAE
Masks a large proportion of video tubelets and reconstructs the missing content from visible tokens. Temporal redundancy makes high masking ratios feasible;
In CodeSplash
No method yet, but the reference's example runs here as a notebook.
Do it in CodeSplash Open the reference's example as a Python or R notebook.
- Availability
- Runs as a notebook
- Code example
- Complete calculation
- 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
Masks a large proportion of video tubelets and reconstructs the missing content from visible tokens. Temporal redundancy makes high masking ratios feasible; the encoder can later be fine-tuned for recognition, while the reconstruction decoder is usually discarded.
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
training-method · Video self-supervision. Self-supervised pretraining; cross-modal variants also use weak paired language supervision.
Architecture / computational structure
Visible-tubelet encoder plus lightweight reconstruction decoder and mask sampler.
Assumptions
Inputs must satisfy the temporal, modality and annotation protocol described below. Pixel reconstruction may reward texture rather than semantic understanding. Train/test videos must be separated by source, and high mask ratios are not universally optimal for short or sparse events.
Formula / computational definition
, where contains masked tubelets, encodes visible tokens and predicts targets. Target normalization changes the meaning of the loss.
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: Mask ratio, tube masking pattern, tubelet size, decoder capacity, reconstruction normalization and pretraining data matter.
Fitting, fine-tuning, and adaptation
Discard the decoder for classification, fit a head, then unfreeze the encoder. Temporal adapters or LoRA may reduce tuning cost, but mask policy and target normalization remain pretraining choices. 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. Report downstream transfer, compute and masking ablations; reconstruction error alone is insufficient.
Example application
Pretrain an action encoder using unannotated domain footage.
Interpretation / pitfalls
Watch out
An optimized training objective or a favorable example does not establish generalization. Report downstream transfer, compute and masking ablations; reconstruction error alone is insufficient. The example below isolates one mechanism and cannot substantiate a full-model benchmark claim.
Python and R code examples
Component: Compute masked-only tubelet reconstruction error. 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 official MCG-NJU/VideoMAE code or implement visible-token encoding and masked-only loss. R: Generate tube masks and reconstruction losses in R; bridge the transformer or port it deliberately to R torch.
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.
Complete calculation — Compute masked-only tubelet reconstruction error.
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()
target = np.arange(8.,dtype=float).reshape(4,2)
prediction = target+np.array([[2.],[.2],[3.],[.4]])
masked = np.array([False,True,False,True])
print("masked MSE",np.mean((prediction[masked]-target[masked])**2))
Complete calculation — Compute masked-only tubelet reconstruction error.
Shared setup for this chapter
softmax <- function(x) {
e <- exp(x - max(x))
e / sum(e)
}
target <- matrix(0:7,4,byrow=TRUE)
prediction <- target+c(2,.2,3,.4)
masked <- c(FALSE,TRUE,FALSE,TRUE)
print(mean((prediction[masked,]-target[masked,])^2))
Sources
- Source 1arxiv.org
From the CodeSplash reference, entry VID024.