Paper commentary
RAFT: Recurrent All-Pairs Field Transforms for Optical Flow
RAFT refines optical flow with one recurrent unit over all-pairs correlations
- Problem Coarse-to-fine cascades can miss small fast-moving objects and need over 1M training iterations. Earlier recurrent refiners fix their number of steps in advance, so they cannot keep improving.
- Method RAFT builds all-pairs correlation volumes from per-pixel features. It then repeatedly updates one full-resolution flow field with a recurrent unit that looks up values from a four-level correlation pyramid.
- Results RAFT reaches an F1-all error of 5.10% on the KITTI test leaderboard, against 6.10% for the best published result.
Why flow networks need a different refinement design
Learned optical flow has reached accuracy close to the best hand-crafted methods and runs much faster at inference, so the open question is which architecture trains reliably and generalizes to new scenes. Many learned systems follow a coarse-to-fine cascade, estimating flow at low resolution and then upsampling and refining it at high resolution.
That cascade can struggle to recover from errors made at coarse resolution, can miss small fast-moving objects, and usually needs more than 1M training iterations.
Iterative refinement avoids a fixed cascade, but several earlier designs do not share weights across steps, so their number of steps is fixed in advance. The one recurrent prior approach, IRR, is capped at 5 iterations when it uses FlowNetS, a network of 38M parameters, and its iterations are bounded by the pyramid levels when it uses PWC-Net.
RAFT therefore keeps a single flow field at full resolution and updates it with one recurrent unit, so the update rule is applied repeatedly rather than in a fixed sequence of stages.
Features and the all-pairs correlation pyramid
The feature encoder is applied to both frames and maps each image to dense features at one eighth of its resolution, with feature dimension D = 256. The context network has the same architecture but reads only the first frame. Both networks run once, before any iteration.
The correlation volume takes the inner product of every feature vector in the first frame with every feature vector in the second frame, so it has size H×W×H×W; the authors note that this is a single matrix multiplication. The entry is defined as \(C_{ijkl}=\sum_h g_\theta(I_1)_{ijh}\, g_\theta(I_2)_{klh}\), where the sum runs over the feature channels.
The last two dimensions, which index the second frame, are average pooled with kernel sizes 1, 2, 4 and 8 to build four levels, so level k has size H×W×H/2^k×W/2^k. Keeping the first two dimensions at full resolution preserves fine detail for small motion, while the pooled levels expose large displacements.
At each iteration every pixel x in the first frame is mapped to its current estimated match x′ = (u + f1(u), v + f2(v)). A grid of integer offsets lies within an L1 radius r of x′, the grid is scaled by 1/2^k at level k, and bilinear sampling reads the values at those points on each level, which are concatenated into one feature map. A fixed radius therefore covers a wider area at coarser levels: at level 4, a radius of 4 spans 256 pixels at the original resolution.
Precomputing the full correlation volume costs O(N²) in the number of pixels and is done once, while the alternative that pools image features and computes correlations on demand costs O(NM) for M iterations. On 1088x1920 video, precomputing takes 17% of total inference time, so the precomputed form is used.
The recurrent update and learned upsampling
The update operator receives the current flow, the looked-up correlation features and a latent hidden state, and returns a flow change Δf and a new hidden state. Two convolutions process the correlation features, two more process the flow estimate, and the context features are injected directly; the three are concatenated to form the GRU input.
Each update adds Δf to the current estimate, so the flow is built up as a sequence of corrections from an initial value of zero.
The gated unit replaces the fully connected layers of a GRU with 3×3 convolutions, computing an update gate z_t, a reset gate r_t and a candidate state. The gates are \(z_t=\sigma(\mathrm{Conv}_{3\times3}([h_{t-1},x_t],W_z))\) and \(r_t=\sigma(\mathrm{Conv}_{3\times3}([h_{t-1},x_t],W_r))\), the candidate is \(\tilde h_t=\tanh(\mathrm{Conv}_{3\times3}([r_t\odot h_{t-1},x_t],W_h))\), and the state is \(h_t=(1-z_t)\odot h_{t-1}+z_t\odot\tilde h_t\).
The separable variant replaces the 3×3 convolution with a 1×5 GRU followed by a 5×1 GRU, enlarging the receptive field without a large increase in size.
Two convolutions predict Δf from the hidden state, and the same weights are tied across every iteration. Bounded activations are used so that the sequence of estimates tends toward a fixed point.
Flow is predicted at one eighth of the input resolution, and a learned module upsamples it. Two convolutions predict a mask of size H/8×W/8×(8×8×9), a softmax is taken over the nine coarse neighbours of each full-resolution pixel, and the full-resolution flow is the weighted combination of those neighbours. In the convex-upsampling reference table, this module reaches 1.43 on Sintel clean against 1.60 with bilinear upsampling, and the authors say it helps most near motion boundaries.
Training objective and schedule
The loss is an l1 distance between every predicted flow in the sequence and the ground truth, with weights that grow exponentially toward the final prediction: \[\mathcal{L}=\sum_{i=1}^{N}\gamma^{N-i}\,\|f_{gt}-f_i\|_1\] with γ = 0.8. Because the exponent N−i is zero for the last prediction, the final estimate carries the largest weight, while earlier steps still receive supervision.
During each update, gradients flow only through the Δf branch and are zeroed through the previous flow estimate, following a prior practice.
Training runs in stages on two 2080Ti GPUs: 100k iterations, then 100k more on FlyingThings3D, then 100k fine-tuning iterations on a mix of Sintel, KITTI-2015 and HD1K, and finally 50k iterations on KITTI-2015.
Sintel and KITTI results
With training only on FlyingChairs and FlyingThings, the model reaches an end-point-error of 1.43 on the Sintel training clean pass, which the authors describe as 29% lower than FlowNet2. The final pass reaches 2.71 in the same train-only setting, and the models use the median of three seeds selected on the clean pass. The authors attribute part of this transfer to the structure of the network, in which the flow is produced by repeated identical update steps that constrain the search space.
After fine-tuning on the combined Sintel clean and final passes with KITTI and HD1K data, RAFT ranks first on both Sintel passes on the test leaderboard. Against the best prior work it is 0.9 pixels (36%) better on the clean pass and 1.2 pixels (30%) better on the final pass. The two-view model reaches 1.94 on the Sintel test clean pass and 3.18 on the final pass, and the warm-start variant reaches 1.61 on the clean pass.
On KITTI, the model is trained on FlyingChairs and FlyingThings and evaluated on the KITTI-15 training split, where its end-point-error is 5.04 pixels.
On the KITTI test leaderboard, the two-view model reaches an F1-all of 5.10%, against 6.10% for the best published result. The warm-start variant is ranked first among all flow approaches on KITTI, although its KITTI test entries are not listed in the table.
Which design choices matter
The ablations are trained on FlyingChairs and FlyingThings. The reference model with bilinear upsampling is trained for 100k iterations on C and then 60k on T, and each variant changes one component. Replacing the ConvGRU with three convolutional layers with ReLU activation raises the Sintel clean end-point-error from 1.63 to 2.04 and the parameter count from 4.8M to 4.1M.
Removing the context network raises the Sintel clean end-point-error from 1.63 to 1.93 and the KITTI-15 F1-all from 19.8 to 23.1, while the parameter count falls from 4.8M to 3.3M. The authors note that the model without context still outperforms existing work on both Sintel and KITTI, and they say the context features help spatial information aggregate within motion boundaries.
The lookup radius sets the grid size used in each lookup. At radius 0 the clean error is 3.41, at radius 1 it is 1.80, at radius 2 it is 1.78 and at radius 4 it is 1.63. The authors observe that a radius of 0 still gives a rough flow estimate, and that the larger radii give better results. Removing the pooling that builds the multi-scale volumes raises the Sintel clean error from 1.63 to 1.95, and the authors take this to mean that both small and large displacements are captured by the pooled levels.
Restricting the correlation to a local range of 32 px, 64 px or 128 px gives clean errors of 2.91, 2.06 and 1.64, against 1.63 for all-pairs. Using multi-scale features instead of a single resolution raises the Sintel clean error from 1.63 to 2.08 and the parameter count to 6.6M.
In the convex-upsampling reference model, which is trained for 100k iterations on C and 100k on T, the Sintel clean error is 4.04 with 1 inference update, 2.14 with 3, 1.61 with 8, 1.43 with 32, 1.41 with 100 and 1.40 with 200. The model is unrolled for 12 updates during training, and the authors report that it surpasses PWC-Net after 3 updates and FlowNet2 after 6, while still improving with more updates.
Speed, parameter count and high-resolution video
The timing and accuracy in the efficiency plots are measured after 10 iterations on a GTX 1080Ti, with parameter counts for other methods taken from their papers.
The smaller model uses 1M parameters and outperforms PWC-Net and VCN, which are more than 6x larger, on Sintel final-pass accuracy.
On 1080p video from DAVIS, with the 1088x1920 resolution, 12 iterations take 550 ms, of which all-pairs correlation accounts for 95 ms. This timing belongs to the high-resolution test and is not the same measurement as the 10 frames per second figure on 1088×436 video.
Limitations
The reported evaluations cover Sintel, KITTI and the 1080p DAVIS video, and no other flow datasets or tasks are evaluated in the paper. The largest number of inference updates tested is 200 on Sintel, and the paper reports no test beyond that range. The warm-start variant has no KITTI test results in the table, so its KITTI standing is given only as a leaderboard ranking.
Ablation models follow a shorter schedule than the final model, so their numbers are not the same protocol as the headline results. Timing for other methods is partly taken from their papers and partly re-measured on the authors' hardware, so speed comparisons combine two sources.
Paper info
- Authors
- Zachary Teed, Jia Deng
- Venue
- arXiv · Preprint
- First published
- 2020-3-26
- Added
- 2026-11-12
- Updated
- 2020-8-25
- Version
- v3
- arXiv
- 2003.12039
- Category
- cs.CV
- Original paper terms
- arXiv non-exclusive 1.0
- What we show
- Paper info and commentary
AI commentary is a separate explanation from the original paper and may contain errors. The original paper and figures follow each source's terms of use and any rights noted separately.
Quote from the paper
Zachary Teed, Jia Deng (2020). RAFT: Recurrent All-Pairs Field Transforms for Optical Flow. arXiv:2003.12039v3. https://arxiv.org/abs/2003.12039v3
BibTeX
@misc{teed2020raft,
title = {{RAFT: Recurrent All-Pairs Field Transforms for Optical Flow}},
author = {Zachary Teed and Jia Deng},
year = {2020},
eprint = {2003.12039},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/2003.12039v3}
}