# FlowNet: Learning Optical Flow with Convolutional Networks

Convolutional networks can learn optical flow from synthetic data alone

Philipp Fischer, Alexey Dosovitskiy, Eddy Ilg, Philip Häusser, Caner Hazırbaş, Vladimir Golkov and 3 more · arXiv · 2015-4-26

- **Problem** Optical flow needs a displacement for every pixel, and no CNN had been trained for it. Labeled real flow data is too small to train one, so earlier methods relied on hand-built matching.
- **Method** FlowNet trains CNNs end to end on synthetic Flying Chairs image pairs. Unlike hand-built pipelines, one variant stacks both frames, while FlowNetC adds a correlation layer that matches features between two streams.
- **Results** FlowNetC reaches an endpoint error of 2.19 on the Flying Chairs test split, against 2.94 for EpicFlow.

## Why dense flow is hard for a plain network

Optical flow asks for a displacement vector at every pixel, so the network has to localize precisely and also work out which location in the second frame corresponds to each location in the first. Earlier CNN work on per-pixel targets such as segmentation and depth did not cover this matching step, and no earlier work had applied CNNs to flow estimation.

Data is the first obstacle. Ground truth flow for realistic video is very difficult to obtain. The real benchmarks are small: Middlebury has 8 training pairs, KITTI has 194 pairs with sparse flow, and Sintel has 1,041 pairs.

The response is to train CNNs end to end on image pairs with ground-truth flow, and to use a synthetic dataset to supply the volume of data. Two architectures are compared: a generic one that leaves the matching to the network, and one with a correlation layer that provides matching explicitly.

## Where the design comes from

Variational methods dominated flow estimation for a long time. Later work added combinatorial matching to them, as in DeepMatching and DeepFlow, which aggregate matches from fine to coarse without learning, and EpicFlow, which interpolates those matches into dense flow. The authors keep a variational step only as an optional refinement of the network's output, and they drop the hand-built matching, aggregation and interpolation.

Earlier learning-based flow methods learned regularizers, mixtures or classifiers over flow statistics, and unsupervised models using multiplicative interactions were not competitive on realistic video. CNN matching work compares patch features and leaves spatial aggregation to post-processing, whereas the networks here predict complete flow fields.

For per-pixel tasks, sliding-window CNNs are costly and patch-bound, so they cannot account for global output properties such as sharp edges. Long et al. and Dosovitskiy et al. refine coarse feature maps with upconvolutional layers. The authors upconvolve the whole coarse feature maps rather than only the coarse prediction, and they concatenate the result with the contractive features.

## Two architectures, one generic and one with matching

FlowNetSimple is the generic option. Both frames are stacked into one input and passed through convolutional layers only, so the network decides for itself how to extract motion. The network has nine convolutional layers, six of them with stride 2, a ReLU after each layer and no fully connected layers, which allows inputs of arbitrary size.

Filter sizes shrink with depth: 7×7 in the first layer, 5×5 in the next two, and 3×3 from the fourth layer on.

The authors argue that gradient descent may never reach a good solution in a fully generic network, so a less generic design may suit the data and the optimizer better. FlowNetCorr instead runs two identical streams, one per image, so each image is turned into features before the two are combined. The correlation layer joins the two streams, and the layers above it learn to predict flow from the matches it produces.

Both variants share one pattern: a contractive part that spatially compresses the input, followed by an expanding part that refines the result. Feature map counts grow with depth, roughly doubling after each stride-2 layer.

## What the correlation layer computes

The layer takes two feature maps \\( f\_1, f\_2 : \\mathbb{R}^2 \\rightarrow \\mathbb{R}^c \\), with width w, height h and c channels, and compares a patch centered at x1 in the first map with a patch centered at x2 in the second. The comparison is the sum over offsets \\( o \\in \[-k,k\]\\times\[-k,k\] \\) of the inner product of \\( f\_1(x\_1+o) \\) and \\( f\_2(x\_2+o) \\), written as \\\[ c(x\_1,x\_2)=\\sum\_{o\\in\[-k,k\]\\times\[-k,k\]}\\langle f\_1(x\_1+o), f\_2(x\_2+o)\\rangle \\\] for a square patch of size \\( K := 2k+1 \\).

The operation has the form of one convolution step, except that it convolves data with other data, so the layer has no trainable weights.

Comparing every location with every other location scales with w² h² comparisons, which is too large for efficient forward and backward passes. The authors therefore compare each location only with positions within a maximum displacement d, using a neighborhood of size \\( D := 2d+1 \\), and they stride both feature maps, with s1 for the first and s2 for the second.

The relative displacements are stored as channels, so the output has size w×h×D², and the parameters for FlowNetC are k=0, d=20, s1=1 and s2=2.

## Recovering full resolution

Pooling is needed for feasible training and for aggregating information over large areas, but it reduces resolution, so dense predictions need a refinement path. An upconvolutional layer unpools the feature maps, which extends them rather than shrinks them, and then applies a convolution. Each refinement step doubles the resolution.

Each step concatenates the upconvolved maps with the matching contractive feature maps and with an upsampled coarser flow prediction, so both the high-level information from coarser maps and the fine local detail from lower layers are kept. Four such steps leave the predicted flow four times smaller than the input.

Further refinement at that scale did not noticeably improve results, so the default is bilinear upsampling to full resolution, which gives the final flow. The +v alternative runs the variational approach cited as \[6\] without its matching term: it starts at the 4 times downsampled resolution, uses a coarse-to-fine scheme with 20 iterations, then runs 5 more iterations at full resolution.

Image boundaries from the approach cited as \[26\] modify the smoothness coefficient through \\( \\alpha = \\exp(-\\lambda b(x,y)\\kappa) \\), where b(x,y) is the thin boundary strength resampled at the respective scale. The authors describe this step as more expensive than bilinear upsampling, but it gives smooth, subpixel-accurate flow.

## Flying Chairs and the existing benchmarks

Middlebury is small and has mostly small displacements, KITTI has large motion but only sparse ground truth from a camera and laser scanner, and Sintel offers dense ground truth in Clean and Final versions.

Flying Chairs uses 964 Flickr images at 1,024×768 as backgrounds, each cut into quadrants of 512×384 pixels. Motion comes from randomly sampled affine transformations of the background and the chairs, with the chair transformations defined relative to the background transformation. The sampling distributions are adjusted so that the displacement histogram resembles the one from Sintel.

The procedure yields 22,872 image pairs with flow fields, and backgrounds are reused across pairs, while the authors note the size was chosen arbitrarily. For monitoring overfitting, the set is split into 22,232 training samples and 640 test samples.

## Augmentation and optimization

Augmentation runs online during training, and the authors find it crucial to avoid overfitting on Flying Chairs. The same strong geometric transformation is applied to both images of a pair, and a smaller relative transformation is added between them. The flow field is adjusted for the per-image transformations. Translation is drawn from \[−20%, 20%\] of the image width, rotation from \[−17°, 17°\] and scaling from \[0.9, 2.0\].

Photometric changes include Gaussian noise with sigma up to 0.04, contrast in \[−0.8, 0.4\], multiplicative RGB changes in \[0.5, 2\], gamma in \[0.7, 1.5\] and brightness changes with sigma 0.2.

Training minimizes the endpoint error, which is the Euclidean distance between predicted and ground-truth flow vectors averaged over pixels. The optimizer is Adam with β1 = 0.9 and β2 = 0.999. The authors chose it because it converged faster than stochastic gradient descent with momentum on this task. Mini-batches contain 8 image pairs. The learning rate starts at 1e−4, is halved every 100k iterations after the first 300k, and is used for the schedule described.

FlowNetCorr showed exploding gradients at a learning rate of 1e−4, so it starts at 1e−6 and rises to 1e−4 after 10k iterations. Test-time input upscaling was fixed once per network: no upscaling for FlowNetS and a factor of 1.25 for FlowNetC. Fine-tuning on Sintel uses the Clean and Final images together with a learning rate of 1e−6 for several thousand iterations.

The iteration count is chosen on a validation split of 133 pairs from 908 training pairs, and the whole training set is then used for that many iterations. KITTI is small and has sparse flow, so the authors fine-tune on the Sintel training set instead.

## Benchmark accuracy against baselines

On the held-out Flying Chairs test split, FlowNetC reaches 2.19 and FlowNetS 2.71, against 2.94 for EpicFlow and 3.53 for DeepFlow. Flying Chairs is the in-distribution case, because the networks are trained on it.

On the KITTI training split, FlowNetS has an endpoint error of 8.26 and FlowNetC 9.35. Fine-tuning on Sintel lowers the KITTI training error of FlowNetS to 7.52. The authors report that the fine-tuned networks outperform EPPM on Sintel Final and KITTI while being twice as fast.

## What variational refinement changes

On the Flying Chairs test split the step makes the error worse: FlowNetS rises from 2.71 to 2.86 and FlowNetC from 2.19 to 2.61. The authors read this as the networks already doing better than variational refinement on in-distribution data, and they expect a more realistic training set to help on other data.

On Sintel examples the authors compare predicted flow with ground truth and EpicFlow. They say the networks often produce visually appealing flow but score worse on endpoint error, partly because of noisy output in large smooth background regions.

## Speed on GPU and CPU

The networks predict flow for up to 10 image pairs per second at the full resolution of Sintel. The abstract gives the range as 5 to 10 fps.

In the timing table, per-frame time on Sintel is 0.08 seconds for FlowNetS and 0.15 seconds for FlowNetC on GPU, against 0.2 seconds on GPU for EPPM.

The FlowNets were timed on an NVIDIA GTX Titan GPU. The CPU timings of DeepFlow and EpicFlow are taken from another source, and the LDOF time was measured on a single 2.66GHz core. The authors note that many methods report only single-CPU runtimes, whereas FlowNet uses layers implemented only on GPU, so the timings are not measured on the same hardware.

## Training data and architecture trade-offs

Thanks to augmentation, a network trained only on Sintel learns flow fairly well. Its endpoint error on Sintel is roughly 1 pixel higher than that of a network trained on Flying Chairs and then fine-tuned on Sintel.

Training FlowNetC on Flying Chairs without data augmentation raises its endpoint error on Sintel by roughly 2 pixels, so augmentation remains necessary even on the large synthetic set.

FlowNetS generalizes to Sintel Final better than FlowNetC, while FlowNetC is better on Flying Chairs and Sintel Clean. Flying Chairs contains no motion blur or fog, which the Sintel Final version does contain. The authors suggest that, although the two networks have nearly the same number of parameters, FlowNetC overfits the training data slightly more.

## Large displacements and other limits

FlowNetC handles large displacements worse. On pixels with displacement of at least 40 pixels on Sintel Final, the s40+ error is 43.3 px for FlowNetS+ft and 48 px for FlowNetC+ft. The same weakness is visible on KITTI.

The authors link this to the maximum displacement d = 20 of the correlation layer, which limits the motions it can match, and they note that widening the range would cost computational efficiency.

Raw network output can be noisy and non-smooth in large smooth background regions, and variational refinement only partly compensates for this. Middlebury results appear only in the benchmark table, and the text does not discuss them.

Table scores in parentheses are results on data the network was trained on, and the authors state they are not directly comparable with other results. The Flying Chairs test score measures fit to the synthetic data, and the authors say the variational refinement finding may change with a more realistic training set.

## Paper info

- **Authors**: Philipp Fischer, Alexey Dosovitskiy, Eddy Ilg, Philip Häusser, Caner Hazırbaş, Vladimir Golkov, Patrick van der Smagt, Daniel Cremers, Thomas Brox
- **Venue**: arXiv · Preprint
- **First published**: 2015-4-26
- **Added**: 2026-11-12
- **Updated**: 2015-5-4
- **Version**: v2
- **arXiv**: 1504.06852
- **Category**: cs.CV · cs.LG
- **Original paper terms**: [arXiv non-exclusive 1.0](https://arxiv.org/licenses/nonexclusive-distrib/1.0/)
- **What we show**: Paper info and commentary

[Original paper ↗](https://arxiv.org/abs/1504.06852v2) · [PDF ↗](https://arxiv.org/pdf/1504.06852v2)

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

Philipp Fischer, Alexey Dosovitskiy, Eddy Ilg, Philip Häusser, Caner Hazırbaş, Vladimir Golkov, Patrick van der Smagt, Daniel Cremers, Thomas Brox (2015). FlowNet: Learning Optical Flow with Convolutional Networks. arXiv:1504.06852v2. https://arxiv.org/abs/1504.06852v2

**BibTeX**

```
@misc{fischer2015flownet,
  title = {{FlowNet: Learning Optical Flow with Convolutional Networks}},
  author = {Philipp Fischer and Alexey Dosovitskiy and Eddy Ilg and Philip Häusser and Caner Hazırbaş and Vladimir Golkov and Patrick van der Smagt and Daniel Cremers and Thomas Brox},
  year = {2015},
  eprint = {1504.06852},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1504.06852v2}
}
```

## Other paper commentary

- [Learning to Compare: Relation Network for Few-Shot Learning](https://refivu.com/en/papers/2b9dfd30-f9fd-420e-be01-a1907e2778c5-learning-to-compare-relation-network-for-few-shot.md)
- [XNOR-Net: ImageNet Classification Using Binary Convolutional Neural Networks](https://refivu.com/en/papers/a24ab4a0-5bb0-49ce-a4e8-1e280720a977-xnor-net-imagenet-classification-using-binary-convolutional.md)
- [Learning Transferable Features with Deep Adaptation Networks](https://refivu.com/en/papers/97cc84e7-8caf-4096-8372-c2986f3dff12-learning-transferable-features-with-deep-adaptation-networks.md)
- [Axiomatic Attribution for Deep Networks](https://refivu.com/en/papers/8f942e84-cd77-4efa-89f3-fcb9addb43ef-axiomatic-attribution-for-deep-networks.md)
- [On the difficulty of training Recurrent Neural Networks](https://refivu.com/en/papers/4d1ee0a2-985d-499a-b4ad-403b5731bcd8-on-the-difficulty-of-training-recurrent-neural-networks.md)
- [Spectral Networks and Locally Connected Networks on Graphs](https://refivu.com/en/papers/c8d7ac6f-ca53-43f2-b5f6-9ac71d5ca32d-spectral-networks-and-locally-connected-networks-on-graphs.md)
- [Residual Dense Network for Image Super-Resolution](https://refivu.com/en/papers/01bf3f14-f3f5-49d6-9844-02a897713390-residual-dense-network-for-image-super-resolution.md)
- [AutoAugment: Learning Augmentation Policies from Data](https://refivu.com/en/papers/4b6d74c6-1851-4ea4-8417-b325823c633e-autoaugment-learning-augmentation-policies-from-data.md)
- [Character-level Convolutional Networks for Text Classification](https://refivu.com/en/papers/7b769c87-9db2-455d-a744-b9548d185e67-character-level-convolutional-networks-for-text.md)
- [CNN Features off-the-shelf: an Astounding Baseline for Recognition](https://refivu.com/en/papers/7a883e97-7894-49b3-9ad9-4cec774f4e63-cnn-features-off-the-shelf-an-astounding-baseline.md)
- [Learning without Forgetting](https://refivu.com/en/papers/3784f887-f12a-406c-9f7c-0b1573555ee3-learning-without-forgetting.md)
- [Learning Deconvolution Network for Semantic Segmentation](https://refivu.com/en/papers/9a41459e-1e6d-4d79-b532-13493bd8cf30-learning-deconvolution-network-for-semantic-segmentation.md)

## Terms in this paper

- [ADAM](https://refivu.com/en/terms/0e9ad0199e08-adam)
- [Stochastic Gradient Descent](https://refivu.com/en/terms/a49650824022-stochastic-gradient-descent)
- [Data Augmentation](https://refivu.com/en/terms/cc5618231f4a-data-augmentation)
- [Convolutional Neural Networks](https://refivu.com/en/terms/936419759d72-convolutional-neural-networks)
- [KITTI](https://refivu.com/en/terms/300e3e1e2f51-kitti)
- [Optical Flow](https://refivu.com/en/terms/dcfba8696ff0-optical-flow)
- [Sintel](https://refivu.com/en/terms/9ff4056b018a-sintel)
- [upconvolution](https://refivu.com/en/terms/160ef86c479e-upconvolution)

---

AI-written text can contain mistakes. [Refivu](https://refivu.com/en/papers/e84affff-15cf-442c-afeb-bff13701eb83-flownet-learning-optical-flow-with-convolutional-networks)
