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

Fully Self-Supervised Depth Estimation from Defocus Clue

Haozhe Si, Bin Zhao, Dong Wang, Yunpeng Gao, Mulin Chen, Zhigang Wang, Xuelong Li

Abstract

Depth-from-Defocus (DFD) is a classic computer vision task that leverages defocus blur as a depth cue. However, training deep learning models for DFD typically requires large-scale datasets with ground-truth depth or all-in-focus (AIF) images, both of which are difficult to acquire in real-world settings. We present a fully self-supervised framework that overcomes these limitations. Our approach, DAIF-Net, predicts depth and AIF images from a focal stack and validates these predictions through a differentiable, physics-based optical model. By minimizing the reconstruction error between the original and re-rendered focal stacks, the model learns to estimate depth without any external supervision.

Introduction

Estimating the 3D structure of a scene from 2D images is fundamental to robotics and augmented reality. Defocus blur provides a powerful monocular depth cue: as objects move away from the camera's focal plane, they become increasingly blurred. Traditional DFD methods often rely on supervised learning, which is bottlenecked by the scarcity of high-quality depth ground truth. While some self-supervised methods use AIF images as a proxy, capturing true AIF images requires small apertures that introduce noise and diffraction. This paper introduces a framework that treats both depth and AIF images as unknowns, solving for them simultaneously through a self-supervised feedback loop.

Methodology

The proposed framework consists of two primary components: the DAIF-Net architecture and a Differentiable Optical Model.

DAIF-Net utilizes a shared encoder to process a "sparse focal stack"—a set of images captured at different focus distances. A global max-pooling mechanism identifies the sharpest features across the stack, allowing the network to handle an arbitrary number of input images. The network outputs a predicted depth map and a predicted AIF image.

The self-supervision is driven by a physics-based optical model derived from the thin-lens equation. This model takes the predicted depth and AIF image to "re-render" the input focal stack. Because the optical model is deterministic and differentiable, the entire system can be trained end-to-end using a reconstruction loss ($L_{recon}$) that compares the rendered stack to the original input. This "physics-as-a-teacher" approach ensures the network learns representations that are physically meaningful rather than just statistically convenient.

Overview of the DAIF-Net self-supervised training pipeline, showing the interaction between the neural network and the physics-based thin-lens module.

Experimental Results

The model was evaluated on synthetic (DefocusNet, NYUv2) and real-world (Mobile Depth) datasets. On the NYUv2 dataset, the self-supervised approach achieved a $\delta1$ accuracy of 0.950, nearly matching the performance of state-of-the-art supervised models (0.967).

Qualitative evaluations on real-world data from the Mobile Depth dataset demonstrate the model's robustness. Unlike optimization-based methods that often produce noisy depth maps, our framework generates smooth, edge-aware depth estimates and high-quality AIF reconstructions even in the presence of complex real-world blur. The model successfully generalizes to different camera parameters, such as focal length and f-number, without requiring specific fine-tuning for each hardware configuration.

Qualitative comparison of depth estimation results across various methods. Our approach produces cleaner depth maps and sharper AIF images compared to existing baselines.

Conclusion

By grounding neural network predictions in the laws of optics, we have developed a robust, self-supervised framework for depth estimation. The use of a differentiable thin-lens model eliminates the need for ground-truth data, making DFD more accessible for real-world applications. While the model still faces challenges in textureless regions where blur patterns are difficult to discern, it represents a significant step toward practical, unsupervised depth sensing from standard camera hardware.

Summary updated

BibTeX
@inproceedings{si2023fully,
  author = {Haozhe Si and Bin Zhao and Dong Wang and Yunpeng Gao and Mulin Chen and Zhigang Wang and Xuelong Li},
  title = {{Fully Self-Supervised Depth Estimation from Defocus Clue}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2023},
}
Figure