Skip to content

Video understanding, tracking, generation, and world models · Motion and tracking · VID029 · Architecture

FlowNet

Predicts dense optical flow between two images with a convolutional encoder-decoder. FlowNet established a direct learned mapping from image pairs to per-pixel displacement, useful for motion measurement and as input to…

Runs as a notebook Complete calculation CodeSplash's run and the reference's record

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

Predicts dense optical flow between two images with a convolutional encoder-decoder. FlowNet established a direct learned mapping from image pairs to per-pixel displacement, useful for motion measurement and as input to higher-level video systems.

Question / objective

Estimate image displacement or maintain the location and identity of objects/points over time. This is a learning or inference objective, not a test of a statistical null hypothesis.

Method type and supervision

architecture · Motion and tracking. Mixed: supervised neural perception or non-neural inference over detections; see the individual assumptions.

Architecture / computational structure

Convolutional image-pair encoder-decoder, with concatenation or correlation depending on variant.

Assumptions

Inputs must satisfy the temporal, modality and annotation protocol described below. Supervised training requires flow labels, often synthetic. Occlusion, transparent surfaces, large displacements and domain shift can break predictions; flow is image displacement, not 3D velocity.

Formula / computational definition

L=∑sλs∑p∥u^p(s)−up(s)∥2L=\sum_s\lambda_s\sum_p\|\hat u_p^{(s)}-u_p^{(s)}\|_2 is a multiscale endpoint-error objective; upu_p is the two-component ground-truth flow at pixel pp, and ss indexes output scales.

Parameters and notation

Learned/estimated quantities: Neural feature/refinement weights are learned when the method contains a network; coordinates, flow fields and track states are inferred outputs, not fixed network parameters. Symbols specific to the objective are defined with the equation. Hyperparameters and design choices: Image normalization, output scale, correlation versus concatenation variant, synthetic training distribution and loss weights matter.

Fitting, fine-tuning, and adaptation

Fine-tune on target-domain flow labels, often beginning with later decoder/refinement layers. Self-supervised photometric adaptation is a separate objective with occlusion assumptions, not automatic ground truth. 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 endpoint error and outlier rates by dataset, including occluded and non-occluded regions and inference resolution.

Example application

Estimate pixel displacement between consecutive camera frames.

Interpretation / pitfalls

Watch out

An optimized training objective or a favorable example does not establish generalization. Report endpoint error and outlier rates by dataset, including occluded and non-occluded regions and inference resolution. The example below isolates one mechanism and cannot substantiate a full-model benchmark claim.

Python and R code examples

Component: Compute flow endpoint error without conflating it with pixel MSE. 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 a verified FlowNet implementation or build a supervised encoder-decoder; rescale vector magnitudes when resizing images. R: Compute flow errors and visualize vector fields in R; bridge the neural predictor rather than implying a standard native R FlowNet package.

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

Complete calculation — Compute flow endpoint error without conflating it with pixel MSE.

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()
truth = np.array([[2.,0.],[2.,0.],[2.,0.]])
prediction = np.array([[2.,0.],[1.,0.],[2.,1.]])
epe = np.linalg.norm(prediction-truth,axis=1)
print("per-point EPE",epe,"mean",epe.mean())
R

Complete calculation — Compute flow endpoint error without conflating it with pixel MSE.

Shared setup for this chapter
softmax <- function(x) {
  e <- exp(x - max(x))
  e / sum(e)
}
truth <- matrix(rep(c(2,0),3),3,byrow=TRUE)
prediction <- rbind(c(2,0),c(1,0),c(2,1))
epe <- sqrt(rowSums((prediction-truth)^2))
print(epe); print(mean(epe))

Sources

From the CodeSplash reference, entry VID029.