all lessons / computer_vision / 16 · video lesson 16 / 19

Video and temporal models

视频与时序模型

Lesson 15 closed our tour of single still images: CLIP aligned one frozen frame to text, and the VLM stack (vision encoder → projector → LLM) could caption or answer questions about a photograph. But the photograph never moved. Lesson 15 closed on exactly that promise — static-image representations are done, and a video is just images plus motion — so this lesson makes good on it by adding the time axis. The real world is a stream — an action is not a pixel pattern, it is a pixel pattern changing over time — and that one extra dimension brings a new free variable that quietly decides everything: which frames the model even gets to see.

第 15 课结束了我们对单张静止图像的巡礼:CLIP 把一帧冻结的画面与文本对齐,而 VLM 技术栈(视觉编码器 → 投影器 → LLM)能够对一张照片做图像描述或回答问题。但照片从不运动。第 15 课正是以这个承诺收尾的——静态图像的表示已经讲完,而视频不过是图像加上运动——所以本课就通过加上时间轴来兑现它。真实世界是一条数据流——一个动作不是一种像素模式,而是一种随时间变化的像素模式——而这多出来的一个维度带来了一个悄悄决定一切的新自由变量:模型究竟能看到哪些帧。

What we are standing on. This lesson borrows tools earned earlier rather than rebuilding them: lesson 02's spatial gradients and the Nyquist/aliasing sampling limit (now applied to time, not space), lesson 06's convolution and its FLOP accounting and receptive field, lesson 07's train/serve split discipline (which a video makes far easier to violate), lesson 09's IoU and mAP, and lesson 13's self-attention with its O(n²) cost. Keep those five in reach; the new material is just the time axis layered on top.

我们所站立的基础。本课借用此前已经掌握的工具,而不是重新搭建它们:第 02 课的空间梯度与奈奎斯特/混叠采样限(现在应用于时间,而非空间)、第 06 课的卷积及其 FLOP 计算和感受野、第 07 课的训练/服务划分纪律(视频让它更容易被违反)、第 09 课的 IoUmAP,以及第 13 课带有 O(n²) 开销的自注意力。把这五样东西放在手边;新的内容只是叠加在其上的时间轴而已。

The plan计划
Four moves. (1) Treat frame sampling — rate, stride, clip length — as a modeling decision, not a loader detail, and count the data it throws away. (2) Pin down what optical flow is numerically: the brightness-constancy assumption and the one scalar equation it yields. (3) Compare 3D conv, two-stream, and temporal attention with like-for-like clip FLOPs, then place recognition inside the modern landscape of video foundation encoders, predictive models, and action-conditioned world models. (4) Put it in production: streaming latency budgets, causal vs offline models, and temporal metrics. 四步走。(1) 把帧采样——帧率、步幅、片段长度——当成建模决策,而不是数据加载器细节,并算清它丢掉了多少信息。(2) 从数值上钉死光流什么:亮度恒定假设,以及它导出的标量方程。(3) 以相同片段为基准比较 3D 卷积、双流与时序注意力的 FLOP,再把识别模型放进视频基础编码器、预测模型和动作条件世界模型的现代版图中。(4) 把它落到生产中:流式延迟预算、因果与离线模型,以及时序指标。

1 · Frame sampling is a modeling choice

1 · 帧采样是一个建模决策

A one-minute clip at 30 frames per second (fps) and 224×224×3 is 60 · 30 · 224 · 224 · 3 ≈ 2.7 × 108 values — about 1.1 GB as float32 (4 bytes each; ~270 MB even stored as 8-bit bytes) before a single layer runs. You cannot feed it whole. So every video model begins with a sampling policy: how many frames, at what spacing, covering how much wall-clock time. That policy is not plumbing; it sets the ceiling on what the model can possibly learn, because information you do not sample, you cannot recover.

一段一分钟、每秒 30 帧(fps)、分辨率为 224×224×3 的片段是 60 · 30 · 224 · 224 · 3 ≈ 2.7 × 108 个数值——以 float32 计约 1.1 GB(每个 4 字节;即便以 8 位字节存储也有约 270 MB),而这还是在任何一层运行之前。你无法把它整个喂进去。所以每个视频模型都从一个采样策略开始:取多少帧、以什么间隔、覆盖多少真实时长。这个策略不是水管工程;它设定了模型可能学到的上限,因为你没有采样的信息,就无法复原。

Three knobs, with concrete consequences:

三个旋钮,各有具体后果:

The frequency view from lesson 02 applies directly: sampling in time is subject to the same Nyquist limit as sampling in space. To resolve an event that repeats at f Hz you must sample faster than 2f; below that, fast motion aliases into a slower phantom (the wagon-wheel effect — spokes appearing to spin backward). Choosing the frame rate is choosing your temporal anti-aliasing budget.

第 02 课的频率视角在这里直接适用:时间上的采样受制于与空间采样相同的奈奎斯特限。要分辨一个以 f Hz 重复的事件,你的采样必须快于 2f;低于这个速度,快速运动就会混叠成一个更慢的幻影(车轮效应——辐条看起来在倒转)。选择帧率,就是在选择你的时序抗混叠预算。

source 30 fps |■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■| 30 frames / sec ↓ stride 8 (Δt ≈ 0.27 s) sampled |■.......■.......■.......■....| ~4 frames / sec ↑ a 0.1 s clap (3 source frames) can fall entirely in a gap — sampled too coarsely to ever be learned
Trap — the split leak comes back, worse陷阱——划分泄漏卷土重来,而且更糟
Adjacent frames are near-duplicates: frame t and t+1 differ by milliseconds of motion. Split a dataset at the frame level and almost every validation frame has a near-twin in training — the model memorizes, validation accuracy looks superb, production collapses. Split by source video, scene, or uploader, exactly the entity/time-level discipline lesson 07 demanded for images, now mandatory because the duplication is structural. 相邻帧是近乎重复的:第 t 帧与第 t+1 帧只相差几毫秒的运动。在级别划分数据集,几乎每一个验证帧在训练集里都有一个近乎孪生的兄弟——模型死记硬背,验证准确率看起来极好,生产环境却崩溃。要按源视频、场景或上传者划分,这正是第 07 课对图像所要求的那种实体/时间级别的纪律,如今更是必须的,因为这种重复是结构性的。

2 · What optical flow actually is

2 · 光流究竟是什么

"Motion signal" is vague. Optical flow makes it a number: for each pixel, the 2D displacement vector (u, v), measured in pixels per frame-step, that says where that bit of brightness moved between frame t and frame t+1 (so the "step" is one frame, Δt = 1 — the unit the Taylor expansion below quietly assumes). The whole construction rests on one assumption, the brightness-constancy assumption: a surface point keeps the same intensity as it moves a small amount over a small time. Writing the image intensity as I(x, y, t):

"运动信号"是含糊的。光流把它变成一个数:对每个像素,给出一个二维位移向量 (u, v),以像素每帧步长为单位,说明那一小块亮度在第 t 帧与第 t+1 帧之间移动到了哪里(所以这里的"步长"是一帧,Δt = 1——正是下面泰勒展开悄悄假定的那个单位)。整个构造建立在一个假设之上,即亮度恒定假设:一个表面点在小的时间内移动一小段距离时,保持相同的强度。把图像强度写作 I(x, y, t)

I(x, y, t) = I(x + u, y + v, t + 1) .

"A pixel's brightness doesn't change as it slides to its new location." Now expand the right side with a first-order Taylor approximation (valid when the motion is small — the assumption's fine print):

"一个像素的亮度在它滑向新位置时不会改变。"现在用一阶泰勒近似展开右边(在运动很小时成立——这就是那条假设的附加细则):

I(x + u, y + v, t+1) ≈ I(x, y, t) + Ix u + Iy v + It ,

where Ix, Iy are the spatial gradients (how brightness changes left-right and up-down — the Sobel responses from lesson 02) and It is the temporal gradient (frame difference at that pixel). This is just the multivariate f(a+Δ) ≈ f(a) + ∇f·Δ in three variables, with steps (u, v, 1) — so the It term is the time-derivative times the one-frame step. Substitute into brightness-constancy (set the two sides equal): the shared I(x,y,t) cancels, leaving the optical-flow constraint equation:

其中 Ix, Iy 是空间梯度(亮度在左右和上下方向如何变化——第 02 课的 Sobel 响应),而 It 是时间梯度(该像素处的帧差)。这不过是三变量下的多元式 f(a+Δ) ≈ f(a) + ∇f·Δ,步长为 (u, v, 1)——所以 It 这一项就是时间导数乘以一帧的步长。代入亮度恒定式(令两边相等):公共的 I(x,y,t) 相消,留下光流约束方程

Ix u + Iy v + It = 0   ⟺   ∇I · (u, v) + It = 0 .

Worked numerically. Suppose at one pixel the horizontal gradient is Ix = 10 intensity units/pixel, the vertical gradient Iy = 0 (a vertical edge — no vertical structure), and between frames the pixel got darker: It = −20 units. The constraint becomes 10u + 0·v − 20 = 0 ⟹ u = 2 pixels. We recovered the horizontal motion: the edge slid 2 pixels right. But v is completely undetermined — the equation says nothing about vertical motion along a vertical edge. This is the aperture problem: one equation, two unknowns per pixel. You only ever recover the motion component perpendicular to the local edge — called the normal flow. Classical solvers break the tie with extra assumptions — Lucas–Kanade assumes neighboring pixels share one (u,v) and solves a small least-squares system; Horn–Schunck adds a global smoothness penalty. Modern systems learn it: RAFT regresses flow with iterative refinement and beats the classical methods on benchmarks.

数值演算。假设在某个像素处,水平梯度为 Ix = 10 强度单位/像素,竖直梯度 Iy = 0(一条竖直边缘——没有竖直方向的结构),而两帧之间该像素变暗了:It = −20 单位。约束变成 10u + 0·v − 20 = 0 ⟹ u = 2 像素。我们复原了水平运动:边缘向右滑了 2 像素。但 v 完全无法确定——方程对沿竖直边缘的竖直运动只字未提。这就是孔径问题:每像素一个方程、两个未知数。你能复原的永远只是垂直于局部边缘的那个运动分量——称为法向光流。经典求解器靠额外假设来打破僵局——Lucas–Kanade 假设相邻像素共享同一个 (u,v),求解一个小的最小二乘系统;Horn–Schunck 则加上一个全局平滑惩罚。现代系统则把它学出来:RAFT 用迭代细化来回归光流,并在基准测试上胜过经典方法。

So flow is an explicit motion representation you can hand a model. The two-stream design (next section) does exactly that. The alternative is to let the model discover motion implicitly from raw frames — cheaper at inference (no flow to compute), but it must learn the equivalent of It internally and needs enough temporal data to do so.

所以光流是一种你可以直接交给模型的显式运动表示。双流设计(下一节)做的正是这件事。另一种选择是让模型从原始帧中隐式地发现运动——推理时更便宜(不必计算光流),但它必须在内部学到等价于 It 的东西,并且需要足够的时序数据才能做到。

2.5 · Interactive · the aperture problem

2.5 · 交互 · 孔径问题

The "one equation, two unknowns" claim is the whole reason flow is hard, and it is easiest to see. Watch a diagonal edge drift behind a small circular window: through that hole, you cannot tell whether the edge is moving sideways, up, or diagonally — every true-motion vector whose tip lands on a single dashed line produces the identical view. The constraint Ixu + Iyv + It = 0 is exactly that line. Only the component perpendicular to the edge (the normal flow, the blue arrow) is observable; the rest is undetermined. Add a corner — a second edge with a different orientation — and the two constraint lines intersect at one point: the ambiguity collapses to a unique vector, which is precisely what Lucas–Kanade does with a neighborhood.

"一个方程、两个未知数"这个论断正是光流之所以困难的全部原因,而它最容易被出来。看一条对角边缘在一个小圆窗后面漂移:透过那个孔,你分不清边缘是在横向、纵向还是斜向移动——凡是尖端落在同一条虚线上的真实运动向量,产生的视图都完全相同。约束 Ixu + Iyv + It = 0 恰好就是那条线。只有垂直于边缘的分量(法向光流,那支蓝色箭头)是可观测的;其余部分无法确定。加上一个角点——一条方向不同的第二条边缘——两条约束线便交于一点:歧义坍缩成唯一的向量,这正是 Lucas–Kanade 用一个邻域所做的事。

The aperture problem — one constraint line, not one vector
孔径问题——一条约束线,而非一个向量
Left: a moving edge (or corner) seen through a circular aperture. Right: velocity space (u,v) — the dashed line is every true motion consistent with what you observe through the hole; the blue arrow is the normal flow (the only recoverable component). Drag the true motion slider and watch the blue arrow refuse to change. Then switch to corner: two lines, one intersection, ambiguity resolved.
左图:透过一个圆形孔径看到的一条运动边缘(或角点)。右图:速度空间 (u,v)——虚线是与你透过孔看到的一切相符的所有真实运动;蓝色箭头是法向光流(唯一可复原的分量)。拖动真实运动滑块,看着蓝色箭头拒绝改变。然后切换到角点:两条线、一个交点,歧义被解决。
I_x , I_y
I_x , I_y
10, 0
I_t
I_t
−20
normal flow |v⊥|
法向光流 |v⊥|
2.0
solvable?
可解?
no — 1 eq
Show the core JS查看核心代码
// One edge gives one row of the constraint: I_x·u + I_y·v + I_t = 0.
// The spatial gradient ∇I points across the edge (normal n = ∇I/|∇I|).
// Brightness-constancy: I_t = -∇I · vTrue  (only the along-normal part of the true motion shows up).
function observe(theta, vTrue){
  const nx = Math.cos(theta), ny = Math.sin(theta);   // unit edge-normal
  const Ix = G*nx, Iy = G*ny;                          // gradient magnitude G along the normal
  const It = -(Ix*vTrue.u + Iy*vTrue.v);               // temporal gradient we'd measure
  const vn = -It / G;                                  // normal-flow magnitude (signed)
  return { Ix, Iy, It, normalFlow:{ u: vn*nx, v: vn*ny } };
}
// Single edge → the solution set is the LINE  I_x·u + I_y·v + I_t = 0  (under-determined).
// A corner adds a 2nd edge (theta2) → 2 lines intersect → unique (u,v) = the true motion.

The KPIs reproduce the worked example exactly: set θ so the edge is vertical (gradient purely horizontal, Iy=0) and a rightward true motion of 2 px gives Ix=10, Iy=0, It=−20 and normal flow 2 — yet "solvable?" stays no until you add the corner. That gap between a confident It reading and an unsolvable (u,v) is the aperture problem in one screen.

这些 KPI 精确地重现了那个演算例子:把 θ 设成让边缘竖直(梯度纯水平,Iy=0),一个向右 2 px 的真实运动给出 Ix=10, Iy=0, It=−20 以及法向光流 2——然而"可解?"一直是,直到你加上角点。一个笃定的 It 读数与一个无法求解的 (u,v) 之间的这道鸿沟,就是一屏之内的孔径问题。

3 · Three ways to fuse time — and why 3D conv is expensive

3 · 融合时间的三种方式——以及 3D 卷积为何昂贵

An image backbone (lesson 06) maps one frame to features. To use time we must combine information across frames. There are three dominant strategies.

一个图像骨干网络(第 06 课)把一帧映射为特征。要利用时间,我们必须帧地组合信息。有三种主流策略。

A · per-frame + pool f₁ f₂ f₃ pool cheap; loses ordering & fine motion B · 3D conv (space × time) k×k×t local motion; FLOPs × kernel-depth t C · two-stream / attention RGB flow fuse motion explicit (flow) or all-pairs (attn, O(n²))

3D convolution extends the 2D kernel of lesson 06 with a temporal depth: instead of a k×k window over one frame, a k×k×t window slides over a stack of t frames, learning spatio-temporal patterns (a flick, a bounce) directly. It is the most natural extension — and the most expensive. Here is the arithmetic, because the FLOP argument is the whole point.

3D 卷积把第 06 课的 2D 卷积核扩展出一个时间深度:不再是一个 k×k 的窗口滑过一帧,而是一个 k×k×t 的窗口滑过 t 帧的堆叠,直接学习时空模式(一次抖动、一次弹跳)。它是最自然的扩展——也是最昂贵的。下面是这笔算术,因为 FLOP 论证正是全部要点。

A 2D conv layer with Cin input channels, Cout output channels, kernel k×k, over a feature map of H×W spatial positions costs roughly

一个具有 Cin 个输入通道、Cout 个输出通道、卷积核 k×k、作用在 H×W 个空间位置的特征图上的 2D 卷积层,其开销大约是

FLOPs2D ≈ H · W · Cin · Cout · k · k .

The 3D version adds a temporal kernel dimension kt and processes D temporal positions (frames in the stack):

3D 版本加上一个时间卷积核维度 kt并且要处理 D 个时间位置(堆叠中的帧):

FLOPs3D ≈ D · H · W · Cin · Cout · k · k · kt .

Compare the same clip. Take H=W=56, Cin=Cout=256, and k=3. One 2D application costs 1.85 × 109 operations per frame, so applying it independently to all D=16 frames costs 16·1.85 × 109 ≈ 2.96 × 1010. A 3D layer with kt=3 over those same 16 output times costs ≈8.9 × 1010: about kt=3× the same-clip 2D baseline, or D·kt=48× only if compared misleadingly with a single 2D frame. Boundary padding and output strides can adjust exact counts, but the like-for-like ratio is the temporal kernel factor. (2+1)D splits k×k×kt into spatial k×k×1 then temporal 1×1×kt; its saving depends on the intermediate channel width, while the extra non-linearity can also improve optimization. SlowFast instead allocates different frame rates and channel budgets to slow semantic and fast motion pathways.

必须比较同一个片段。H=W=56Cin=Cout=256k=3。2D 层每帧一次的开销是 1.85 × 109,因此独立处理 D=16 帧的开销为 16·1.85 × 109 ≈ 2.96 × 1010。在同样 16 个输出时刻上、kt=3 的 3D 层开销约为 8.9 × 1010:相对同片段 2D 基线约为 kt=3×;只有在误导性地拿它与单帧 2D 比较时才是 D·kt=48×。边界填充与输出步幅会改变精确数字,但同口径比值来自时间核因子。(2+1)Dk×k×kt 拆成空间 k×k×1 再接时间 1×1×kt;节省多少取决于中间通道宽度,中间多出的非线性也可能改善优化。SlowFast 则给慢速语义路径与快速运动路径分配不同帧率和通道预算。

Two-stream networks sidestep learning motion from scratch: one CNN branch sees RGB (appearance — what is there), a second sees precomputed optical flow (motion — how it moves), and their predictions fuse. This was the early winner on action recognition precisely because flow hands the network the It signal it would otherwise struggle to extract. The cost is the flow computation itself — a second, often non-trivial, pipeline and failure surface.

双流网络绕开了从零学习运动:一条 CNN 分支看 RGB(外观——有什么),第二条看预先计算好的光流(运动——如何移动),二者的预测再融合。它之所以是动作识别的早期赢家,恰恰是因为光流把网络本来难以提取的 It 信号直接递到了手上。代价是光流计算本身——第二条往往并不简单的流水线,以及一处失败面。

Temporal attention tokenizes frames or patches and lets the transformer attend across time. With F frames and P patches per frame, joint attention over FP tokens costs O(F²P²). Factorized attention performs spatial attention for each of the F frames plus temporal attention for each of the P patch positions, for O(FP² + PF²)—not O(P²+F²), because each subproblem is repeated. Windowing, sparse attention, token pruning, and memory mechanisms reduce it further.

时序注意力把帧或图块切成 token,让 Transformer 跨时间做注意力。若有 F 帧、每帧 P 个图块,对全部 FP 个 token 做联合注意力的开销是 O(F²P²)。分解注意力会对每个 F 帧做空间注意力,再对每个 P 图块位置做时间注意力,总开销为 O(FP² + PF²)——而不是 O(P²+F²),因为每个子问题都要重复。窗口化、稀疏注意力、token 剪枝与记忆机制还能进一步降本。

Family家族How it fuses time如何融合时间Cost driver开销主因Best when最适合于
Per-frame + pool逐帧 + 池化Image backbone per frame, average logits每帧一个图像骨干,对 logit 求平均cheapest; linear in frames最便宜;帧数线性action ≈ appearance (a scene, an object)动作 ≈ 外观(一个场景、一个物体)
3D CNN / (2+1)D3D CNN / (2+1)Dconv over space and time在空间时间上做卷积≈ ×kt over per-frame 2D on the same clip相对同片段逐帧 2Dfine local motion matters精细的局部运动很关键
Two-stream双流RGB branch + explicit optical-flow branchRGB 分支 + 显式光流分支flow precompute pipeline光流预计算流水线motion-defined actions, smaller data由运动定义的动作、数据较少
Temporal transformer时序 Transformerattention over frame/patch tokens在帧/图块 token 上做注意力O(n²), memory-heavy,显存开销大long-range temporal context, large data长程时序上下文、数据量大
Track-then-classify先跟踪后分类detect/track (lesson 11), classify trajectory检测/跟踪(第 11 课),再对轨迹分类tracker quality跟踪器质量object-centric events, few actors以物体为中心的事件、行动者少

3b · The modern landscape: represent, predict, or intervene?

3b · 现代版图:表示、预测,还是干预?

Architecture names hide three different learning contracts. A video foundation encoder learns a reusable representation from large video corpora using masked prediction, contrastive objectives, or video–text alignment; it can recognize and retrieve without being a simulator. A predictive video model learns p(zt+1:t+H | z≤t) (or pixels) and must represent multiple plausible futures. An action-conditioned world model learns p(zt+1:t+H | z≤t, at:t+H−1): the action is essential if we want counterfactuals—same state, different action, different consequence—for planning or control. Large actionless video pretraining can supply visual and physical priors, then smaller action-labeled trajectories add controllability. Pixel generation is useful for inspection; latent prediction is often cheaper for decision-making. The state, action, and intervention contract—not photorealism alone—determines whether a system is a world model.

架构名字常掩盖三种不同的学习契约。视频基础编码器通过掩码预测、对比目标或视频–文本对齐,从海量视频中学习可复用表示;它能做识别与检索,却不因此成为模拟器。预测式视频模型学习 p(zt+1:t+H | z≤t)(或像素),并必须表达多个合理未来。动作条件世界模型学习 p(zt+1:t+H | z≤t, at:t+H−1):若要为规划或控制回答反事实——同一状态、不同动作、不同后果——动作不可或缺。大规模无动作视频预训练可提供视觉与物理先验,再由规模较小、带动作标签的轨迹加入可控性。像素生成便于检查;潜在预测通常更适合低成本决策。决定系统是否是世界模型的,是状态、动作与干预契约,而不只是照片级真实感。

4 · Streaming, latency budgets, and temporal metrics

4 · 流式处理、延迟预算与时序指标

The headline task is action recognition: assign a clip a label from a fixed set ("clapping", "pouring"). Its cousins are temporal action localization (find the start/end of each action in a long untrimmed video) and spatio-temporal detection (box + action per actor per frame). Each needs a metric that respects time.

头号任务是动作识别:为一个片段从固定集合中赋予一个标签("拍手""倒水")。它的近亲是时序动作定位(在一段未剪辑的长视频里找出每个动作的起止)和时空检测(每帧每个行动者的边界框 + 动作)。每一种都需要一个尊重时间的指标。

The streaming latency budget. An offline model may use future frames — it can look at frame t+10 to label frame t. A real-time model cannot; it is causal, seeing only the past. Concretely, suppose a product has a 100 ms end-to-end budget per frame at 30 fps (a frame arrives every 1000/30 ≈ 33 ms). If inference takes 70 ms, you have 30 ms for decode + preprocess + post-process, and you cannot buffer 10 future frames for smoothing without adding 10·33 = 330 ms of delay — blowing the budget more than 3×. So streaming forces choices the offline benchmark never penalizes: smaller clips, causal (no-lookahead) temporal modeling, frame-skipping under load, and lightweight temporal smoothing (an exponential moving average over recent logits) that trades a little lag for stability. The trap: heavy smoothing hides exactly the quick events you may most need to catch.

流式延迟预算。离线模型可以使用未来的帧——它能看第 t+10 帧来给第 t 帧打标签。实时模型不行;它是因果的,只能看到过去。具体地说,假设一个产品在 30 fps 下有 100 ms 的端到端逐帧预算(每 1000/30 ≈ 33 ms 到来一帧)。若推理耗时 70 ms,你只剩 30 ms 用于解码 + 预处理 + 后处理,而你无法缓冲 10 个未来帧来做平滑,否则会加进 10·33 = 330 ms 的延迟——把预算超支 3 倍以上。所以流式处理迫使你做出离线基准从不惩罚的取舍:更小的片段、因果(无前瞻)的时序建模、负载下跳帧,以及轻量的时序平滑(对近期 logit 做指数移动平均),用一点点滞后换取稳定。陷阱在于:过重的平滑恰恰会掩盖你可能最需要捕捉的那些快速事件。

Handoff to 17交接到第 17 课
Everything in lessons 01–16 has analyzed pixels — classified them, localized them, tracked them through time, aligned them to text. We have been a very sophisticated reader of images. The obvious next question: can a model run the arrow the other way and synthesize pixels — turn a label, a caption, or pure noise into an image or a video? That is a fundamentally different objective, and lesson 17 builds it from p(x) up. 第 01–16 课里的一切都在分析像素——给它们分类、定位、随时间跟踪、与文本对齐。我们一直是一名非常老练的图像读者。显而易见的下一个问题是:模型能不能把箭头反过来指,去合成像素——把一个标签、一句描述或纯噪声变成一张图像或一段视频?那是一个根本不同的目标,而第 17 课将从 p(x) 出发把它建立起来。

Where this points next

这将指向何处

We added time and found that the loader is part of the model: sampling rate sets the information ceiling, flow gives an explicit motion signal, and 3D conv / two-stream / attention is a compute-and-data trade. Recognition and foundation encoders summarize video; predictive and action-conditioned models forecast it. Lesson 17 (Generative vision) now broadens the output contract from future prediction to explicit sampling from p(x) or p(x|c). That is not classification run backward: its one-to-many structure demands autoencoders, GANs, diffusion, and flow-based generation. The temporal constraint returns in video generation, where independently plausible frames are insufficient—the trajectory must also be coherent.

我们加上了时间,并发现数据加载器是模型的一部分:采样率设定信息上限,光流给出显式运动信号,而 3D 卷积 / 双流 / 注意力之间是算力与数据的权衡。识别与基础编码器负责概括视频;预测式与动作条件模型负责预报视频。第 17 课(生成式视觉)会把输出契约从未来预测扩展为从 p(x)p(x|c) 中显式采样。这不是把分类反过来跑:一对多结构需要自编码器、GAN、扩散与基于流的生成。时序约束会在视频生成中再次出现——逐帧各自合理还不够,整条轨迹也必须一致。

Takeaway要点
Video is images plus time, and frame sampling sets the information ceiling. Optical flow rests on brightness constancy and yields Ixu + Iyv + It = 0, hence the aperture problem. For the same D-frame clip, a dense 3D convolution is about kt× its per-frame 2D counterpart, not Dkt×; factorized attention costs O(FP²+PF²). Keep the learning contract explicit: foundation encoders represent, predictive models forecast, and action-conditioned world models support interventions. Production then chooses offline versus causal streaming and evaluates with clip/video accuracy or temporal-IoU mAP. 视频是图像加时间,而帧采样设定信息上限。光流建立在亮度恒定上,并导出 Ixu + Iyv + It = 0,因此产生孔径问题。对同一个 D 帧片段,稠密 3D 卷积相对逐帧 2D 的开销约为 kt×,而不是 Dkt×;分解注意力的开销为 O(FP²+PF²)。必须写清学习契约:基础编码器做表示,预测模型预报未来,动作条件世界模型支持干预。生产再选择离线或因果流式,并以片段/视频准确率或时序 IoU mAP 评估。

Interview prompts

面试题