This repository provides comprehensive tools and pre-trained models for benchmarking the robustness of optical flow estimation algorithms.
Accepted at Transactions on Machine Learning Research (TMLR), 2025
This package requires Python 3.10.x (tested with 3.10.17). Please ensure you have a compatible Python version installed.
⚠️ CUDA Toolkit Version Note: This package assumes your system uses CUDA 11.8 (installed system-wide). If your system CUDA version differs from the one used to build the PyTorch installation, you may encounter runtime issues. In such cases, follow the official PyTorch installation instructions to install a compatible version: https://pytorch.org/get-started/locally/
bash install.shAfter running the installation script, install the core flowbench package:
pip install -e .- Download the KITTI 2015 dataset from the KITTI Scene Flow Benchmark.
- After extraction, verify that the contents include
training/andtesting/directories. - Place the dataset at
datasets/kitti2015or adjust the path inptlflow/datasets.yml.
- Download the MPI Sintel dataset from the MPI Sintel Flow Dataset.
- After extraction, verify that the contents include
training/andtest/directories. - Place the dataset at
datasets/Sintel. - Download the MPI Sintel Depth training data from the MPI Sintel Depth Training Data.
- Extract the archive and verify it contains
training/camdata_left,training/depth, andtraining/depth_viz. Place these directories underdatasets/Sintel/trainingor adjust the path inptlflow/datasets.yml.
Alternatively, use our convenience script:
bash download_mpi_sintel.shDownload the precomputed 3D Common Corruption Images for KITTI2015 and MPI Sintel using the script below:
bash download_3dcc_data.shAfter download, the directory structure should look like:
datasets/3D_Common_Corruption_Images/kitti2015
datasets/3D_Common_Corruption_Images/Sintel
Note: Even if you only want to evaluate on the 3D Common Corruption Images, you must still download the original datasets to the expected folders to avoid errors.
There are two options:
- Download precomputed weather particle files via script (or manually from https://darus.uni-stuttgart.de/dataset.xhtml?persistentId=doi:10.18419/darus-3677):
bash download_weather_files.sh- Generate your own variants with custom parameters. Follow the instructions from the DistractingDownpour repository.
from flowbench.evals import load_model
model = load_model(
model_name='RAFT',
dataset='KITTI2015',
)To browse the full list of supported models:
from flowbench.evals import evaluate
model, results = evaluate(
model_name='RAFT',
dataset='KITTI2015',
retrieve_existing=True,
threat_model='PGD',
iterations=20, epsilon=8/255, alpha=0.01,
lp_norm='Linf', optim_wrt='ground_truth',
targeted=True, target='zero',
)retrieve_existing: WhenTrueand a matching evaluation exists in the benchmark, returns the cached result. Otherwise, runs a new evaluation.threat_model: The type of adversarial attackiterations: Number of attack iterationsepsilon: Permissible perturbation budget (ε)alpha: Step size of the attack (ϑ)lp_norm: Norm used to bound perturbation. Supported values:'Linf'or'L2'targeted: Boolean flag indicating whether the attack is targetedtarget: Target flow for a targeted attack (only applicable iftargeted=True). Supported values:'zero'or'negative'optim_wrt: Flow used as a reference for optimization. Supported values:'ground_truth'or'initial_flow'
# demo.py
from flowbench.evals import evaluate
model, results = evaluate(
model_name='RAFT',
dataset='Sintel-Final',
retrieve_existing=False,
threat_model='Adversarial_Weather',
weather='snow',
num_particles=10000,
targeted=True,
target='zero',
weather_data="datasets/adv_weather_data/weather_particles_red",
)See the docstring of evaluate() for additional configuration options.
To use evaluate via command line:
python demo.py --weather_data path_to_particle_dataIf you used download_weather_files.sh, three variants of particle data for the Sintel dataset should be available under datasets/adv_weather_data/. For example:
python demo.py --weather_data datasets/adv_weather_data/weather_snow_3000retrieve_existing: Works as described abovethreat_model: Must be'Adversarial_Weather'weather: Weather condition for the adversarial weather attack. Supported values:'snow','fog','rain', or'sparks'num_particles: Number of particles per frametargeted: Boolean flag indicating whether the attack is targetedtarget: Target flow for a targeted attack (only applicable iftargeted=True). Supported values:'zero'or'negative'
from flowbench.evals import evaluate
model, results = evaluate(
model_name='RAFT',
dataset='KITTI2015',
retrieve_existing=True,
threat_model='2DCommonCorruption',
severity=3,
)retrieve_existing: Works as described abovethreat_model: Must be'2DCommonCorruption'; returns evaluations across 15 corruption typesseverity: An integer from 1 to 5 indicating the corruption severity
from flowbench.evals import evaluate
model, results = evaluate(
model_name='RAFT',
dataset='KITTI2015',
retrieve_existing=True,
threat_model='3DCommonCorruption',
severity=3,
)retrieve_existing: Works as described abovethreat_model: Must be'3DCommonCorruption'; returns evaluations across 8 corruption typesseverity: An integer from 1 to 5 indicating the corruption severity
If you use this work, please cite:
@article{
agnihotri2025flowbench,
title={FlowBench: Benchmarking Optical Flow Estimation Methods for Reliability and Generalization},
author={Shashank Agnihotri and Julian Yuya Caspary and Luca Schwarz and Xinyan Gao and Jenny Schmalfuss and Andres Bruhn and Margret Keuper},
journal={Transactions on Machine Learning Research},
issn={2835-8856},
year={2025},
url={https://openreview.net/forum?id=Kh4bj6YDNm},
note={}
}
or
Agnihotri, Shashank, Julian Yuya Caspary, Luca Schwarz, Xinyan Gao, Jenny Schmalfuss, Andrés Bruhn, and Margret Keuper. “FlowBench: Benchmarking Optical Flow Estimation Methods for Reliability and Generalization.” Transactions on Machine Learning Research, 2025. https://openreview.net/forum?id=Kh4bj6YDNm