Awesome
LiteFlowNet2
<p align="center"><img src="./figure/LiteFlowNet.png" width="800" /></p>This repository (<strong>https://github.com/twhui/LiteFlowNet2</strong>) provides the offical release of the code package for my paper <strong>A Lightweight Optical Flow CNN - Revisiting Data Fidelity and Regularization</strong> (i.e. <strong>LiteFlowNet2</strong>) in TPAMI 2020 (https://ieeexplore.ieee.org/document/9018073). The arXiv pre-print is available <a href="https://arxiv.org/abs/1903.07414.pdf"> here</a>.
LiteFlowNet2, another lightweight convolutional network, is evolved from our earlier work in CVPR 2018 (<strong>https://github.com/twhui/LiteFlowNet</strong>) to better address the problem of optical flow estimation by improving flow accuracy and computation time. Comparing to our earlier work, LiteFlowNet2 improves the optical flow accuracy on Sintel clean pass by 23.3%, Sintel final pass by 12.8%, KITTI 2012 by 19.6%, and KITTI 2015 by 18.8%. Its runtime is 2.2 times faster!
</ul> <table> <thead> <tr> <th align="center"></th> <th align="center">Sintel Clean Testing Set</th> <th align="center">Sintel Final Testing Set</th> <th align="center">KITTI12 Testing Set (Out-Noc)</th> <th align="center">KITTI15 Testing Set (Fl-all)</th> <th align="center">Model Size (M)</th> <th align="center">Runtime* (ms) GTX 1080</th> </tr> <tr> <td align="center">FlowNet2 (CVPR17)</td> <td align="center">4.16</td> <td align="center">5.74</td> <td align="center">4.82%</td> <td align="center">10.41%</td> <td align="center">162</td> <td align="center">121</td> </tr> <tr> <td align="center">PWC-Net+</td> <td align="center"><strong>3.45</strong></td> <td align="center"><strong>4.60</strong></td> <td align="center">3.36%</td> <td align="center">7.72% <td align="center">8.75</td> <td align="center"><strong>40</strong></td> </tr> <tr> <td align="center"><strong>LiteFlowNet2 (TPAMI)</strong></td> <td align="center"><strong>3.48</strong></td> <td align="center"><strong>4.69</strong></td> <td align="center"><strong>2.63%</strong></td> <td align="center"><strong>7.62%</strong></td> <td align="center"><strong>6.42</strong></td> <td align="center"><strong>40</strong></td> </tr> </tbody></table>Note: *Runtime is averaged over 100 runs for a Sintel's image pair of size 1024 × 436.
LiteFlowNet3
<strong>NEW! Our extended work (LiteFlowNet3, ECCV 2020) is now available at https://github.com/twhui/LiteFlowNet3</strong>.
We ameliorate the issue of outliers in the cost volume by amending each cost vector through an adaptive modulation prior to the flow decoding. We further improve the flow accuracy by exploring local flow consistency. To this end, each inaccurate optical flow is replaced with an accurate one from a nearby position through a novel warping of the flow field. LiteFlowNet3 not only achieves promising results on public benchmarks but also has a small model size and a fast runtime.
</ul> <table> <thead> <tr> <th align="center"></th> <th align="center">Sintel Clean Testing Set</th> <th align="center">Sintel Final Testing Set</th> <th align="center">KITTI12 Testing Set (Avg-All)</th> <th align="center">KITTI15 Testing Set (Fl-fg)</th> <th align="center">Model Size (M)</th> <th align="center">Runtime* (ms) GTX 1080</th> </tr> <tr> <td align="center">LiteFlowNet (CVPR18)</td> <td align="center">4.54</td> <td align="center">5.38</td> <td align="center">1.6</td> <td align="center">7.99%</td> <td align="center">5.4</td> <td align="center">88</td> </tr> <tr> <td align="center">LiteFlowNet2 (TPAMI20)</td> <td align="center">3.48</td> <td align="center">4.69</td> <td align="center">1.4</td> <td align="center">7.64%</td> <td align="center">6.4</td> <td align="center"><strong>40</strong></td> </tr> <tr> <td align="center">HD3 (CVPR19)</td> <td align="center">4.79</td> <td align="center">4.67</td> <td align="center">1.4</td> <td align="center">9.02%</td> <td align="center">39.9</td> <td align="center">128</td> </tr> <tr> <td align="center">IRR-PWC (CVPR19)</td> <td align="center">3.84</td> <td align="center">4.58</td> <td align="center">1.6</td> <td align="center">7.52%</td> <td align="center">6.4</td> <td align="center">180</td> </tr> <tr> <td align="center"><strong>LiteFlowNet3 (ECCV20)</strong></td> <td align="center"><strong>3.03</strong></td> <td align="center"><strong>4.53</strong></td> <td align="center"><strong>1.3</strong></td> <td align="center"><strong>6.96%</strong></td> <td align="center"><strong>5.2</strong></td> <td align="center">59</td> </tr> </tbody></table>Note: *Runtime is averaged over 100 runs for a Sintel's image pair of size 1024 × 436.
License and Citation
This software and associated documentation files (the "Software"), and the research paper (A Lightweight Optical Flow CNN - Revisiting Data Fidelity and Regularization) including but not limited to the figures, and tables (the "Paper") are provided for academic research purposes only and without any warranty. Any commercial use requires my consent. When using any parts of the Software or the Paper in your work, please cite the following paper:
<pre><code>@InProceedings{hui20liteflownet2, author = {Tak-Wai Hui and Xiaoou Tang and Chen Change Loy}, title = {{A Lightweight Optical Flow CNN - Revisiting Data Fidelity and Regularization}}, journal = {{IEEE Transactions on Pattern Analysis and Machine Intelligence}}, year = {2020}, url = {http://mmlab.ie.cuhk.edu.hk/projects/LiteFlowNet/} }</code></pre> <pre><code>@InProceedings{hui18liteflownet, author = {Tak-Wai Hui and Xiaoou Tang and Chen Change Loy}, title = {{LiteFlowNet: A Lightweight Convolutional Neural Network for Optical Flow Estimation}}, booktitle = {{Proceedings of IEEE Conference on Computer Vision and Pattern Recognition (CVPR)}}, year = {2018}, pages = {8981--8989}, url = {http://mmlab.ie.cuhk.edu.hk/projects/LiteFlowNet/} }</code></pre>Prerequisite and Compiling
LiteFlowNet2 uses the same Caffe package as LiteFlowNet. Please refer to the details in <a href="https://github.com/twhui/LiteFlowNet#Prerequisite"> LiteFlowNet GitHub repository</a>.
Training
Please refer to the training steps in <a href="https://github.com/twhui/LiteFlowNet#Training"> LiteFlowNet GitHub repository</a> and adopt the training prtocols in <a href="https://arxiv.org/abs/1903.07414.pdf"> LiteFlowNet2 paper</a>.
Trained models
The trained models (<code>LiteFlowNet2-ft-sintel</code>, <code>LiteFlowNet2-ft-kitti</code>) are available in the folder <code>/models/trained</code>. Untar the files to the same folder before you use it.
<code>LiteFlowNet2-ft-sintel</code>: Model used for Sintel benchmark.
<code>LiteFlowNet2-ft-kitti</code>: Model used for KITTI benchmark.
Testing
- Open the testing folder
- Create a soft link in the folder <code>/testing</code>
-
Replace <code>MODE</code> in <code>./test_MODE.py</code> to <code>batch</code> if all the images has the same resolution (e.g. Sintel dataset), otherwise replace it to <code>iter</code> (e.g. KITTI dataset).
-
Replace <code>MODEL</code> in lines 9 and 10 of <code>test_MODE.py</code> to one of the trained models (e.g. <code>LiteFlowNet2-ft-sintel</code>).
-
Run the testing script. Flow fields (<code>MODEL</code>-0000000.flo, <code>MODEL</code>-0000001.flo, ... etc) are stored in the folder <code>/testing/results</code> having the same order as the image pair sequence.
Reimplementation in TensorFlow
A TensorFlow-based reimplementation of LiteFlowNet2 is also available at https://github.com/rogerhcheng/LiteFlowNet2-TF2.