NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Zero-Shot Depth from Defocus

Yiming Zuo, Hongyu Wen, Venkat Subramanian, Patrick Chen, Karhan Kayan, Mario Bijelic, Felix Heide, Jia DengarXiv 2026

TL;DR

This paper tackles the long-standing challenge of zero-shot generalization in Depth from Defocus (DfD) by introducing FOSSA, a novel Transformer-based architecture that efficiently aggregates defocus cues across a focus stack using a specialized stack attention layer. To overcome the lack of high-quality data in this domain, the authors present ZEDD, a diverse, real-world 4K benchmark with dense Lidar ground truth, alongside a highly effective synthetic data training pipeline. FOSSA significantly outperforms existing monocular and DfD baselines, reducing absolute relative error by up to 55.7% on real-world scenes.

What Problem Does This Paper Address?

Depth from Defocus (DfD) aims to estimate dense, metric depth maps from a "focus stack"—a series of images captured from a fixed viewpoint but at varying focus distances. As the focal plane sweeps through a scene, objects come into sharp focus and blur sequentially, providing rich geometric cues.

While DfD has clear applications in post-capture refocusing, 3D reconstruction, and novel view synthesis, existing models suffer from a major flaw: poor generalization. They overfit heavily to their training sets and fail when deployed in the wild. The authors identify two core bottlenecks preventing progress:

  1. Lack of High-Quality Benchmarks: Existing real-world datasets (like DDFF) are tiny, use small apertures where defocus is barely noticeable, and rely on low-resolution, noisy structured-light sensors for ground truth.
  2. Architectural Limitations: Prior DfD networks rely on custom, non-scalable layers that cannot easily leverage modern, large-scale vision pretraining or handle diverse camera settings.

Methods

The authors introduce a scalable network architecture alongside a randomized synthetic training pipeline to achieve zero-shot generalization.

FOSSA Architecture

FOSSA (FOcuS Stack Attention Transformer) leverages a standard Vision Transformer (ViT) backbone initialized from pretrained monocular depth models (DepthAnythingv2). It operates in two main stages:

  • Focus Stack Feature Extraction: Focus stack images are processed through weight-shared ViT blocks interleaved with a novel Stack Attention Layer. This layer embeds the explicit focus distance of each image using a two-layer MLP and performs self-attention across the focus stack dimension for each patch location. This allows efficient information exchange across frames without incurring massive spatial attention costs.
  • Feature Collapse and Refinement: The per-image feature maps are averaged (collapsed) into a single global feature map, which is further refined by subsequent ViT blocks and decoded via a Dense Prediction Transformer (DPT) head into a metric depth map.
Overview of the FOSSA pipeline

Data Pipeline & Domain Randomization

To train FOSSA without real-world focus stack datasets, the authors synthesize focus stacks from large-scale RGBD datasets (Hypersim and TartanAir). To bridge the sim-to-real gap, they employ aggressive domain randomization:

  • PSF Shape Randomization: Instead of assuming a standard Gaussian blur, they introduce a generalized Point Spread Function (PSF) formula that smoothly transitions between diffraction-limited (Gaussian) and defocus-dominated (uniform disk) blur regimes.
  • Focus Distance Randomization: They randomize both the near/far bounds and the sampling distribution (using power-law sampling in disparity space) to ensure robustness to how a user or camera captures a stack.

Datasets

  • ZEDD (ZEro-shot Depth from Defocus): The primary contribution to evaluation data. It features 100 unique indoor/outdoor real-world scenes captured with a 4K DSLR camera across 5 large apertures (up to F/1.4) and 9 focus distances. Ground truth is obtained by accumulating frames from a high-end Ouster Lidar, yielding dense, highly accurate depth maps.
  • Infinigen Defocus: A synthetic counterpart containing 200 procedurally generated indoor scenes rendered with physically accurate ray-traced defocus blur in Blender.
  • Evaluation RGBD Datasets: The model is evaluated zero-shot on iBims, DIODE, and HAMMER using synthetically applied blur, as well as the real-world DDFF dataset.

Key Insights and Ideas

  • Early Cross-Frame Interaction: Instead of processing images completely independently or fusing them only at the very end, FOSSA performs cross-image attention early. Because the attention mechanism is restricted to the stack dimension ($M$), the computational overhead remains low.
  • Focus Distance as a Metric Anchor: By explicitly embedding focus distances into the transformer tokens, the network resolves the scale ambiguity inherent to monocular depth estimation, allowing it to output true metric depth.
  • PSF Shape Matters: Real lenses do not produce perfect mathematical blurs. Randomizing the blur kernel's shape parameter ($p$) prevents the network from overfitting to synthetic blur artifacts, which is key to its real-world zero-shot success.

Key Results

  • ZEDD Benchmark: FOSSA reduces the Absolute Relative Error (AbsRel) by 55.7% compared to the best-performing monocular baseline (DepthPro), dropping the error from 0.201 to 0.089. Existing DfD baselines failed catastrophically on this real-world benchmark due to domain gaps.
  • DDFF Benchmark: When finetuned on DDFF, FOSSA outperforms the previous state-of-the-art (DualFocus) by reducing the Mean Squared Error (MSE) by 40.4%.
  • Robustness: FOSSA degrades gracefully when tested with fewer images than its training configuration (working with as few as 2 images) and consistently improves when provided with more images (up to 9).
Qualitative depth estimation comparisons on the ZEDD dataset

Limitations and Future Work

  • Static Scene Constraint: FOSSA assumes a completely static scene and a perfectly aligned focus stack. Any camera movement or object motion during capture breaks the alignment, causing artifacts. Integrating optical flow to handle dynamic scenes or handheld capture is a critical next step.
  • 2D Blur Approximation: The training pipeline applies blur via 2D post-processing convolutions on RGBD images, which cannot fully replicate complex 3D optical phenomena (like partial occlusions at blur boundaries). Utilizing learning-based image synthesis models could further narrow this sim-to-real gap.

Summary updated

BibTeX
@misc{zuo2026zero,
  author = {Yiming Zuo and Hongyu Wen and Venkat Subramanian and Patrick Chen and Karhan Kayan and Mario Bijelic and Felix Heide and Jia Deng},
  title = {{Zero-Shot Depth from Defocus}},
  year = {2026},
  eprint = {2603.26658},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2603.26658},
}
Figure