Reconstructing a 3D scene from a single 2D image is one of the "holy grails" of computer vision. While we’ve made massive strides with deep learning, most current methods are brittle—change the camera lens or the noise level, and the model often falls apart.
A new paper from researchers at Osaka University, titled "Single-Image Depth from Defocus with Coded Aperture and Diffusion Posterior Sampling," proposes a clever way out. By combining the physics of coded apertures with the generative power of diffusion models, they’ve created a reconstruction pipeline that is both highly accurate and remarkably robust to changing hardware parameters.
TL;DR
The authors introduce DFD-DPS, a method that uses a pre-trained diffusion model as a powerful image prior to solve the depth-from-defocus (DFD) problem. By enforcing measurement consistency through a differentiable physical model and updating the reconstruction in the "denoised" image space, they achieve state-of-the-art RGBD recovery that outperforms standard U-Nets and classical optimization without needing paired training data.
What Problem Does This Paper Address?
Recovering depth from a single image is an ill-posed inverse problem. Traditional Depth-from-Defocus (DFD) uses the fact that objects blur differently depending on their distance from the focal plane. To make this blur more "readable," researchers often use coded apertures—physical masks in the lens that create distinct, depth-dependent blur patterns (PSFs).
However, existing solutions have major drawbacks:
- Classical Optimization: Relies on "hand-crafted" priors (like assuming images are piecewise smooth). These often fail in low-texture areas or under heavy noise.
- End-to-End Deep Learning (U-Nets): These models learn a direct mapping from blur to depth. While fast, they are "black boxes" tied to the specific camera, mask, and noise levels they were trained on. If you swap the lens, you usually have to retrain the whole model.
Methods
The researchers propose a hybrid approach called DFD-DPS.
1. The Diffusion Prior
Instead of training a model to "guess" depth, they use a Diffusion Probabilistic Model trained on general RGBD data. This model acts as a "prior," knowing what natural scenes and depth maps should look like. They use Diffusion Posterior Sampling (DPS) to steer the diffusion process toward a solution that matches the actual captured image.
2. The $x_0$-Guided Update (The "Secret Sauce")
Standard DPS updates the reconstruction in the "noisy" space ($x_t$). The authors found this is too weak for DFD because the blur operator discards so much information. Instead, they propose an explicit $x_0$ estimation. At each step, they:
- Estimate a "clean" version of the image and depth map (using Tweedie’s formula).
- Calculate the gradient of the error between this estimate (passed through a physical model) and the actual observation.
- Update the estimate directly in the clean image space before re-noising it for the next diffusion step.
3. Differentiable Forward Model
To make this work, they built a differentiable model of the camera. It uses a single calibrated reference PSF and applies affine re-scaling to simulate blur at different depths. This allows the system to backpropagate errors through the physics of the lens.
Datasets
- Synthetic: 15,000 RGBD images generated using SUPERCLEVR (via Blender) for training the diffusion prior.
- Benchmarks: The classic Levin et al. dataset was used for simulation testing.
- Real-World: Data captured with a custom prototype camera featuring a 16mm f/1.4 lens and a fabricated chromium-on-glass coded aperture.
Key Insights and Ideas
- Decoupling Physics from Learning: Because the diffusion model is a general prior of "natural images," it doesn't need to be trained on defocused images. The "knowledge" of the camera is handled entirely by the differentiable forward model.
- Robustness to Mismatch: Unlike U-Nets, which see performance crater if the test noise doesn't match the training noise, DFD-DPS remains stable. It treats noise as part of the physical measurement process, not a feature to be memorized.
- Hallucination Control: By enforcing consistency in the $x_0$ (denoised) space, the model is much less likely to "hallucinate" objects or textures that aren't there—a common problem with standard generative sampling.
Key Results
- Quantitative: In simulations, DFD-DPS achieved a Depth Mean Absolute Error (MAE) of 0.025m, significantly outperforming U-Net baselines when there was a mismatch between training and evaluation noise levels.
- Qualitative: On real-world captures, the method successfully reconstructed complex scenes (like toy trucks and buses) with much sharper edges and more accurate depth transitions than classical methods or Deep Image Prior (DIP) approaches.
- Stability: The method showed "Camera Parameter Free" characteristics, meaning the same diffusion prior could be used across different optical setups as long as the forward model was calibrated.
Limitations and Future Work
- Fixed Mask Design: Currently, the coded aperture pattern is fixed. The authors suggest that "co-designing" the mask and the diffusion sampling process could yield even better results.
- Textureless Regions: While better than previous methods, very smooth, featureless surfaces still pose a challenge for depth estimation.
- Inference Speed: Diffusion models are iterative and computationally expensive compared to single-pass U-Nets. Optimizing the sampling speed is a clear next step.
- Scaling: The authors plan to scale the prior by training on much larger, more diverse RGBD datasets to create a "foundation model" for depth sensing.
Summary updated