TL;DR
This paper introduces a highly efficient, block-sparse algorithm for sampling all-pairs correlation volumes in optical flow estimation. By eliminating the quadratic memory and computational bottlenecks of traditional methods without altering the underlying mathematics, it achieves up to a 99% reduction in memory usage and a 92% speedup over on-demand baselines, enabling state-of-the-art 8K ultra-high-resolution optical flow processing.
What Problem Does This Paper Address?
Modern optical flow methods—most notably RAFT (Recurrent All-Pairs Field Transforms)—rely on an "all-pairs correlation volume" to look up visual similarities between pixels across video frames.
The catch? For two images of size $H \times W$, the full 4D correlation volume requires computing and storing a matrix of size $(H \times W) \times (H \times W)$. This scales quadratically ($O(N^2)$) with the number of pixels. At standard resolutions, this is manageable. But at ultra-high resolutions (UHR) like 4K or 8K, storing this volume requires hundreds of gigabytes of VRAM, leading to immediate Out-Of-Memory (OOM) errors.
To circumvent this, current frameworks either use an "on-demand" sampling strategy (which saves memory but is painfully slow due to redundant, hardware-unfriendly computations) or downsample the input images, which discards fine-grained structural details. This paper tackles this exact efficiency-vs-memory trade-off.
Methods
The authors propose an Efficient Correlation Volume Sampler that computes the exact mathematical operator defined by RAFT but does so using a partial, block-sparse format. The method relies on three key technical innovations:
- Patch-Major Layout: Traditional images are stored in row-major order, which scatters localized 2D search windows across memory when flattened. The authors reshape the input features into a patch-major format, grouping local 2D image patches continuously in memory. This significantly increases the spatial block-sparsity of the correlation matrix.
- Implicit Computation Mask via Thread Voting: Instead of instantiating a massive binary mask in global memory to track which blocks need computation, the algorithm builds the mask implicitly. A custom CUDA kernel uses inter-thread voting (
atomicMinoperations in shared memory) to dynamically determine the next smallest block index required by any thread in the block. - Fused CUDA Kernel: The entire pipeline—determining required blocks, performing tiled block matrix multiplication, and locally sampling the results—is fused into a single CUDA kernel. Intermediate block results are kept entirely within GPU registers and shared memory, avoiding costly global memory round-trips.
Additionally, to better handle large pixel displacements at ultra-high resolutions, the authors introduce Cascaded Inference, a test-time multi-resolution initialization technique for the SEA-RAFT architecture that requires no additional training.
Datasets
The authors evaluated their isolated sampling routine and end-to-end models on:
- Sintel: A standard optical flow dataset used to analyze correlation volume access patterns and verify isolated sampling accuracy.
- CHARGE (New 8K Benchmark): Because no public 8K optical flow benchmarks existed, the authors rendered a realistic, ultra-high-resolution dataset based on the open-source Blender movie CHARGE. It consists of 335 forward-flow frames at $8192 \times 3432$ resolution, complete with 16K super-resolved ground-truth displacements.
Key Insights and Ideas
- The 1.6% Sparsity Realization: By tracking RAFT's lookups on Sintel, the authors discovered that across all iterative updates, only 1.6% of the dense correlation volume cells are ever actually sampled. The remaining 98.4% of computations are entirely wasted in the default dense implementation.
- Layout Dictates Sparsity: Simply changing how data is arranged in memory (row-major vs. patch-major) concentrates these sparse lookups into tight, predictable blocks, making block-sparse matrix multiplication highly effective on modern GPU tensor cores.
Key Results
- Isolated Performance: Compared to dense precomputation, the proposed sampler achieves up to 99% lower memory usage. Compared to on-demand sampling, it delivers up to a 92% runtime reduction while maintaining the exact same low memory footprint.
- End-to-End Speedups: Integrating this sampler as a drop-in replacement in RAFT cut total end-to-end inference time by up to 67%. When applied to the already-optimized SEA-RAFT, it yielded a 33% speedup.
- 8K Pareto Front: On the new 8K CHARGE dataset, combining the efficient sampler with the proposed Cascaded Inference allowed SEA-RAFT to achieve state-of-the-art accuracy (lowest 1px outlier error) while running significantly faster than competing models.
Limitations and Future Work
While the algorithm drastically optimizes inference, the authors note that they did not perform extensive low-level fine-tuning or hardware-specific micro-optimizations. Furthermore, this work focuses exclusively on optimizing the forward pass for inference, as training is typically conducted at lower resolutions. The authors point out that extending these block-sparse optimizations to the backward pass for high-resolution training remains an open and promising direction for future research.
Summary updated