<?xml-model href='http://www.tei-c.org/release/xml/tei/custom/schema/relaxng/tei_all.rng' schematypens='http://relaxng.org/ns/structure/1.0'?><TEI xmlns="http://www.tei-c.org/ns/1.0">
	<teiHeader>
		<fileDesc>
			<titleStmt><title level='a'>HybridDepth: Robust Metric Depth Fusion by Leveraging Depth from Focus and Single-Image Priors</title></titleStmt>
			<publicationStmt>
				<publisher>IEEE</publisher>
				<date>02/26/2025</date>
			</publicationStmt>
			<sourceDesc>
				<bibl> 
					<idno type="par_id">10590421</idno>
					<idno type="doi">10.1109/WACV61041.2025.00104</idno>
					
					<author>Ashkan Ganj</author><author>Hang Su</author><author>Tian Guo</author>
				</bibl>
			</sourceDesc>
		</fileDesc>
		<profileDesc>
			<abstract><ab><![CDATA[We propose HYBRIDDEPTH, a robust depth estimation pipeline that addresses key challenges in depth estimation, including scale ambiguity, hardware heterogeneity, and generalizability. HYBRIDDEPTH leverages focal stack, data conveniently accessible in common mobile devices, to produce accurate metric depth maps. By incorporating depth priors afforded by recent advances in singleimage depth estimation, our model achieves a higher level of structural detail compared to existing methods. We test our pipeline as an end-to-end system, with a newly developed mobile client to capture focal stacks, which are then sent to a GPU-powered server for depth estimation.Comprehensive quantitative and qualitative analyses demonstrate that HYBRIDDEPTH outperforms state-of-theart (SOTA) models on common datasets such as DDFF12 and NYU Depth V2. HYBRIDDEPTH also shows strong zero-shot generalization. When trained on NYU Depth V2, HYBRIDDEPTH surpasses SOTA models in zero-shot performance on ARKitScenes and delivers more structurally accurate depth maps on Mobile Depth. The code is available at https://github.com/cake-lab/HybridDepth/.]]></ab></abstract>
		</profileDesc>
	</teiHeader>
	<text><body xmlns="http://www.tei-c.org/ns/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xlink="http://www.w3.org/1999/xlink">
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="1.">Introduction</head><p>Depth estimation is a critical task in computer vision, with applications <ref type="bibr">[14]</ref> spanning autonomous driving, augmented reality <ref type="bibr">[10,</ref><ref type="bibr">13]</ref>, and robotics <ref type="bibr">[31]</ref>. While hardware like LiDAR and Time-of-Flight (ToF) sensors are commonly used for more expensive applications, they are often not available for mobile and consumer-specific applications. This has led to extensive research on vision-based depth estimation methods that rely solely on cameras. Monocular depth estimation models have gained popularity due to their simplicity and minimal hardware requirements; however, these models frequently suffer from scale ambiguity, where depth estimations vary across different zoom levels. Additionally, single-image models, such as ZoeDepth <ref type="bibr">[4]</ref> and ECoDepth <ref type="bibr">[18]</ref>, struggle to generalize well to real-world conditions, as demonstrated by recent work <ref type="bibr">[9]</ref> using ARK- itScenes <ref type="bibr">[2]</ref>.</p><p>Depth-from-focus (DFF) methods, which leverage focal stack information, provide a promising alternative by offering more robust depth cues and generating reliable metric depth estimates using only cameras. However, existing DFF-based models like DFV <ref type="bibr">[28]</ref> tend to produce noisy estimations in texture-less or challenging regions and can't generalize well, limiting their overall effectiveness. On the other hand, relative depth models, while capable of generalizing well to unseen data and capturing fine details in depth maps, do not provide metric information, making them unsuitable for applications that require metric depth values.</p><p>In this work, we address the above mentioned limitations by combining DFF with relative depth models. While relative depth models excel in generalization and structural accuracy, DFF provides reliable metric depth information without requiring specialized hardware. By integrating these two approaches, we have the potential to leverage the strengths of both, delivering robust and accurate depth estimation that is both scalable and applicable to a wide range of real-world scenarios.</p><p>Intuitively simple, we have to address the challenge of effectively combining focal stack information with relative depth models to maintain the structural accuracy and generalization capabilities of relative depth estimation, while incorporating the reliable metric depth information from DFF. Toward this end, we propose an end-to-end solution, called HYBRIDDEPTH, that fuses DFF and single-image priors to achieve robust metric depth estimation.</p><p>HYBRIDDEPTH is designed to deliver zero-shot performance, i.e. to effectively generalize to unseen data or scenes, by employing a three-stage approach. First, we capture the outputs from both the relative depth and metric depth models. Next, we perform a global scaling that aligns the relative depth output with the absolute scales provided by the metric information from DFF. Finally, we apply a deep learning-based refinement layer to fine-tune the intermediate depth map (i.e., globally scaled depth map), smoothing out any inconsistencies and enhancing the overall accuracy of the depth estimations. Figure <ref type="figure">1</ref> provides an example of how HYBRIDDEPTH refines the globally scaled depth map.</p><p>We conduct comprehensive experiments to evaluate our method on two real-world focal stack datasets, DDFF12 and Mobile Depth 1 . Due to the lack of focal stack datasets, we evaluate HYBRIDDEPTH on additional datasets, including NYU Depth V2 and ARKitScenes, with synthesized focal stacks. Our results demonstrate that HYBRIDDEPTH establishes new SOTA on depth estimation with focal stacks, as well as improved generalization capabilities. The qualitative zero-shot results on Mobile Depth and ARKitScenes show that HYBRIDDEPTH also generalizes well.</p><p>For example, HYBRIDDEPTH achieves a 10.5% and 6.1% improvement of MSE and RMSE on DDFF12, and 6.5% and 7.1% improvement of RMSE and AbsRel on the NYU Depth V2 dataset, compared to DFV <ref type="bibr">[28]</ref>. Moreover, our zero-shot performance on the ARKitScenes dataset shows a 43% improvement compared to SOTA methods <ref type="bibr">[29]</ref>. We also conduct comparisons with single-image depth estimation approaches such as Depth Anything <ref type="bibr">[29]</ref> to demonstrate the significant advantage of utilizing the focal stack information on mobile devices.</p><p>In summary, our main contributions are as follows.</p><p>&#8226; We design and implement an end-to-end pipeline HY-BRIDDEPTH that demonstrates the feasibility and benefits of fusing focal stack information with singleimage priors in achieving robust metric depth estimation. Relevant research artifacts will be open-sourced.</p><p>&#8226; HYBRIDDEPTH establishes new SOTA on DFF-based depth estimation, with a compact model of 240 MB and an inference time of 20 ms, which is 19.2% of the Depth Anything size and 2.85X faster. &#8226; HYBRIDDEPTH showcases strong generalization performance on Mobile Depth and the AR-specific dataset ARKitScenes. &#8226; We demonstrate the significant advantage of HY-BRIDDEPTH over single-image depth estimation approaches, offering a viable and attractive alternative for mobile applications.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="2.">Related Work</head><p>Single-image depth estimation outputs depth maps given only single input images. Due to the inherent ill- 1 Only qualitative results are shown due to lack of ground truth depth. posedness of the task, such approaches usually adopt an affine-invariant depth map formulation. This specific formulation enables training on large datasets, and has been proven to be key to model generalization. For instance, models like Midas <ref type="bibr">[5,</ref><ref type="bibr">20]</ref>, DPT <ref type="bibr">[19]</ref>, and Depth Anything <ref type="bibr">[29]</ref> have made a good progress in zero-shot performance by using a novel scale-invariant loss function, enabling training on datasets captured with various hardware devices, and new way of using data from different domains. Also, these models are very good at maintaining structural and segmentation accuracy. Our work leverages the recent advancements in relative depth in zero-shot performance <ref type="bibr">[29]</ref> as the basis for achieving robust metric depth performance.</p><p>Metric depth estimation aims to provide exact depth values in physical units, such as meters. While this was traditionally only feasible with stereo or video approaches, models like Depth Anything <ref type="bibr">[29]</ref>, ZoeDepth <ref type="bibr">[4]</ref>, Ad-aBin <ref type="bibr">[8]</ref>, and LocalBin <ref type="bibr">[3]</ref> have shown success with single image inputs. However, such approaches usually degrade significantly for unseen data <ref type="bibr">[9]</ref> and unknown camera models <ref type="bibr">[30]</ref>. In contrast, our work relies less on visual data and, therefore, can circumvent the current problems of metric depth estimation.</p><p>Depth from focus (DFF) estimates depth by identifying the focus distance at which each pixel is most sharply defined, while areas outside the focal plane appear blurry, creating a circle of confusion (CoC). Deep learning-based methods <ref type="bibr">[12,</ref><ref type="bibr">15,</ref><ref type="bibr">24,</ref><ref type="bibr">28]</ref> use convolutional neural networks (CNNs) and neural networks to find the best focal plane for each pixel from a limited number of images. However, DFF can be noisy when suitable focal planes are missing from the data or when dealing with texture-less regions. Our design effectively mitigates these limitations by combining DFF with relative depth information and refining the depth map, ensuring accurate and stable estimations.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="3.">HYBRIDDEPTH</head><p>We propose HYBRIDDEPTH, a three-stage pipeline that achieves generalizable metric depth without subjecting to the scale ambiguity issue. The design of HYBRIDDEPTH is inspired by ViDepth <ref type="bibr">[25]</ref>, which uses IMU sensors. Unlike ViDepth, HYBRIDDEPTH relies only on RGB inputs, fulfilling the goal of providing highly detailed metric depth maps without the burden of additional sensors on mobile applications. Our key idea is to leverage a well-generalized relative depth model as the basis and then convert the relative depth to metric depth with the help of a DFF model. The focal stack provides precise depth information using just a camera <ref type="bibr">[28]</ref>, and relative depth estimation is known for its ability to generalize well across different scenes while maintaining strong structural accuracy <ref type="bibr">[20,</ref><ref type="bibr">29]</ref>. By combining these two methods, we show that HYBRID-</p><p>Dense Metric Depth Map X Metric Depth Map Random Select Single RGB Focal Stack Globally Scaled Depth Map Relative Depth Estimator Depth From Focus Frozen Trainable X Element-wise multiplication Dense Scale Map 1 2 3 Refinement Relative Depth Map Building Scale Map &#247; Global Scale and Shift Estimator Refined Dense Scale Map &#247; Element-wise divison Uncertainty Map DEPTH can benefit from both worlds and outperform both methods <ref type="bibr">[20,</ref><ref type="bibr">28]</ref>.</p><p>Figure <ref type="figure">2</ref> describes the overall architecture of HYBRID-DEPTH. In essence, the pipeline performs pixel-wise linear transformation to convert each pixel's relative depth to metric depth. The pipeline begins by processing the input focal stack. A randomly selected frame within the focal stack is passed through the relative depth estimator to generate a relative depth map, while the entire focal stack is fed into the DFF branch to produce a metric depth map 1 . These outputs are then aligned using a global scale and shift estimation process 2 . Finally, we address the remaining scale errors that occurred in 2 with a trainable scale refinement network 3 . In the following sections, we provide details about each of the three modules within our pipeline.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="3.1.">Capturing Relative and Metric Depth 1</head><p>The first step of HYBRIDDEPTH consists of two key modules, a single-image relative depth estimator and a DFF metric depth estimator, to generate the intermediate data for the later metric conversion and refinement. Note that even though the DFF module can output the metric depth map, the depth map quality can be low and lack details, as we will show later in the evaluation. Relative Depth Estimator. This module generates a dense relative depth map, serving as the foundation for our depth estimation process. It is designed to utilize a pre-trained model that takes a single RGB image as an input and produces a dense relative depth map. The reason we use a pretrained model like Depth Anything<ref type="foot">foot_0</ref>  <ref type="bibr">[29]</ref> is because it is trained on large amounts of datasets and, therefore, has a potential for good zero-shot performance.</p><p>DFF Metric Depth Estimator. This module provides the crucial metric information needed to convert the relative depth map into a generalizable metric depth map. Unlike other methods that rely on external sensors <ref type="bibr">[32]</ref>, our approach is entirely visual-based. By leveraging focus cues from a focal stack, consisting of images captured at different focus distances, this model assigns each pixel to its corresponding focus distance, yielding the metric depth for that specific pixel. For this module, we employ DFV<ref type="foot">foot_1</ref>  <ref type="bibr">[28]</ref>, a lightweight SOTA model that produces accurate metric depth for the DDFF12 dataset.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="3.2.">Relative and Metric Depth Fusion 2</head><p>The Global Scale and Shift Alignment. This module performs the linear transformation of the relative depth map to a globally scaled depth map using Equation <ref type="bibr">(1)</ref>.</p><p>Here, the Scale and Shift parameters are obtained via the least-square fitting <ref type="bibr">[20]</ref> using the metric and relative depth maps obtained from 1 . Applying the scale value globally for all pixels brings relative depth values to a correct order of magnitude, while applying global shift can help undo potential bias or offset in the original estimation. Unlike prior work <ref type="bibr">[4,</ref><ref type="bibr">29]</ref> that often alter the fundamental depth relationships, scaling relative depth directly allows us to maintain such relationships, and therefore avoid distortions and ensure high-quality depth maps. Building Dense Scale Map. To construct the dense scale map, we compute the pixel-wise scale difference between the globally scaled depth map (produced in 2 ) and the DFF branch's depth output (from 1 ). This process involves a straightforward pixel-level division, where each pixel in the globally scaled depth map is divided by the corresponding pixel in the DFF depth map. The resulting scale map captures the local scale variations, which will later be used in the refinement layer 3 to generate a refined dense scale map. This pixel-wise division ensures that the refinement layer can adjust each pixel's depth value according to its specific scale discrepancy.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="3.3.">Scale Refinement Layer 3</head><p>Global scale and shift alignment can introduce errors, as it attempts to convert the entire relative depth map into metric depth using only two parameters. This oversimplification may result in inaccuracies across specific pixels and regions. Our experiments suggest that certain areas of the globally scaled depth maps can benefit from localized scale refinements. To address this, we introduce a refinement layer that applies pixel-wise scale corrections to the globally scaled depth map, utilizing the scale map and uncertainty map derived from the DFF module.</p><p>Our refinement process leverages a customized version of MiDaS-small <ref type="bibr">[21]</ref> to correct pixel-wise scale errors. Specifically, this refinement model leverages the globally scaled depth map, the DFF-derived scale map, and the uncertainty map and outputs a refined dense scale map, which consists of pixel-wise depth scale adjustments. The uncertainty map allows the refinement layer to account for uncertainties from DFF, effectively guiding the model in weighting the influence of each pixel in scale refinement. This addition of uncertainty awareness empowers the refinement model to make more informed, precise adjustments, significantly improving the final depth map's accuracy and robustness. By integrating visual cues, pixel-wise scale refinement, and uncertainty-driven adjustments, this layer offers a novel and highly effective approach to refining depth maps, delivering enhanced metric precision without reliance on external sensors.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="4.">Implementation Details</head><p>Our model is implemented using the PyTorch framework. For real-world testing, we developed a mobile client using the Android Camera2 API to capture focal stacks, coupled with an edge server equipped with an NVIDIA RTX 4090 GPU for inference.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="4.1.">Training</head><p>We use Depth Anything pre-trained weights in all experiments to leverage its generalization. For the DFV module, we either use pre-trained weights (DDFF12, Mobile Depth, and ARKitScenes) or train it from scratch (NYU Depth V2). For the zero-shot experiments on ARKitScenes, we use both the pre-trained DFV models from NYU Depth V2 and DDFF12, with the refinement layer trained on NYU Depth V2. For Mobile Depth, we use the pre-trained DFV and train the refinement layer on NYU Depth V2.</p><p>All models are trained using the AdamW optimizer, with dataset-specific hyperparameters and batch sizes. Further training details, including hyperparameters, input sizes, and augmentations for each dataset, can be found in Supplementary Material.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="4.1.1">Loss Function</head><p>Prior work like ViDepth <ref type="bibr">[25]</ref> utilizes L1 loss as their regression task loss function. However, we know that L1 loss is sensitive to changes in distance ranges, hindering performance on unseen data <ref type="bibr">[7]</ref>. To address this issue, we adopt the scale-invariant loss function L SILog proposed in <ref type="bibr">[7]</ref>. Additionally, we integrate a multi-scale gradient loss function L grad to enhance visual quality and sharpness while preserving image boundaries as much as possible. Our overall loss function L is as follows:</p><p>where L SILog is defined as:</p><p>Here, g = log(d + &#945;)log(d gt + &#945;), with &#945; being a small constant to prevent undefined logarithmic operations, and &#946; serving as a scaling factor for the mean squared term. &#945; and &#946; are set to 1e -7 and 0.15.</p><p>L grad is defined as:</p><p>where &#8711; denotes the first-order spatial gradient operator, s indicates the scale factor for multi-scale analysis, d represents the predicted depth map, and d gt is the ground truth depth map. H and W are the height and width of the depth map, respectively. This composite loss function aims to optimize both the scale-invariant and gradient-based aspects of the predicted depth map, enhancing accuracy and geometrical information.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="4.2.">Data Synthesizing</head><p>The ability to synthesize focal stacks is crucial for overcoming the limitations of datasets that lack real focal stacks. To enable robust comparisons with SOTA models and to develop a versatile model for various applications (e.g., AR), we adopt a method to artificially recreate focal stacks from a single image with ground truth depth, similar to <ref type="bibr">[22]</ref>. The process to artificially recreate focal stacks from a single image (with ground truth depth information) follows these steps: (1) Build an arbitrary camera system: Configure a virtual camera with adjustable focus settings to mimic a physical camera system. (2) Define focus distances: Set specific focus distances to simulate camera focusing at different depths, similar to real-world camera behavior. (3) Apply circular kernel for blurring: Iterate over the image with a circular kernel to add blur based on the ground truth (GT) depth and the defined focus distances.</p><p>For the blurring process, we use Equation ( <ref type="formula">5</ref>), which is the same equation that has been used in recent works <ref type="bibr">[15,</ref><ref type="bibr">22]</ref> for creating the synthesized defocus blur. This equation is used to determine the extent of blur for pixels outside the specific focal plane according to the GT depth.</p><p>where f is the camera's focal length, N is the f-number (aperture) of the lens, S 1 is the distance to the in-focus subject, and S 2 is the distance beyond which subjects are considered out of focus. This equation allows for realistic synthesis of focal stacks by adjusting the blur based on depth, transforming a single image into multiple focal stack images. This enables us to leverage single-image depth datasets like NYU Depth V2 for training.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="4.3.">End-To-End Mobile Pipeline</head><p>We designed a mobile pipeline for utilizing HYBRID-DEPTH for depth estimation on a mobile client. The process begins with the mobile client capturing a focal stack of images(5 or 10), each representing different focus distances of the same scene. We developed an Android app using the Camera2 API to efficiently capture these focal stacks, adjusting the focus plane across five different values in a short time frame (approximately 141 &#177; 20 ms on a Pixel 6 Pro). All images are resized to 480 &#215; 640 for uniform processing and reducing computational cost.</p><p>To address potential misalignment among focal stack images, we leverage the mobile device's built-in optical image stabilization sensor (OIS) during capture. This ensures the focal stack is properly aligned before being sent to our model pipeline. Once the images are captured, they are transmitted to a server equipped with an NVIDIA RTX 4090 GPU for processing. On the server, we first apply OCR-based image alignment using OpenCV, before feeding the focal stack to HYBRIDDEPTH. The resulting dense depth map, which can be utilized in various mobile applications such as AR, is then returned to the mobile device.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="5.">Experiments</head><p>A key challenge in evaluating HYBRIDDEPTH is the lack of commonly used datasets that can allow us to directly compare with single-image and DFF-based methods. To address this, we evaluated HYBRIDDEPTH's performance across four different datasets. For direct comparison with other DFF-based models, we utilized the DDFF12 dataset. Additionally, we synthesized the NYU Depth V2 dataset as described in Section 4.2 to facilitate comparisons between single-image methods and DFF-based approaches. To assess the generalizability of HYBRIDDEPTH, we conducted zero-shot evaluations on ARKitScenes (quantitatively, qualitatively), as well as Mobile Depth (qualitatively).</p><p>HYBRIDDEPTH consistently outperforms existing methods on all datasets. For example, HYBRIDDEPTH achieves a 6.1% and a 36% improvement in RMSE on the DDFF12 and NYU Depth V2 datasets compared to each dataset's specific SOTA model (Tables <ref type="table">1</ref>, <ref type="table">3</ref>, 2), respectively. Additionally, HYBRIDDEPTH demonstrates superior generalizability in zero-shot evaluations. For example, HYBRID-DEPTH achieves a 82.7% improvement in RMSE compared to Depth Anything (Table <ref type="table">4</ref>). Furthermore, our qualitative experiments (Figures <ref type="figure">4</ref>, and <ref type="figure">5</ref>) show that HYBRID-DEPTH produces higher-quality depth maps compared to other models. Please refer to Supplementary Material for more visualizations and results for inference time.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="5.1.">Datasets</head><p>We select a diverse set of datasets, including real-world and synthetic datasets, to comprehensively evaluate HY-BRIDDEPTH and compare against single-image and DFFbased methods. The DDFF12 dataset offers real-world focal stacks captured by a light-field camera, enabling direct comparison with other DFF-based models. The Mobile Depth dataset, similar to DDFF12, contains real-world DFF data captured using a mobile phone and is used for qualitative comparison. We also transform the following two datasets with synthesized focal stacks to enable more comparisons. NYU Depth V2 is a widely recognized benchmark for monocular depth estimation, particularly for indoor scenes, which helps us compare HYBRIDDEPTH with other single-image depth estimation models. Lastly, ARK-itScenes is a large-scale, diverse dataset captured with mobile devices that represents real-world challenges in depth estimation <ref type="bibr">[9]</ref>. Please refer to Supplementary Material for more details about datasets.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="5.2.">Evaluation Metrics</head><p>We evaluate the metric depth accuracy with the following metrics: MSE as 1</p><p>Here, d i and di denote the ground truth and predicted depth at pixel i, and M is the total number of pixels in the image. Additionally, we assess the accuracy at threshold values using &#948; 1 , &#948; 2 , and &#948; 3 which measure the percentage of pixels where the predicted depth di is within 1.25, 1. Table <ref type="table">1</ref>. Performance comparison on the DDFF12 dataset. Bold values represent the best results. All numbers for other works have been taken from the DFV paper. The unit for all metrics is disparity.</p><p>RDF <ref type="bibr">[16]</ref> 91.8 &#215; 10 -4 0.0941 1.00 0.16 0.33 0.47 Defocus-Net <ref type="bibr">[15]</ref> 8.6 &#215; 10 -4 0.0255 0.17 0.61 0.94 0.97 DDFF <ref type="bibr">[12]</ref> 8.9 &#215; 10 -4 0.0276 0.24 0.61 0.88 0.96 DFFintheWild <ref type="bibr">[26]</ref> 5.7 &#215; 10 -4 -0.17 0.78 0.87 0.94 DFV <ref type="bibr">[28]</ref> 5.7 &#215; 10 -4 0.0213 0.17 0.76 0.94 0.98 Ours 5 5 5. . .1 1 1 &#215; &#215; &#215; 1 1 10 0 0 ---4 4 4 0.0200 0.17 0.79 0.95 0.98</p><p>Table 2. Performance comparison on the NYU Depth V2 dataset with other Depth from Focus/Defocus methods. Bold values represent the best results. The evaluation uses an upper bound of 10 meters on the ground truth depth map. DefocuseNet [15] results have been taken from the corresponding paper. The unit for all metrics is disparity. Model Type &#969; RMSE &#8595; AbsRel &#8595; &#948; 1 &#8593; &#948; 2 &#8593; &#948; 3 &#8593; DefocusNet [15] DFD 0.493 ----DefocusNet (&#8804; 2m) &#8225; DFD 0.180 ----DFV [28] DFF 0.136 0.028 0.996 1.000 1.000 Ours DFF 0.128 0.026 0.995 1.000 1.000 Ours (&#8804; 2m) &#8225; DFF 0.082 0.034 0.988 0.998 1.000 &#8225; These rows show performance metrics for distances under 2 meters. &#969; DFD/DFF stand for depth from defocus/focus depth estimation.</p><p>and 1.25 3 times the ground truth depth d i , respectively. For the DDFF12 dataset, we use the same metrics for disparity calculation.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="5.3.">Comparison to the State-of-the-Art</head><p>Results on DDFF12. This dataset presents a significant challenge for depth-from-focus (DFF) methods due to large texture-less areas, where focus cues are often weak in the focal stack, leading to increased error possibilities. As shown in Table <ref type="table">1</ref>, our model outperforms the current stateof-the-art models, achieving a 10.5% improvement in MSE and a 6.1% improvement in RMSE compared to DFV <ref type="bibr">[28]</ref>.</p><p>Additionally, compared to Defocus-Net <ref type="bibr">[15]</ref>, our model achieves a 40.7% improvement in MSE and a 21.6% improvement in RMSE. These improvements highlight the ef- fectiveness of our combination of Depth Anything and DFV with the refinement layer, which helps address scale inaccuracies and handle texture-less regions with weak focus cues.</p><p>Qualitative results, as shown in Figure <ref type="figure">3</ref>, further demonstrate that our model produces more detailed and higherquality depth maps, preserving structural information from Depth Anything. This illustrates the strength of our pipeline in leveraging Depth Anything's depth cues and improving upon DFF models through scale refinement.</p><p>Results on NYU Depth V2. Table <ref type="table">2</ref> compares HYBRID-DEPTH with DFF-based methods. We trained the DFV module on the NYU Depth V2 dataset and used it as a baseline for comparison. With the addition of our refinement layer, HYBRIDDEPTH outperforms DFV by 5.9% in RMSE and 7.1% in AbsRel. Furthermore, compared to Defocus-Net <ref type="bibr">[15]</ref>, HYBRIDDEPTH achieves a 74.0% improvement in RMSE. These results highlight the effectiveness of fusing Depth Anything and DFV with our novel refinement layer. Table <ref type="table">3</ref> compares HYBRIDDEPTH with single-image depth estimation methods on the NYU Depth V2 dataset. The significant performance gaps above single-image approaches highlight the effectiveness of HYBRIDDEPTH. Specifically, compared to Depth Anything <ref type="bibr">[29]</ref>, HYBRID-DEPTH improves RMSE by 37.9%. It also outperforms diffusion-based models like ECoDepth <ref type="bibr">[18]</ref> by 41.3% in RMSE. These results demonstrate that incorporating focal stack cues into the depth estimation task leads to substantial gains over single-image depth methods.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="5.4.">Zero-Shot Evaluation</head><p>We evaluated HYBRIDDEPTH's zero-shot performance, which is essential for most depth model applications, by comparing it against baselines on the ARKitScenes and Mobile Depth datasets. We show that HYBRIDDEPTH outperforms SOTA models on the ARKitScenes dataset and produces more detailed depth maps while preserving object boundaries on the Mobile Depth. Additionally, HY-BRIDDEPTH demonstrates better consistency in depth es-</p><p>RGB Ours DFV GT Depth Anything  timations across two different zoom levels, addressing the common scale ambiguity problem faced by single-image depth estimation models. Please check Supplementary Material for more visual comparisons of HYBRIDDEPTH to ARCore [1] and DFV. Results on ARKitScenes. As shown in Table 4, HYBRID-DEPTH achieves a 32.6% improvement in RMSE over DFV and a 45.3% improvement over Depth Anything, while using a smaller model size. When trained on NYU Depth V2 dataset, HYBRIDDEPTH achieves the best RMSE results and comparable AbsRel performance, highlighting the effectiveness of focal stack cues in mobile AR scenarios. Additionally, as seen in the comparison between the two versions of our model, one trained on NYU Depth V2 and the other on DDFF12, the model trained on NYU Depth V2 demonstrates better zero-shot performance, improving RMSE by 19.4% compared to the one trained on DDFF12.</p><p>This suggests that training with more data, even synthetic ones like NYU Depth V2, can improve zero-shot performance in real-world scenarios. Figure <ref type="figure">4</ref> further illustrates HYBRIDDEPTH's performance in capturing details and producing high-quality depth maps. Also, note that Depth Anything overestimates the depth values for some regions. Results on Mobile Depth. Figure <ref type="figure">5</ref> shows sample qualitative comparisons on Mobile Depth (other samples are shown in Supp.). We can see that HYBRIDDEPTH maintains higher levels of detail and object boundary accuracy. For example, in the last row, HYBRIDDEPTH captures the details on the ball correctly, but DFV's output is noisy. Comparing our results with Depth Anything, we can see that HY-BRIDDEPTH successfully utilizes all the details captured by Depth Anything. More examples are available in Supplementary Material. Effect of different zoom levels We evaluated HYBRID-DEPTH, DFV, and Depth Anything across two different zoom levels using two scenes (Figure <ref type="figure">6</ref>). HYBRIDDEPTH maintains consistent depth estimations in both scenes. In the first scene (Figure <ref type="figure">6a</ref>), HYBRIDDEPTH shows only a 5 cm difference between two zoom levels, while DFV exhibits a larger discrepancy of 18 cm and produces noisier results. Depth Anything significantly overestimates depth, with errors up to 240 cm, and shows inconsistencies of up to 120 cm between two zoom levels. In the second scene (Figure <ref type="figure">6b</ref>), HYBRIDDEPTH achieves an impressive depth difference of just 3 cm, while Depth Anything has a 45 cm difference and DFV shows a 14 cm difference, both failing to provide a correct and consistent depth.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="5.5.">Ablation Study</head><p>We investigate the impact of several key design choices. See more ablation studies in Supplementary Material. Effect of Uncertainty Map. Table <ref type="table">5</ref> shows the performance comparison of HYBRIDDEPTH with and without the uncertainty map on the DDFF12 dataset. When the uncertainty map is included, model achieves an 8.6% reduction in MSE and a 2.4% reduction in RMSE. These improvements suggest that incorporating the uncertainty map helps the refinement layer to refine depth estimates more accurately, leading to more accurate estimations. Effect of Refinement Layer. Table <ref type="table">6</ref> shows the performance of HYBRIDDEPTH on the DDFF12 and NYU Depth</p><p>Ours DFV Depth Anything X: Selected pixel GT for selected pixel = 100 cm Red: Overestimated, Green: Consistent 1x zoom 2x zoom 85cm 80cm 98cm 220cm 340cm 80cm x x x x x x x x (a) x 66cm 80cm 139cm 94cm 57cm 54 cm 2x zoom 1x zoom Ours DFV Depth Anything x x X: Selected pixel GT for selected pixel = 55 cm Red: Overestimated, Green: Consistent x x x x x x (b)</p><p>Figure <ref type="figure">6</ref>. Comparison of depth estimations across different zoom levels for various models. HYBRIDDEPTH achieves more accurate and consistent estimations than DFV and Depth Anything. Specifically, DFV's estimations are more noisy and have larger discrepancies (e.g., 18 cm) between two zoom levels than HYBRIDDEPTH (e.g., 5 cm). Depth Anything vastly overestimates the depth of both scenes. We captured the images using our own focal stack capturing mobile app ( &#167;4.3) using a Google Pixel 6 Pro and obtained the GT depth using a measuring tape.</p><p>Table <ref type="table">5</ref>. Performance comparison between HYBRIDDEPTH trained with and without uncertainty map for refinement layer on DDFF12. The unit for all metrics is disparity. </p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head n="6.">Conclusion and Future Work</head><p>Achieving robust and accurate metric depth estimation in the wild remains a challenging and important problem. Recent work demonstrated that single-image depth models such as ZoeDepth have poor generalizability in challenging real-world environments <ref type="bibr">[9]</ref>. Concurrently, we observe that existing foundational models like Depth Anything still face significant issues with scale ambiguity. Focal stack, data that has become increasingly available on mobile devices, has the potential to provide valuable depth information to address the scale ambiguity problem. These observations motivate our design of HYBRIDDEPTH, a novel end-to-end metric depth estimation pipeline.</p><p>At the core, HYBRIDDEPTH synergistically fuses metric information from the focal stack and depth prior from a foundational model, and uses a refinement model to further enhance details. HYBRIDDEPTH establishes new SOTA results on the commonly used DFF dataset DDFF12, improving RMSE and MSE over DFV <ref type="bibr">[28]</ref> by 6.1% and 10.5%, respectively. On another real focal stack dataset, Mobile Depth, HYBRIDDEPTH achieves strong zero-shot performance. Similarly, on datasets with synthetic focal stack (NYU Depth V2 and ARKitScenes), HYBRIDDEPTH outperforms both DFF and single-image SOTA models. This robust performance is achieved with only mobile cameras, making HYBRIDDEPTH highly practical and accessible compared to solutions that rely on specialized hardware like LiDAR or ToF sensors.</p><p>As part of future work, we will explore improving both the DFF modules and the single-image depth prior. While we showcase stronger generalization capabilities compared to previous methods, there is still a substantial performance drop on out-of-domain samples. We would like to close the gap by scaling up training and better utilizing synthetic data.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>A. Implementation</head></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>A.1. Training Details</head><p>For the NYU Depth V2 dataset, we set weight decay (&#955; ) to 0.001 and use a learning rate of 3 &#215; 10 -4 . The batch size is 24, and we use the original data size (480 &#215; 640) without any resizing.</p><p>For DDFF12, weight decay (&#955; ) is set to 0.0001, with a learning rate of 1 &#215; 10 -4 . The batch size is 8, and the input size during training is 224 &#215; 224 pixels, with random crop and flip augmentations applied. For evaluation, the original image size of 383 &#215; 552 is used, following DFF-based methods <ref type="bibr">[28]</ref>. Focal stacks are arranged in ascending order of focal distance to ensure consistency in depth processing.</p><p>For the refinement layer, we initialize the MiDaS-small encoder backbone with pre-trained ImageNet <ref type="bibr">[6]</ref> weights, while the remaining layers are randomly initialized to allow adaptation to our depth estimation task.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>B. Experiments</head><p>B.1. Dataset DDFF12 <ref type="bibr">[12]</ref>. We follow the dataset split specified in DFV <ref type="bibr">[28]</ref>. The training set consists of six scenes, each containing 100 samples, while the test set includes six different scenes with 20 samples per scene. Each sample contains a 10-frame focal stack along with a corresponding ground truth disparity map. The images have a resolution of 383 &#215; 552 pixels. For our training and evaluation, we used a focal stack of 5 frames, similar to DFV <ref type="bibr">[28]</ref>. Mobile Depth <ref type="bibr">[23]</ref> includes 11 aligned focal stacks from 11 different scenes. The image resolutions range from 360 &#215; 640 to 518 &#215; 774, with each stack containing between 14 and 33 frames. Since ground truth depth and focal distance are not provided, we used this dataset solely for qualitative comparisons on aligned focal stack images. NYU Depth V2 <ref type="bibr">[17]</ref> contains over 24K densely labeled RGB and depth image pairs in the training set and 654 pairs in the test set. This dataset covers a broad range of indoor environments, with ground truth depth maps obtained using a structured light sensor, provided at a resolution of 640 &#215; 480 pixels. ARKitScenes <ref type="bibr">[2]</ref> is a large-scale dataset designed for mobile AR applications. For our experiments, we utilized a subset of 5.6K images for evaluating HYBRIDDEPTH's zero-shot performance. This subset provides a comprehensive basis for evaluating the robustness and accuracy of our model under real-world AR conditions.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>B.2. Model Performance Analysis</head><p>We conducted a performance analysis to demonstrate the efficiency of our model compared to SOTA models like ZoeDepth-M12-N, Depth Anything, and DFV. All tests were performed on an Nvidia RTX 4090 GPU. Table <ref type="table">7</ref> shows that HYBRIDDEPTH achieves an inference time of 20 ms, which is 4.3X faster than ZoeDepth-M12-N and 2.85X faster than Depth Anything. Additionally, our model's size is 5.3X smaller than ZoeDepth-M12-N and 5.2X smaller than Depth Anything. Despite being more compact, HY-BRIDDEPTH provides a considerable improvement in performance and is highly suitable for deployment on devices with limited memory and storage. While DFV is faster at 8 ms and smaller in size, previous sections have shown that its depth estimation accuracy is significantly lower. applications, where accurate depth maps are essential for tasks such as rendering occlusions and precise object placement. We compared our model against the depth maps generated by the commercial ARCore framework <ref type="bibr">[1]</ref> and DFV <ref type="bibr">[28]</ref>. Utilizing an Android app, we captured a focal stack of five images and sent it over WiFi to an edge server for alignment and inference. Figure <ref type="figure">7</ref> shows that our model preserves better edge details and object boundaries compared to ARCore, while also producing smoother and more reliable depth maps than DFV. Qualitative Comparison on Mobile Depth. Figure <ref type="figure">8</ref> presents additional results on the aligned scenes of the Mobile Depth dataset. All deep learning methods generalize well to these scenes without fine-tuning. In row 4, our method successfully captures intricate details in the plants, and in the last row, HYBRIDDEPTH provides smoother and more accurate depth estimations, even capturing the depth behind objects. However, our model struggles with depth estimation for transparent surfaces, such as glass. The focal stacks in rows 6,7 are taken from the same scenes with different camera motions, therefore have slightly different frame alignment. We refer readers to <ref type="bibr">[23]</ref> for more details of this dataset. Overall, HYBRIDDEPTH consistently delivers smoother depth maps with better boundary preservation compared to other methods. Qualitative Comparison on NYU Depth V2. Figure 9 compares our model with Depth Anything on the NYU Depth V2 dataset. Both models generate accurate depth maps; however, our model excels at capturing depth for distant objects more closely aligned with the ground truth, as seen in rows 3 and 6. Additionally, our model captures finer details more effectively, particularly in row 2.</p></div>
<div xmlns="http://www.tei-c.org/ns/1.0"><head>B.4. Ablation Study</head><p>Effect of Focal Stack Size. We analyzed the effect of focal stack size on HYBRIDDEPTH's performance across the NYU Depth V2, DDFF12, and ARKitScenes datasets (Table <ref type="table">8</ref>). On the NYU Depth V2 dataset, increasing the focal stack size from 5 to 10 reduced the RMSE by 35.2% and the AbsRel by 42.3%, while both configurations still achieved state-of-the-art (SOTA) results. Similarly, on the ARKitScenes dataset, using a focal stack size of 10 slightly reduced the RMSE by 10.3%, confirming that HYBRID-DEPTH's performance benefits from a larger focal stack size but remains robust even with smaller stacks. The performance difference on the DDFF12 dataset was negligible between stack sizes, demonstrating consistent accuracy across different configurations. Different Global Scaling Methods. We evaluated the performance of various global scaling (GS) methods on the DDFF12 dataset, as shown in Table <ref type="table">9</ref>. The least square method showed competitive performance, achieving results comparable to more complex method RANSAC, but with a significant computational advantage. For example, it was over 30x faster than RANSAC with 200 iterations and 50 sample size, while providing similar accuracy with only a 1.8% increase in RMSE compared to the best RANSAC configuration. This makes the least square method the most efficient choice for global scaling, ensuring reliable depth estimates without adding considerable overhead.  RGB Ours Depth Anything GT Figure 9. Qualitative results on the NYU Depth V2 dataset.</p></div><note xmlns="http://www.tei-c.org/ns/1.0" place="foot" n="2" xml:id="foot_0"><p>Note that Depth Anything can also output metric depth directly, which we outperform as will be shown in the evaluation section.</p></note>
			<note xmlns="http://www.tei-c.org/ns/1.0" place="foot" n="3" xml:id="foot_1"><p>Directly using models like DFV will not give us the generality as we will show in the evaluation.</p></note>
		</body>
		</text>
</TEI>
