MegaDepth: Learning Single-View Depth Prediction From Internet Photos

Zhengqi Li, Noah Snavely

Introduction

Predicting the 3D structure of a scene from a single 2D image is a fundamental but underconstrained challenge in computer vision. While deep learning has significantly advanced this field, progress is often bottlenecked by the availability of high-quality training data. Existing datasets typically rely on expensive hardware sensors like Kinect or LIDAR, which come with inherent limitations: the NYU Depth V2 dataset is restricted to indoor environments, KITTI is limited to specific driving scenarios, and Make3D lacks the scale required for modern deep learning architectures.

To overcome these constraints, the authors of MegaDepth propose a shift away from specialized sensors. Instead, they leverage the "virtually unlimited" source of images available on the web, using automated reconstruction techniques to build a massive, diverse dataset for single-view depth estimation.

Methodology: From Photos to Depth Maps

The core innovation of MegaDepth is an automated pipeline that transforms unorganized Internet photo collections into high-quality training data.

  1. Reconstruction via SfM and MVS: The researchers applied COLMAP, a state-of-the-art Structure-from-Motion (SfM) and Multi-View Stereo (MVS) system, to millions of Flickr photos of 200 global landmarks. While this generates dense depth maps, MVS data is often noisy, particularly around dynamic objects (like tourists) or complex edges.
  2. Semantic Cleaning: To mitigate reconstruction noise, the team employed PSPNet for semantic segmentation. By identifying foreground objects that MVS typically reconstructs poorly, they could discard unreliable depth values. Additionally, segmentation allowed them to identify the sky, which is consistently assigned to "infinite" depth.
  3. Ordinal Depth Generation: In regions where MVS failed entirely, the pipeline automatically generated "ordinal" labels (e.g., "Point A is further than Point B") based on semantic categories and geometric cues, ensuring the network still receives useful signals in sparse areas.
  4. Multi-Term Loss Function: Because SfM reconstructions are scale-ambiguous, the model uses a scale-invariant loss. This is supplemented by a multi-scale gradient matching term to preserve sharp edges and an ordinal depth loss to incorporate relative depth information.

Dataset and Training

The resulting MegaDepth (MD) dataset features approximately 130,000 valid images reconstructed from 200 landmarks. This diversity is a key differentiator from previous datasets, providing a much broader range of geometric structures and lighting conditions.

Comparison of Internet photos (Colosseum) and traditional datasets (Make3D) with their reconstructed depth maps.

During training, the authors found that the Hourglass (HG) network architecture provided the best performance. Crucially, training on "Clean MD" (semantically filtered data) significantly outperformed training on raw, unfiltered MVS data. For instance, testing on the Make3D set showed an RMS error drop from 11.41 to 5.49 when using the cleaned dataset.

Results and Generalization

The primary strength of MegaDepth is its ability to generalize to unseen environments. Most depth models struggle when moved from their training distribution (e.g., from a university campus to a city street). Because MegaDepth is trained on hundreds of diverse global locations, it exhibits remarkably strong generalization.

A depth prediction on a street scene, demonstrating the model's ability to generalize to non-landmark outdoor environments.

Key performance highlights include:

  • State-of-the-Art Generalization: When tested on Make3D without any prior exposure to that dataset, the MegaDepth model outperformed several models specifically trained on Make3D.
  • Depth in the Wild (DIW): On the DIW benchmark, MegaDepth achieved a 22.97% WHDR (Weighted Human Disagreement Rate), nearly matching models trained specifically for that task (22.14%), despite the significant difference in data distribution.

Conclusion and Future Work

MegaDepth demonstrates that "found" Internet photos can compete with or exceed the utility of specialized hardware sensors for training depth networks. By reversing the typical trend—using semantic segmentation to clean 3D data rather than the other way around—the authors have created a robust framework for large-scale depth learning.

However, limitations remain. The dataset is currently biased toward outdoor landmarks and monuments, and the model cannot yet predict absolute metric distance (e.g., meters) due to the scale-invariant nature of SfM. Future work may involve expanding the dataset to include more "everyday" scenes and utilizing more sophisticated semantic priors to handle complex geometries like thin structures or transparent surfaces.

Summary updated

BibTeX
@inproceedings{li2018megadepth,
  author = {Zhengqi Li and Noah Snavely},
  title = {{MegaDepth: Learning Single-View Depth Prediction From Internet Photos}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2018},
  doi = {10.1109/cvpr.2018.00218},
}
Figure