Context-Aware Iteration Policy Network for Efficient Optical Flow Estimation

Ri Cheng, Ruian He, Xuhao Jiang, Shili Zhou, Weimin Tan, Bo Yan

Abstract

Recurrent optical flow models, such as RAFT, achieve state-of-the-art performance by iteratively refining flow fields. However, these models typically employ a fixed number of iterations for every sample, leading to significant computational waste on simpler scenes where flow converges quickly. We present a Context-Aware Iteration Policy Network that enables these models to dynamically decide when to stop iterating on a per-sample basis. By skipping unnecessary updates when improvements become marginal, our method reduces computational costs (FLOPs) by up to 50% while maintaining competitive accuracy on standard benchmarks like Sintel and KITTI-15.

Introduction

Optical flow—the task of tracking the motion of every pixel between two video frames—is a cornerstone of computer vision, essential for autonomous driving and video editing. Modern architectures are often "recurrent," starting with an initial estimate and refining it over many iterations (typically 32).

This "one-size-fits-all" approach is inherently inefficient. Whether a scene contains a simple static background or complex high-speed motion, the model performs the same number of expensive iterations. Research indicates two primary inefficiencies: performance bottlenecks, where the network hits a ceiling and stops improving, and diminishing returns, where the accuracy gain from late-stage iterations does not justify the computational cost.

Proposed Method: Context-Aware Iteration Policy

To address these inefficiencies, we propose a lightweight Policy Network that can be integrated into existing recurrent optical flow architectures.

Overview of the Context-Aware Iteration Policy Network architecture, showing how the policy network decides to skip or update iterations based on resource preference r.

Key Components

  • Dynamic Skipping: At each refinement step, the Policy Network outputs a binary decision: "Skip" or "Update." To ensure this process is end-to-end trainable, we utilize the Gumbel-Softmax trick to handle the non-differentiable nature of discrete decisions.
  • Context-Awareness: The policy is informed by Iteration Embeddings, which provide temporal context within the refinement process, and a Historical Hidden Cell, which tracks the magnitude of flow improvements in previous steps. This allows the network to recognize the "signature" of a performance bottleneck.
  • User Controllability: We introduce a "resource preference" parameter ($r$). By adjusting this single value, users can balance speed and accuracy. A lower $r$ value biases the model toward skipping more iterations for faster inference.
  • Incremental Loss: The policy is trained using a specific loss function that encourages the network to estimate the potential error reduction of performing an additional iteration, effectively teaching it to "look ahead."

Experimental Results

We evaluated our approach by integrating the policy network into four major backbones: RAFT, GMA, FlowFormer, and KPA-Flow (renamed DRAFT, DGMA, etc.). Testing was conducted on the Sintel (Clean and Final) and KITTI-15 benchmarks.

Efficiency and Performance

On the Sintel-Clean dataset, DRAFT reduced FLOPs by 44% and inference time by 25% without increasing the End-Point Error (EPE) compared to the original RAFT. On KITTI-15, the model achieved a 21% reduction in FLOPs with no loss in accuracy. Notably, our dynamic model consistently outperformed standard RAFT models manually set to a lower number of fixed iterations, proving that sample-specific termination is superior to global iteration reduction.

Example of dynamic iteration selection where the policy network stops at iteration 6 as the error (EPE) plateaus, significantly reducing computational cost.

Key Insights

Our analysis revealed that for 67.1% of Sintel samples and 43% of KITTI samples, the model reaches near-optimal performance within the first 15 iterations. The remaining iterations are largely redundant. The Policy Network successfully identifies these cases, as shown in the example above where the model terminates at iteration 6 when the EPE curve flattens.

Conclusion and Future Work

The Context-Aware Iteration Policy Network offers a "free lunch" for recurrent optical flow models, adding less than 1% to the total FLOP count while providing massive savings in inference compute. While the theoretical FLOP reduction is significant, future work will focus on hardware-specific optimizations to better align "wall-clock" time speedups with theoretical gains, as current GPUs are less efficient with the dynamic branching introduced by per-sample skipping. Additionally, exploring joint end-to-end training of the backbone and policy network from scratch remains a promising avenue for further optimization.

Summary updated

BibTeX
@inproceedings{cheng2024context,
  author = {Ri Cheng and Ruian He and Xuhao Jiang and Shili Zhou and Weimin Tan and Bo Yan},
  title = {{Context-Aware Iteration Policy Network for Efficient Optical Flow Estimation}},
  booktitle = {AAAI Conference on Artificial Intelligence},
  year = {2024},
  doi = {10.1609/aaai.v38i2.27893},
}
Figure