Unifying Flow, Stereo and Depth Estimation

Haofei Xu, Jing Zhang, Jianfei Cai, Hamid Rezatofighi, Fisher Yu, Dacheng Tao, Andreas Geiger

TL;DR

Researchers have developed a unified Transformer-based framework that treats optical flow, rectified stereo matching, and unrectified stereo depth estimation as a single dense correspondence problem. By sharing a single set of learnable parameters across all three tasks, the model achieves state-of-the-art performance while enabling seamless cross-task knowledge transfer.

What Problem Does This Paper Address?

In computer vision, understanding 3D scenes usually involves three distinct tasks:

  1. Optical Flow: Tracking pixel motion between consecutive video frames.
  2. Rectified Stereo: Finding horizontal pixel shifts (disparity) between a pair of aligned cameras.
  3. Unrectified Stereo Depth: Estimating depth from two images with known camera positions (poses) but arbitrary alignment.

Historically, these have been treated as separate problems requiring specialized, complex neural network architectures. This "siloed" approach is inefficient: it prevents models from sharing common geometric knowledge and requires massive engineering efforts to deploy different models for different tasks. The authors address this by identifying a fundamental commonality: all three tasks are essentially about finding corresponding pixels across different views.

Methods

The authors propose a unified model called GMFlow/GMStereo/GMDepth (collectively referred to as their unified model) based on a "Global Matching" formulation.

  • Feature Extraction: Instead of processing images independently with standard CNNs, they use a Transformer backbone. Specifically, they employ cross-attention mechanisms. This allows the network to "look" at both images simultaneously while extracting features, making the features highly discriminative for matching.
  • Parameter-Free Matching Layers: The core "intelligence" is in the features. The actual matching is done via simple, differentiable, and parameter-free layers tailored to each task:
  • Flow: 2D global correlation.
  • Stereo: 1D correlation along horizontal scanlines.
  • Depth: A plane-sweep approach testing different depth candidates.
  • Self-Attention Propagation: To handle occlusions (pixels visible in one image but not the other), the model uses a self-attention layer to "propagate" high-quality matches from visible regions to hidden ones based on feature similarity.
  • Refinement: While the base model works at 1/8th resolution, they introduce optional hierarchical matching and local regression steps to sharpen fine details.

Datasets

The model was evaluated across an impressive array of 10 popular benchmarks:

  • Optical Flow: Sintel (Clean/Final), KITTI 2015, FlyingChairs, FlyingThings3D.
  • Stereo: KITTI 2015, Middlebury, ETH3D, Argoverse, Scene Flow.
  • Depth: ScanNet, SUN3D, RGBD-SLAM, Scenes11.

Key Insights and Ideas

  • Cross-Attention is the "Secret Sauce": The authors demonstrate that classical CNNs, which process images in isolation, struggle to create features that "know" about the other view. Cross-attention integrates knowledge from both images early, significantly improving matching accuracy in textureless or ambiguous regions.
  • Global over Local: Unlike the popular RAFT model, which iteratively updates flow locally, this model performs global matching. This makes it much more robust to large displacements (fast-moving objects) where local search often gets stuck.
  • The Power of Unification (Cross-Task Transfer): Because the learnable parameters are identical for all tasks, you can take a model trained for optical flow and use it for depth estimation with zero additional training. The authors show that "flow-pretraining" provides a massive head start for stereo and depth tasks, leading to faster convergence and better final accuracy.

Key Results

  • Superior Performance: The unified model outperforms the well-known RAFT architecture on the challenging Sintel dataset.
  • Benchmark Leader: It achieved 1st place on the Argoverse Stereo Challenge and ranks near the top of the KITTI and Middlebury leaderboards.
  • Efficiency: On high-end hardware like the NVIDIA A100, the model is significantly faster than iterative methods. For example, it achieves a 2.29x speedup over RAFT while maintaining better accuracy.
  • Simplicity: By removing task-specific learnable components (like 3D convolutions for depth), the model is easier to implement and deploy.

Limitations and Future Work

  • Unmatched Regions: While the propagation strategy helps, occluded and out-of-boundary pixels remain the primary source of error.
  • Real-Time Constraints: While efficient, the full model with all refinement steps is not yet "real-time" (defined as 20+ FPS) on standard consumer hardware.
  • Beyond Two Frames: The current work focuses on 2-frame correspondence. Extending this unified matching logic to multi-view scenarios (many frames) is a logical next step.
  • Joint Training: The paper focuses on a single architecture that can do all tasks, but the authors note that training one single model to do all three simultaneously (multi-task learning) presents unresolved challenges in balancing loss functions across different domains.

Summary updated

BibTeX
@article{xu2023unifying,
  author = {Haofei Xu and Jing Zhang and Jianfei Cai and Hamid Rezatofighi and Fisher Yu and Dacheng Tao and Andreas Geiger},
  title = {{Unifying Flow, Stereo and Depth Estimation}},
  journal = {IEEE Trans. Pattern Anal. Mach. Intell.},
  year = {2023},
  doi = {10.1109/tpami.2023.3298645},
}
Figure