Paper commentary
PWC-Net: CNNs for Optical Flow Using Pyramid, Warping, and Cost Volume
PWC-Net uses pyramids, warping and cost volumes to estimate optical flow
- Problem Accurate CNN optical flow models such as FlowNet2 are large, while compact models such as SpyNet give up accuracy. Compact models had not matched the accuracy of larger ones.
- Method PWC-Net is a compact CNN that builds learned feature pyramids. It warps the second image's features with the upsampled flow, builds a partial cost volume from them, and refines the flow with a context network.
- Results PWC-Net reached 5.04 average EPE on the MPI Sintel final pass test set, beating all published methods there. The model is about 17 times smaller than FlowNet2.
Why accuracy and size pull apart
Optical flow has long been estimated by energy minimization, which is expensive to run in real time, and that cost made learned models an appealing route. FlowNetS and FlowNetC showed that a generic U-Net style network can predict flow directly from raw image pairs, but their accuracy stayed below the best traditional methods.
SpyNet takes a different route: it warps the second image toward the first with the initial flow, so the remaining motion is small and a compact network is enough. Its accuracy lands near FlowNetC and below FlowNetS and FlowNet2. The authors attribute this gap to SpyNet using classical principles only in part, and they point to two missing pieces: input features that are invariant to shadows and lighting, and a cost volume as the matching representation.
The design question is then whether accuracy and model size can both improve, rather than trading one for the other.
Pyramid, warping and partial cost volume
Learned feature pyramids replace the fixed image pyramid of traditional coarse-to-fine methods, so the matched quantities are learned features rather than raw intensities. The bottom level is the input image, and each higher level comes from convolutional layers that downsample the level beneath it by a factor of 2. Feature channels grow from 16 at the first level to 196 at the sixth, passing through 32, 64, 96 and 128.
At level l, the features of the second image are warped toward the first image using the flow from level l+1 upsampled by a factor of two. Bilinear interpolation carries out the sampling, and gradients reach both the CNN features and the flow, so warping stays inside end-to-end training. For motion that is not a pure translation, warping can also undo part of the geometric distortion and bring patches to a matching scale.
The matching cost at each pixel is a correlation between the first-image feature vector at x1 and the warped second-image feature vector at x2, normalized by N, the length of that feature vector. Only a partial volume is computed: candidate offsets are limited to a search range d, so that \( \lVert x_1 - x_2 \rVert_\infty \le d \). The search range is 4 pixels at each level.
Flow estimator and context network
At each level, a multi-layer CNN takes the cost volume, the first-image features and the upsampled flow, and outputs the flow for that level. The estimator has five convolutional layers, with 128, 128, 96, 64 and 32 channels, and these widths stay fixed across levels. Each level has its own estimator parameters rather than sharing them. Optional DenseNet connections feed each convolutional layer with the output of and the input to the layer before it, which adds more direct connections.
The context network refines the flow after the estimator, using the estimated flow and the features from the second-to-last estimator layer. A dilated convolution spaces the filter taps by its dilation constant, so each output sees a wider region without a large computational cost. The context network is used only at pyramid level 2. The authors report a moderate performance improvement from the dilated convolutions in this setting.
Multi-scale loss and staged training
Training supervises the flow predicted at each level from l0 up to the top, as a weighted sum of per-pixel L2 errors against the scaled ground truth, plus a regularizer on the parameters. The level weights are α6 = 0.32, α5 = 0.08, α4 = 0.02, α3 = 0.01 and α2 = 0.005, and the regularizer weight γ is 0.0004. For fine-tuning, the penalty becomes \( (\lvert w^l_\Theta(x) - w^l_{GT}(x)\rvert + \epsilon)^{q} \) with q < 1, which penalizes outliers less.
The ground truth is scaled by 20 and downsampled for each level without further per-level scaling, so the flow from the third level is multiplied by 5 (= 20/4) before warping at the second level. With a 7-level pyramid and l0 set to 2, the model outputs quarter-resolution flow, which bilinear interpolation expands to full resolution.
The first stage trains on FlyingChairs with the Slong schedule in Caffe: the learning rate starts at 0.0001 and halves at 0.4M, 0.6M, 0.8M and 1M iterations, with 448 × 384 crops and batch size 8. The second stage fine-tunes on FlyingThings3D with the Sfine schedule, dropping pairs with motion larger than 1000 pixels, with 768 × 384 crops and batch size 4.
PWC-Net-ft uses the clean and final passes throughout, while PWC-Net-ft-final uses only the final pass in the second half of fine-tuning, which gives the final pass more weight. For KITTI, crops are 896 × 320 with reduced rotation, zoom and squeeze, batch size 4, and invalid pixels excluded from the loss.
Sintel and KITTI 2015 accuracy
On the MPI Sintel final pass test set, PWC-Net-ft-final reached an average EPE of 5.04, against 5.12 for DCFlow, which the authors describe as the best published method on that pass so far. PWC-Net-ft, which trains on both passes throughout, reached 5.13 on the same test pass, so the two fine-tuning schemes differ in how much weight the final pass receives.
The authors describe this as the first time an end-to-end method beats well-engineered traditional methods on this benchmark. Table 1 gives test-set values only for the fine-tuned variants.
On KITTI 2015, PWC-Net-ft reached 9.60% Fl-all on the test set, the lowest among the two-frame methods the authors compare against. On non-occluded pixels, PWC-Net has 6.12% Fl-all, against 6.94% for FlowNet2 and 7.46% for MirrorFlow. FlowNet2 has the lower foreground error on non-occluded pixels, 5.60% against 5.98% for PWC-Net.
Model size and running time
The authors state that PWC-Net is about 17 times smaller in size than FlowNet2. The warping and cost volume layers have no learnable parameters.
Forward inference takes 28.56 ms for PWC-Net and 84.80 ms for FlowNet2 in the Table 7 timings, measured on a Pascal TitanX GPU in the same desktop. The authors summarize this as about 2 times faster forward inference and at least 3 times faster training than FlowNet2. Training takes 4.8 days for PWC-Net and 4.1 days for PWC-Net-small, against a lower bound of more than 14 days for FlowNet2.
The authors also report about 35 fps on Sintel resolution (1024×436) images. Table 7 has no accuracy column, so these size and speed figures are not tied to a fine-tuned accuracy run.
What the ablations show
Unless stated otherwise, the ablations use models trained on FlyingChairs, and each variant changes one component while the rest is kept. Removing the warping layer raises Sintel final-pass EPE from 4.59 to 5.30 and KITTI 2015 Fl-all from 41.79% to 44.87%. Without warping the model still gives reasonable results, which the authors attribute to a search range of 4 being wide enough at the low-resolution levels.
On FlyingChairs-trained models, removing the context network raises Chairs EPE from 2.00 to 2.23 and Sintel final from 4.59 to 4.74. After fine-tuning on FlyingThings3D, Sintel final rises from 3.95 to 4.13 without the context network.
Removing DenseNet gives a higher Chairs error, 2.06 against 2.00, but lower Sintel clean and final errors, 3.09 and 4.37 against 3.33 and 4.59, for the FlyingChairs-trained model. After FlyingThings3D fine-tuning the variant without DenseNet is worse, with 2.48, 2.83 and 4.08 against 2.34, 2.60 and 3.95. The DenseNet effect therefore depends on the training stage.
A residual flow estimator, which predicts an increment added to the initial flow, gives Sintel final 4.43 and KITTI 2015 Fl-all 41.16%, against 4.59 and 41.79% for the full model, a small gain. A seven-layer estimator improves KITTI 2015 Fl-all to 39.18%, from 41.79% for the full model, although the authors observed that deeper estimators can stall in poor local minima.
Training through FlyingChairs, FlyingThings3D and Sintel gives 24.35% KITTI 2015 Fl-all, compared with 41.79% for the FlyingChairs-only model.
Design differences from SpyNet
SpyNet builds image pyramids and feeds its CNN with images, whereas PWC-Net builds feature pyramids and feeds the CNN a cost volume. The authors argue that a cost volume represents the search space more discriminatively, which makes the learning task for the CNN easier. On the Sintel final pass test set, PWC-Net-ft-final reaches 5.04 against 8.36 for SpyNet-ft.
FlowNet2 reaches its accuracy by stacking several basic models, while the authors argue that embedding classical principles yields similar or better performance in a much smaller model. The authors suggest PWC-Net could serve as a building block for larger networks, but that direction is not tested here.
Limitations
On the MPI Sintel clean pass, PWC-Net is less accurate than traditional approaches. The authors connect this to image edges, which align with motion boundaries in the clean pass but are corrupted in the final pass, and they expect PWC-Net to suit real images where edges are corrupted.
On KITTI 2012, SDF ranks ahead on non-occluded errors because it assumes a rigidity constraint for the background. A deeper flow estimator can get stuck in poor local minima, which the authors detect from validation errors and fix by restarting from a different random initialization. Ablations and the dataset schedule use FlyingChairs-trained models, so their numbers are not interchangeable with the fine-tuned models in Table 1.
Paper info
- Authors
- Deqing Sun, Xiaodong Yang, Ming-Yu Liu, Jan Kautz
- Venue
- arXiv · Preprint
- First published
- 2017-9-7
- Added
- 2026-11-12
- Updated
- 2018-6-25
- Version
- v3
- arXiv
- 1709.02371
- 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
Deqing Sun, Xiaodong Yang, Ming-Yu Liu, Jan Kautz (2017). PWC-Net: CNNs for Optical Flow Using Pyramid, Warping, and Cost Volume. arXiv:1709.02371v3. https://arxiv.org/abs/1709.02371v3
BibTeX
@misc{sun2017cnns,
title = {{PWC-Net: CNNs for Optical Flow Using Pyramid, Warping, and Cost Volume}},
author = {Deqing Sun and Xiaodong Yang and Ming-Yu Liu and Jan Kautz},
year = {2017},
eprint = {1709.02371},
archivePrefix = {arXiv},
url = {https://arxiv.org/abs/1709.02371v3}
}