Introduction
Optical flow estimation is a fundamental task in computer vision, involving the calculation of per-pixel motion between consecutive video frames. While supervised deep learning models have achieved impressive accuracy, their reliance on large-scale ground-truth datasets—which are difficult and expensive to obtain for real-world scenarios—remains a significant bottleneck. Unsupervised methods offer a scalable alternative by leveraging photometric consistency and spatial smoothness constraints. However, these methods typically struggle at motion boundaries and occluded regions where the underlying assumptions of brightness constancy and local smoothness break down.
UnSAMFlow addresses these challenges by integrating the Segment Anything Model (SAM) into an unsupervised framework. By utilizing SAM’s high-quality instance masks, the proposed method bridges the gap between low-level pixel motion and high-level object understanding, leading to sharper motion boundaries and improved handling of complex occlusions.
Methodology
The UnSAMFlow framework builds upon the ARFlow backbone and introduces three primary innovations to incorporate object-level knowledge into the unsupervised pipeline.
- Semantic Augmentation: To improve robustness in occluded regions, the authors employ a "copy-paste" strategy during training. Objects identified by SAM masks are synthetically moved from one frame to another, creating realistic occlusion scenarios with known motion. This forces the network to learn effective feature matching even when parts of the scene are hidden.
- Homography Smoothness Loss: Traditional smoothness losses often blur motion boundaries because they operate on local pixel neighborhoods. UnSAMFlow instead estimates a homography for each SAM-segmented region using RANSAC. The model penalizes deviations from this regional motion model, providing a non-local gradient that helps correct outliers and maintain consistency across entire objects.
- Mask Feature Module: Beyond loss functions, SAM masks are integrated directly into the network architecture. A dedicated module, inspired by PointNet, aggregates features across segments using max-pooling. This allows the decoder to reason about the motion of entire objects rather than treating pixels in isolation.
Results and Discussion
UnSAMFlow was evaluated on the KITTI (2012 & 2015) and MPI Sintel benchmarks. On the KITTI-2015 test set, the model achieved a state-of-the-art unsupervised error rate of 7.83%, significantly outperforming previous methods like UPFlow (9.38%) and SemARFlow (8.38%).
A key advantage of UnSAMFlow is its ability to produce sharp, well-defined motion boundaries. As shown in the qualitative comparison, traditional unsupervised methods often suffer from "bleeding" effects where motion estimates spill over object edges. By utilizing instance-level masks rather than broad category labels, UnSAMFlow correctly identifies that different objects (e.g., two adjacent cars) may have distinct trajectories.
The model also demonstrates strong cross-dataset generalization, maintaining high performance when trained on KITTI and tested on Sintel. This suggests that the inclusion of SAM-guided priors helps the network learn fundamental motion principles rather than dataset-specific artifacts. In terms of efficiency, the flow network runs at approximately 30 FPS on a Tesla P100 GPU, though SAM mask generation currently remains a pre-processing step.
Conclusion
UnSAMFlow demonstrates the power of foundation models like SAM in enhancing unsupervised tasks. By injecting object-level awareness into both the training objectives and the network architecture, the framework overcomes long-standing issues with motion boundaries and occlusions in unsupervised optical flow. Future work may involve integrating real-time distilled versions of SAM directly into the inference pipeline and exploring the addition of semantic category labels to further refine motion priors.
Summary updated