Digging into contrastive learning for robust depth estimation with diffusion models

Jiyuan Wang, Chunyu Lin, Lang Nie, Kang Liao, Shuwei Shao, Yao Zhao · DOI

Abstract

Recently, diffusion-based depth estimation methods have drawn widespread attention due to their elegant denoising patterns and promising performance. However, they are typically unreliable under adverse conditions prevalent in real-world scenarios, such as rain or snow. In this paper, we propose a novel robust depth estimation method called D4RD, featuring a custom contrastive learning mode tailored for diffusion models to mitigate performance degradation in complex environments. Concretely, we integrate the strength of knowledge distillation into contrastive learning, building the 'trinity' contrastive scheme. This scheme utilizes the sampled noise of the forward diffusion process as a natural reference, guiding the predicted noise in diverse scenes toward a more stable and precise optimum. Moreover, we extend noise-level trinity to encompass more generic feature and image levels, establishing a multi-level contrast to distribute the burden of robust perception across the overall network. Before addressing complex scenarios, we enhance the stability of the baseline diffusion model with three straightforward yet effective improvements, which facilitate convergence and remove depth outliers. Extensive experiments demonstrate that D4RD surpasses existing state-of-the-art solutions on synthetic corruption datasets and real-world weather conditions.

Introduction

Monocular Depth Estimation (MDE)—the task of predicting 3D distance from a single 2D image—is a fundamental component of computer vision for autonomous driving and robotics. While modern models achieve high accuracy in clear, sunny conditions, their performance often degrades significantly when faced with adverse weather such as rain, snow, or fog.

Most self-supervised MDE models rely on the assumption of photometric consistency: the idea that a point in one video frame should appear identical in the next. Adverse weather conditions break this assumption; raindrops, snowflakes, and fog introduce transient visual artifacts that do not follow consistent geometric patterns. Previous attempts to address this lack of robustness have utilized "teacher" models for label generation or standard contrastive learning. However, these methods often hit performance ceilings dictated by the teacher model or suffer from "network collapse," where the model adopts mathematical shortcuts that hinder the learning of useful features.

The D4RD Framework

To overcome these challenges, we introduce D4RD (Diffusion for Robust Depth), a framework that leverages the unique properties of diffusion models to achieve robust depth perception. Diffusion models operate by adding noise to data and learning to reverse this process. D4RD utilizes this mechanism to create a stable learning anchor that remains effective even in corrupted environments.

The 'Trinity' Contrastive Scheme

The core innovation of D4RD is the Trinity Contrastive Scheme, which integrates knowledge distillation into a contrastive learning framework. This scheme consists of three components:

  1. The Anchor: In the forward diffusion process, the exact noise added to an image is known. D4RD uses this "sampled noise" as a mathematically certain, ground-truth reference that requires no manual annotation.
  2. The Contrast: The model is tasked with predicting the noise for both a clear image and its "corrupted" (augmented) counterpart.
  3. The Alignment: The trinity loss forces the predictions for the clear image, the augmented image, and the actual sampled noise to converge. By aligning these three points, the model is prevented from collapsing and is provided with a stable target, even when the input image is obscured by weather.

Multi-level Contrastive Learning

Robustness is not localized to a single layer of the network. To distribute the burden of robust perception, we extend the trinity logic across three distinct stages:

  • Image Level: Enhancing the raw input to mitigate initial distortions.
  • Feature Level: Aligning the internal representations (concepts) formed by the network.
  • Noise Level: Ensuring the final denoising process remains precise and stable.

Enhancing Baseline Stability

Before implementing contrastive learning, we improved the underlying diffusion baseline. We utilized a BerHu loss combined with an adaptive filter to better handle depth outliers. Additionally, we implemented a sigmoid-based activation to bound depth values, preventing the model from predicting physically impossible negative values and facilitating faster convergence.

Experimental Evaluation

We evaluated D4RD on a comprehensive suite of synthetic and real-world datasets, including WeatherKITTI (synthetic weather), KITTI-C (image corruptions), DrivingStereo (real-world fog and rain), and Dense (real-world snow).

Key Results

D4RD sets a new benchmark for Robust Monocular Depth Estimation (RMDE):

  • Error Reduction: On the WeatherKITTI benchmark, D4RD achieved a 25.6% and 17.5% decrease in Absolute Relative (AbsRel) error compared to standard diffusion and Vision Transformer (ViT) baselines.
  • Zero-Shot Robustness: In tests on unseen real-world data, D4RD consistently outperformed existing state-of-the-art models. Qualitatively, the model demonstrated a superior ability to distinguish objects from snowy backgrounds and identify road signs through heavy rain.
  • Efficiency: The framework is highly efficient, increasing the total parameter count by only 0.4% over standard architectures.

Conclusion and Future Work

D4RD demonstrates that the inherent noise in diffusion models can serve as a "North Star" for robust learning. By distributing contrastive learning across multiple levels and stabilizing the diffusion process, we achieve significant gains in depth estimation accuracy under adverse conditions.

Despite these gains, challenges remain regarding inference speed. Like most diffusion-based models, D4RD requires iterative denoising steps, which can be slower than simple regression models. Future research will focus on accelerating the diffusion process and expanding training sets to include more diverse optical distortions, such as extreme lens blur.

Summary updated

BibTeX
@inproceedings{wang2024digging,
  author = {Jiyuan Wang and Chunyu Lin and Lang Nie and Kang Liao and Shuwei Shao and Yao Zhao},
  title = {{Digging into contrastive learning for robust depth estimation with diffusion models}},
  booktitle = {ACM Multimedia},
  year = {2024},
  doi = {10.1145/3664647.3681168},
}
Figure