Abstract
Deep learning techniques have enabled rapid progress in monocular depth estimation, but their quality is limited by the ill-posed nature of the problem and the scarcity of high quality datasets. We estimate depth from a single camera by leveraging the dual-pixel auto-focus hardware that is increasingly common on modern camera sensors. Classic stereo algorithms and prior learning-based depth estimation techniques underperform when applied on this dual-pixel data, the former due to too-strong assumptions about RGB image matching, and the latter due to not leveraging the understanding of optics of dual-pixel image formation. To allow learning based methods to work well on dual-pixel imagery, we identify an inherent ambiguity in the depth estimated from dual-pixel cues, and develop an approach to estimate depth up to this ambiguity. Using our approach, existing monocular depth estimation techniques can be effectively applied to dual-pixel data, and much smaller models can be constructed that still infer high quality depth. To demonstrate this, we capture a large dataset of in-the-wild 5-viewpoint RGB images paired with corresponding dual-pixel data, and show how view supervision with this data can be used to learn depth up to the unknown ambiguities. On our new task, our model is 30% more accurate than any prior work on learning-based monocular or stereoscopic depth estimation.
Introduction
Estimating depth from a single image is a fundamental challenge in computer vision. While traditional stereo systems use two cameras to triangulate distance, monocular depth estimation must rely on contextual cues, which often leads to inaccuracies. Modern smartphone sensors offer a middle ground: Dual-Pixels (DP). Originally designed for rapid autofocus, DP sensors split each pixel into two halves, capturing two slightly different viewpoints through a single lens.
However, leveraging DP data for depth is non-trivial. The "baseline" between these views is microscopic, and unlike traditional stereo, the views do not just shift; they also exhibit different blur patterns depending on focus settings. This creates an affine ambiguity, where the relationship between sensor data and actual depth is obscured by unknown camera parameters.
Methodology
The core of our approach is treating depth estimation as a learning problem that respects the underlying physics of the DP sensor. We derived a mathematical model showing that the disparity ($d$) between dual-pixel views is an affine transformation of the inverse depth ($1/Z$): $d = A + B/Z$.
To address the unknown parameters $A$ and $B$, we introduced two novel loss functions designed for affine-invariant depth prediction:
- 3D Assisted Loss: Utilizes sparse ground-truth data to solve for optimal affine parameters during training.
- Folded Loss: A self-supervised method that optimizes these parameters as part of the network's gradient descent, requiring no ground-truth depth.
We implemented these ideas in DPNet, a lightweight U-Net-style architecture. Despite having only 0.24 million parameters, DPNet outperforms significantly larger models by effectively leveraging the high-quality signal from the DP hardware.
Dataset Collection
To train and evaluate our models, we collected a large-scale dataset of "in-the-wild" scenes. We used a custom rig holding five identical smartphones to capture nearly 18,000 images across 3,573 scenes, including pets, flowers, and various indoor/outdoor environments. High-quality ground truth depth maps were generated using multi-view stereo (COLMAP) from the four outer cameras to supervise the center camera's DP-based model.
Key Results and Insights
Our research demonstrates that DP data is more than just "tiny stereo." The focus cues provided by the differing point-spread functions are as critical as disparity. By embracing affine ambiguity rather than fighting it, we can produce highly effective relative depth maps suitable for applications like synthetic defocus (Portrait Mode).
Key findings include:
- Superior Accuracy: Our method is 30% more accurate than previous DP-based and standard monocular depth models.
- Efficiency: DPNet (0.24M parameters) outperformed a VGG-based model (19M parameters) when both were trained on DP data, highlighting the importance of the hardware signal over model size.
- Robust Generalization: The model generalizes effectively to devices not seen during training, indicating it has captured a robust physical representation of dual-pixel optics.
Conclusion and Future Work
While our model excels at relative depth estimation, it currently cannot determine absolute scale without additional metadata. It also faces challenges common to stereo systems, such as textureless surfaces and reduced precision at long ranges. Future research will explore combining DP cues with standard monocular context to improve long-range estimation and resolve absolute distance.
Summary updated