Skip to content

Video understanding, tracking, generation, and world models · Video generation · VID049 · Model

MoCoGAN

Separates a video's content latent from time-varying motion latents so a generator can keep identity stable while changing movement.

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

Separates a video's content latent from time-varying motion latents so a generator can keep identity stable while changing movement. Frame and video discriminators judge visual quality and temporal realism, making the method useful for studying disentangled video generation.

Question / objective

Learn a conditional distribution over videos, with useful visual quality, temporal coherence and controllability. This is a learning or inference objective, not a test of a statistical null hypothesis.

Method type and supervision

model · Video generation. Generative distribution learning, commonly with text/image conditioning; adversarial and token objectives differ.

Architecture / computational structure

Content latent, recurrent motion latent, frame generator and image/video discriminators.

Assumptions

Inputs must satisfy the temporal, modality and annotation protocol described below. Latent separation is an architectural bias, not guaranteed semantic disentanglement. GAN instability, mode collapse and identity drift remain possible; changing a latent can alter multiple attributes.

Formula / computational definition

xt=G(zc,zm,t)x_t=G(z_c,z_{m,t}), with fixed content zcz_c and recurrent motion zm,t=R(zm,t−1,ϵt)z_{m,t}=R(z_{m,t-1},\epsilon_t). Adversarial losses train image and video discriminators against generated samples.

Parameters and notation

Learned/estimated quantities: Tokenizer, denoiser/generator, temporal and conditioning weights are learned as applicable; sampled latents are random variables rather than fitted model weights. Symbols specific to the objective are defined with the equation. Hyperparameters and design choices: Content/motion dimensions, recurrent state, clip length, discriminator balance and optional conditioning influence results.

Fitting, fine-tuning, and adaptation

Adapt generator and discriminators together with stable adversarial schedules. Freeze early appearance layers only when the new domain is similar; inspect latent swaps for loss of disentanglement. 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. Assess visual quality, diversity, content persistence and motion variation with controlled latent swaps.

Example application

Generate clips sharing an identity but exhibiting different motions.

Interpretation / pitfalls

Watch out

An optimized training objective or a favorable example does not establish generalization. Assess visual quality, diversity, content persistence and motion variation with controlled latent swaps. The example below isolates one mechanism and cannot substantiate a full-model benchmark claim.

Python and R code examples

Component: Separate constant content from evolving motion latents. 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: Implement fixed content latents, a recurrent motion generator and separate image/video adversarial branches. R: Demonstrate latent-factor trajectories and adversarial scores in R; train the neural system with R torch or a Python bridge.

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 — Separate constant content from evolving motion latents.

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()
content = np.array([.7,.2]); noise = np.array([.1,-.2,.3,.1])
motion = 0.; latent_sequence = []
for e in noise:
    motion = .8*motion+e
    latent_sequence.append(np.r_[content,motion])
print(np.array(latent_sequence))
R

Component demo, not a trained model — Separate constant content from evolving motion latents.

Shared setup for this chapter
softmax <- function(x) {
  e <- exp(x - max(x))
  e / sum(e)
}
content <- c(.7,.2); noise <- c(.1,-.2,.3,.1)
motion <- 0; latents <- matrix(0,length(noise),3)
for(i in seq_along(noise)) {motion <- .8*motion+noise[i];latents[i,] <- c(content,motion)}
print(latents)

Sources

From the CodeSplash reference, entry VID049.