Learning a Geometric Representation for Data-Efficient Depth Estimation via Gradient Field and Contrastive Loss

Dongseok Shim, H. Jin Kim

TL;DR

This paper introduces a self-supervised pre-training method that teaches neural networks to learn "geometric" rather than just "semantic" representations by matching RGB images with their gradient fields. By using contrastive loss to distinguish an image's own structural edges from those of other images, the authors achieve a 3x improvement in data efficiency for monocular depth estimation compared to random initialization.

What Problem Does This Paper Address?

Monocular depth estimation—predicting 3D depth from a single 2D image—is a cornerstone for autonomous drones and cars. However, training these models typically requires massive datasets with pixel-perfect depth labels, which are incredibly expensive and difficult to collect.

While self-supervised learning (SSL) has been a boon for tasks like image classification, the authors point out a critical gap: standard SSL methods focus on semantic features (e.g., "is this a cat?"). These methods often ignore the geometric features (e.g., "where are the edges and boundaries?") essential for depth estimation. In fact, the authors demonstrate that some popular SSL pretext tasks, like predicting image rotation, can actually hurt a model's ability to estimate depth compared to starting with completely random weights.

Methods

The researchers propose a gradient-based momentum contrastive learning framework. Instead of using standard data augmentations like color jittering or cropping, they use the image's gradient field as a "geometric" signature.

  1. Gradient Field Generation: They use a modified Canny edge detector. They take the gradient magnitude from Sobel kernels and multiply it by a binary edge mask. This creates a representation that highlights not just where edges are, but how dominant they are. Gradient field generation process showing the original image, gradient magnitude, binary mask, and final gradient field.

  2. Momentum Contrastive Learning: They adopt the MoCo (Momentum Contrast) framework, which uses two encoders: a "query" encoder and a "key" encoder. The query encoder processes the original RGB image, while the key encoder processes the gradient field.

  3. Contrastive Loss: The model is trained using the InfoNCE loss. It learns to pull the representation of an RGB image closer to its own gradient field (the positive pair) and push it away from the gradient fields of all other images in a large dynamic dictionary (negative pairs). The proposed contrastive learning architecture using query and key encoders.
Gradient field generation process showing the original image, gradient magnitude, binary mask, and final gradient field.
The proposed contrastive learning architecture using query and key encoders.

Datasets

  • NYU Depth v2: The primary dataset for training and evaluation, consisting of ~120K indoor RGB-D images.
  • Make3D: An outdoor dataset used strictly for testing domain generalization. The model was never trained on outdoor data, yet it was evaluated here to see how well the learned geometric features transferred to new environments.

Key Insights and Ideas

  • Geometry vs. Semantics: The most striking finding is that semantic-focused pre-training (like Rotation or Exemplar tasks) degrades depth estimation performance. This suggests that the features needed to recognize an object are fundamentally different from those needed to locate it in 3D space.
  • Structural Robustness: By visualizing the learned convolution kernels, the authors found that the geometric features learned during pre-training are highly stable. They barely change during the final supervised fine-tuning phase, indicating the pre-training successfully captured the "essence" of the task.
  • Model Agnostic: The method was tested on both high-quality complex networks (DenseNet-based) and real-time efficient networks (ResNet-based), proving it works regardless of the specific architecture.

Key Results

  • Data Efficiency: The proposed method achieved the same accuracy with 1% of labeled data that a randomly initialized model achieved with 3%. This 3x gain is crucial for reducing the cost of depth annotation.
  • State-of-the-Art SSL: It outperformed existing SSL methods like MoCo, Rotation, and Exemplar across all quantitative metrics (accuracy $\delta$ and error metrics like $rms$ and $rel$).
  • Generalization: Even though it was only trained on indoor scenes (NYU), the model produced plausible depth maps for outdoor scenes (Make3D), preserving sharp edges around buildings and trees better than baseline methods.

Limitations and Future Work

The authors note that while their method beats all other self-supervised approaches, it still trails behind supervised pre-training on the massive ImageNet dataset (which has 14 million labeled images compared to the 120k unlabeled images used here). The sheer scale of ImageNet provides a powerful baseline that is hard to overcome without similar scale.

For future work, the authors suggest applying this geometric representation learning to other related tasks, such as surface normal estimation or 3D reconstruction, where structural boundaries are equally vital.

Summary updated

BibTeX
@inproceedings{shim2021learning,
  author = {Dongseok Shim and H. Jin Kim},
  title = {{Learning a Geometric Representation for Data-Efficient Depth Estimation via Gradient Field and Contrastive Loss}},
  booktitle = {IEEE International Conference on Robotics and Automation},
  year = {2021},
  url = {https://openreview.net/forum?id=H6MW3EFRClY},
}
Figure