RAFT

Teed 2020 · Paper

One-line summary — Builds a 4D all-pairs correlation volume and iteratively refines a single high-resolution optical flow field with a weight-tied ConvGRU that looks up correlations around the current estimate — ECCV 2020 Best Paper and the defining architecture of modern optical flow.

Problem

The dominant deep flow architectures (PWC-Net and kin) inherited the classical coarse-to-fine pyramid: estimate flow at low resolution, then warp and refine. That design has structural blind spots — the cost volume at each level covers only a small search window, small fast-moving objects disappear at coarse resolutions, mistakes made early in the pyramid are difficult to undo, and multi-stage cascades often need over 1M training iterations. Prior iterative-refinement schemes did not tie weights across iterations (or, like IRR, were limited by their large recurrent unit). RAFT asks: what if the network precomputes matching costs between all pixel pairs, and a lightweight learned optimizer refines one high-resolution flow field by querying that volume as needed?

Method & architecture

Three stages, all differentiable and trained end-to-end:

  1. Feature extraction: an encoder gθ:RH×W×3RH/8×W/8×Dg_\theta : \mathbb{R}^{H \times W \times 3} \mapsto \mathbb{R}^{H/8 \times W/8 \times D} (D=256D = 256, 6 residual blocks) encodes both frames; a context network hθh_\theta of identical architecture encodes I1I_1 only. Both run once per pair.
  2. All-pairs correlation: visual similarity is precomputed for every pixel pair as a single matrix multiplication,

Cijkl=hgθ(I1)ijhgθ(I2)klh,CRH×W×H×WC_{ijkl} = \sum_h g_\theta(I_1)_{ijh} \cdot g_\theta(I_2)_{klh}, \qquad \mathbf{C} \in \mathbb{R}^{H \times W \times H \times W}

then the last two dimensions are average-pooled with kernels 1, 2, 4, 8 into a pyramid {C1,C2,C3,C4}\{\mathbf{C}^1, \mathbf{C}^2, \mathbf{C}^3, \mathbf{C}^4\}. Pooling only the I2I_2 dimensions keeps the I1I_1 dimensions at full (1/8) resolution — large and small displacements are both captured without losing small fast-moving objects. A lookup operator LCL_\mathbf{C} bilinearly samples each level on a local grid around the current correspondence x=x+f(x)\mathbf{x}' = \mathbf{x} + \mathbf{f}(\mathbf{x}),

N(x)r={x+dxdxZ2, dx1r}\mathcal{N}(\mathbf{x}')_r = \{ \mathbf{x}' + \mathbf{dx} \mid \mathbf{dx} \in \mathbb{Z}^2,\ \lVert \mathbf{dx} \rVert_1 \le r \}

indexed at N(x/2k)r\mathcal{N}(\mathbf{x}'/2^k)_r per level kk — a constant radius spans larger context at coarser levels (radius 4 at k=4k=4 covers 256 pixels at original resolution). 3. Iterative updates: starting from f0=0\mathbf{f}_0 = \mathbf{0}, a recurrent update operator (only 2.7M parameters, weights tied across all iterations) consumes correlation lookups, flow features, and context features xtx_t, and emits residual updates fk+1=fk+Δf\mathbf{f}_{k+1} = \mathbf{f}_k + \Delta\mathbf{f} via a convolutional GRU:

zt=σ(Conv3×3([ht1,xt],Wz)),rt=σ(Conv3×3([ht1,xt],Wr))z_t = \sigma(\mathrm{Conv}_{3\times3}([h_{t-1}, x_t], W_z)), \qquad r_t = \sigma(\mathrm{Conv}_{3\times3}([h_{t-1}, x_t], W_r))

h~t=tanh(Conv3×3([rtht1,xt],Wh)),ht=(1zt)ht1+zth~t\tilde{h}_t = \tanh(\mathrm{Conv}_{3\times3}([r_t \odot h_{t-1}, x_t], W_h)), \qquad h_t = (1 - z_t) \odot h_{t-1} + z_t \odot \tilde{h}_t

The operator mimics a first-order optimizer — but instead of a Taylor-linearized data term it learns to propose the descent direction; bounded activations encourage convergence to a fixed point, and it can run 100+ iterations without diverging. Flow is predicted at 1/8 resolution and upsampled by a learned convex combination over each pixel’s 3x3 coarse neighborhood (weights via softmax).

Supervision covers the whole sequence of estimates with exponentially increasing weights:

L=i=1NγNifgtfi1,γ=0.8\mathcal{L} = \sum_{i=1}^{N} \gamma^{N-i} \lVert \mathbf{f}_{gt} - \mathbf{f}_i \rVert_1, \qquad \gamma = 0.8

Training follows FlyingChairs then FlyingThings, then benchmark fine-tuning; on video, warm-start initialization forward-projects the previous frame’s flow.

Results

Why it matters for SLAM

RAFT’s “correlation volume + iterative recurrent refinement” recipe became the workhorse of learned data association in SLAM: DROID-SLAM and DPVO are essentially RAFT-style update operators wrapped around a differentiable bundle adjustment layer. Its descendants (RAFT-3D for scene flow, SEA-RAFT for real-time) dominate flow benchmarks, and the pattern of unrolled, learned optimization it popularized now appears across dense prediction and SLAM systems.