DIFT: Dynamic Iterative Field Transforms for Memory Efficient Optical Flow

Risheek Garrepalli, Jisoo Jeong, Rajeswaran C. Ravindran, Jamie Menjay Lin, Fatih Porikli

Introduction

Optical flow estimation—the task of determining pixel-level motion between consecutive video frames—is a fundamental component in computer vision applications ranging from autonomous navigation to video stabilization. While state-of-the-art (SOTA) models like RAFT (Recurrent All-Pairs Field Transforms) have achieved remarkable accuracy, their deployment on mobile devices is hindered by extreme memory requirements. Specifically, the 4D cost volumes used in these models often exceed the limited Tightly Coupled Memory (TCM) available on mobile AI accelerators, such as the Snapdragon HTP.

DIFT (Dynamic Iterative Field Transforms) addresses this bottleneck by introducing a lightweight, memory-efficient architecture designed for real-time performance on mobile hardware. By optimizing cost volume construction and leveraging hardware-aware operators, DIFT achieves 32 FPS on a smartphone while maintaining a peak memory footprint under 4MB.

Methods

DIFT reimagines the iterative refinement process to fit within the constraints of mobile hardware. The architecture focuses on reducing memory bandwidth and maximizing throughput through several key innovations.

DIFT Architecture Overview: The model uses dynamic cost volume resolutions and a just-in-time construction approach to minimize memory usage during iterative refinement.

Dynamic and Just-in-Time Cost Volumes

Instead of pre-computing a static, high-resolution cost volume pyramid, DIFT employs a Dynamic Coarse-to-Fine Lookup strategy. The resolution of the cost volume varies across iterations, starting coarse to capture large-scale motion and transitioning to finer resolutions for precision. To further reduce memory usage, the model utilizes Just-in-Time (JiT) Construction, computing the cost volume in small tiles or slices. This approach keeps peak memory usage at approximately 2MB, regardless of the total volume size.

Hardware-Aware Optimization: Bilinear Shift

A significant bottleneck in mobile optical flow is the grid sampling operation used for warping. Standard implementations do not leverage vectorized execution efficiently on mobile NPUs. DIFT introduces the Bilinear Shift, a mathematically equivalent operation composed of element-wise operators. This optimization yields an 8x throughput improvement on mobile hardware by aligning with the SIMD capabilities of modern mobile accelerators.

Key Results and Discussion

The effectiveness of DIFT is demonstrated through its performance on standard benchmarks like KITTI-2015 and Sintel.

Throughput vs. EPE Trade-off: DIFT allows for flexible scaling between inference speed and accuracy by adjusting feature dimensions and iteration counts.

Performance and Efficiency

  • Real-Time Execution: DIFT achieves a throughput of 32 frames per second (inf/sec) on a Snapdragon 8 Gen 1 HTP.
  • Memory Footprint: The model operates within a peak memory limit of under 4MB, making it compatible with commercial smartphone TCM where original RAFT models fail to fit.
  • Accuracy: On the KITTI benchmark, DIFT achieves an Endpoint Error (EPE) of 5.89, balancing high accuracy with extreme efficiency.

Scalability

As shown in the throughput-accuracy curve, DIFT is highly scalable. By adjusting parameters such as feature dimensions (e.g., 128 vs. 64) and the number of iterations, developers can tune the model for specific use cases—ranging from high-speed tracking (3.85 EPE at 48 FPS) to high-precision estimation (2.7 EPE at 2 FPS).

Conclusion

DIFT demonstrates that memory, rather than raw FLOPs, is the primary bottleneck for mobile computer vision. Through hardware-algorithm co-design, specifically the Bilinear Shift and JiT cost volume construction, DIFT brings high-quality optical flow to mobile devices. Future work will explore incorporating global context through memory-efficient attention mechanisms and further optimizing the JiT pipeline to minimize construction overhead.

Summary updated

BibTeX
@inproceedings{garrepalli2023dift,
  author = {Risheek Garrepalli and Jisoo Jeong and Rajeswaran C. Ravindran and Jamie Menjay Lin and Fatih Porikli},
  title = {{DIFT: Dynamic Iterative Field Transforms for Memory Efficient Optical Flow}},
  booktitle = {Workshops @ CVPR},
  year = {2023},
}
Figure