Skip to main content

PyTorch Lightning Optical Flow

GitHub CI python status GitHub CI pytorch status GitHub CI lightning status GitHub CI build status

Introduction

This is a collection of state-of-the-art deep model for estimating optical flow. The main goal is to provide a unified framework where multiple models can be trained and tested more easily.

The work and code from many others are present here. I tried to make sure everything is properly referenced, but please let me know if I missed something.

This is still under development, so some things may not work as intended. I plan to add more models in the future, as well keep improving the platform.

What's new

- v0.5.0

Major update focusing on the correlation computation of the models and on deployment.

  • Added features:
    • Integration with the localcorr package, which provides fast correlation kernels (Triton, CUDA, and SYCL)
    • New corr_mode argument to select the implementation used to compute the correlation of the models (e.g., allpairs, torch, or the localcorr engines). If the selected mode is not available, a pure PyTorch implementation is used as fallback. See the installation instructions for more details.
    • Each correlation mode can also be chosen by using its model variant directly, e.g., --model raft_localcorr_tritonfor NVIDIA and Intel GPUs. It is installed automatically on Linux.
    • Support for Intel GPUs (XPU) in the infer, validate, and model_benchmark scripts
    • All models now accept the simple_io argument, and many model operations were revised to be exportable to ONNX and TensorRT
  • Added new models:
  • Additions / fixes:
    • The old alternate_corr and corr_fn arguments are still accepted, but they are deprecated and converted into corr_mode
    • Speed up metrics calculation and validation

- v0.4.2

- v0.4.1

- v0.4.0

Major update to support Lightning 2 (finally!). However, it also introduces breaking changes from the previous v0.3 code. See the details below.

- v0.3.2

- v0.3.1

- v0.3.0

Available models

Read more details about the models on https://ptlflow.readthedocs.io/en/latest/models/models_list.html.

Results

You can see a table with main evaluation results of the available models here. More results are also available in the folder docs/source/results.

Disclaimer: These results are the ones obtained by evaluating the available models in this framework in my machine. Your results may be different due to differences in hardware and software. I also do not guarantee that the results of each model will be similar to the ones presented in the respective papers or other original sources. If you need to replicate the original results from a paper, you should use the original implementations.

Getting started

Please take a look at the documentation to learn how to install and use PTLFlow.

You can also check the notebooks below running on Google Colab for some practical examples:

If you are using the previous v0.3.X code, then check the v0.3.2 documentation and the following example notebooks:

Licenses

The original code of this repository is licensed under the Apache 2.0 license.

Each model may be subjected to different licenses. The license of each model is included in their respective folders. It is your responsibility to make sure that your project is in compliance with all the licenses and conditions involved.

The external pretrained weights all have different licenses, which are listed in their respective folders.

The pretrained weights that were trained within this project are available under the CC BY-NC-SA 4.0 license, which I believe that covers the licenses of the datasets used in the training. That being said, I am not a legal expert so if you plan to use them to any purpose other than research, you should check all the involved licenses by yourself. Additionally, the datasets used for the training usually require the user to cite the original papers, so be sure to include their respective references in your work.

Contributing

Contribution are welcome! Please check CONTRIBUTING.md to see how to contribute.

Citing

BibTeX

@misc{morimitsu2021ptlflow,
  author = {Henrique Morimitsu},
  title = {PyTorch Lightning Optical Flow},
  year = {2021},
  publisher = {GitHub},
  journal = {GitHub repository},
  howpublished = {\url{https://github.com/hmorimitsu/ptlflow}}
}

Acknowledgements

  • This README file is heavily inspired by the one from the timm repository.
  • Some parts of the code were inspired by or taken from FlowNetPytorch.
  • flownet2-pytorch was also another important source.
  • The current main training routine is based on RAFT.

Metadata

Release files for ptlflow 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ptlflow 0.5.0
File Size Uploaded Provenance Actions
ptlflow-0.5.0.tar.gz 1.0 MB Without provenance Details for ptlflow-0.5.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ptlflow 0.5.0
File Interpreter ABI Platform Actions
ptlflow-0.5.0-py3-none-any.whl Python 3 none any Details for ptlflow-0.5.0-py3-none-any.whl

Total release size: 2.3 MB

Release files / ptlflow-0.5.0.tar.gz

Download URL ptlflow-0.5.0.tar.gz
Size 1.0 MB
Tags Source
SHA-256 checksum
How to use checksums
713b131b7ed05d5603a7060646a7f307f2a0f8f3b994f1aab71fbdb2926377fb
BLAKE2b-256 checksum
How to use checksums
c25b226e976ec38f545156e644c6ab2b543d5e793002e3523ac38d6cc1b7e96e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / ptlflow-0.5.0-py3-none-any.whl

Download URL ptlflow-0.5.0-py3-none-any.whl
Size 1.3 MB
Tags Python 3
SHA-256 checksum
How to use checksums
eb0ba7b853aa13ceedcaa60c6fe69bc8ccffb938112da03a2be4fe74abb0cfda
BLAKE2b-256 checksum
How to use checksums
0d96a80f19f7f8426b3bbc3289e252c9db736975e146fe21b95dc60e86ad50b6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for ptlflow 0.5.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page