Depth Pro 2: Sharp and Consistent Monocular Depth Estimation AI

Apple releases Depth Pro 2, a monocular depth estimation AI model on Hugging Face that generates sharp, temporally consistent depth maps from images and videos.

By Sci Herald Editorial Team ·

Released on Hugging Face by apple — view the original study

Depth Pro 2: Sharp and Consistent Monocular Depth Estimation AI

TL;DR: Apple has released Depth Pro 2, a family of AI models for estimating precise depth from a single camera. It is notable for producing sharp depth maps at object boundaries and maintaining temporal consistency across video frames, making it useful for applications in robotics, AR, and 3D scene understanding.

Key Facts

Depth Pro 2 at a Glance

Model VariantParametersOur Estimated Download Size
S24M97 MB
B97M386 MB
L334M1.3 GB
H+872M3.5 GB

What's New

Depth Pro 2 is a significant new entry in the field of monocular depth estimation, the process of predicting the distance of objects from a camera using only a single image. The model is designed to address two common challenges in this domain: producing crisp depth estimates at the edges of objects and ensuring these estimates remain stable from one video frame to the next, a quality known as temporal consistency. This makes it particularly suitable for video processing and real-time applications like augmented reality.

The release includes four model sizes, allowing developers to choose a version that balances performance (sharpness and consistency) with inference speed and resource requirements. All models share a separate, smaller neural network for estimating a camera's focal length when that metadata is not available.

Boundary sharpness against temporal consistency for Depth Pro 2 and prior single-frame and multi-frame methods
Boundary sharpness against temporal consistency for Depth Pro 2 and prior single-frame and multi-frame methods
Image: apple / Hugging Face card

How It Compares

The model card states that Depth Pro 2 outperforms prior work on both sharpness, as measured by Boundary F1 score, and temporal consistency, measured by Jitter. These results are reported as averages over the Sintel and Spring datasets. The card includes comparative charts positioning it in the top right, indicating higher F1 (better sharpness) and lower jitter (better consistency) than the alternatives shown.

Boundary sharpness against temporal consistency for Depth Pro 2 and prior single-frame and multi-frame methods
Boundary sharpness against temporal consistency for Depth Pro 2 and prior single-frame and multi-frame methods
Image: apple / Hugging Face card

How to Run It

The model is available on Hugging Face and is accessed via its dedicated depth-pro-2 library. The provided code snippet demonstrates how to install the library, load a model (in this case, the largest H+ variant), and run inference on both a single image and a video stream. The model is designed to run on a GPU using the bfloat16 data type for efficiency.

``bash pip install "git+https://github.com/apple-aiml-research/ml-depth-pro-2" ``

The core inference code for an image is concise, requiring the image to be loaded and transformed before being passed to the model's infer method, which returns a depth map in meters.

Depth Pro 2's architecture: a multi-view transformer over the input frames, then a DPT decoder per frame
Depth Pro 2's architecture: a multi-view transformer over the input frames, then a DPT decoder per frame
Image: apple / Hugging Face card

License and Commercial Use

The weights for Depth Pro 2 are released under the Apple Machine Learning Research Model license. This is a research-only license, explicitly prohibiting commercial use. It is intended for non-commercial scientific research and academic development.

Limitations

The model card does not list specific limitations or potential failure modes of the Depth Pro 2 model. As with any AI model, performance can vary depending on the input data, and users are advised to evaluate its results on their own specific datasets and use cases to assess its suitability. The card notes that the model estimates depth as "infinite" for areas like the sky.

Frequently Asked Questions

Is Depth Pro 2 free for commercial use?

No. The model weights are released under the Apple Machine Learning Research Model license, which is for non-commercial scientific research and academic development only. Commercial use is not permitted.

Can I run Depth Pro 2 locally?

Yes, the model is designed to be run locally. The provided Python code and installation instructions allow developers to download the model from Hugging Face and run inference on their own hardware, such as a machine with a CUDA-enabled GPU.

What is the difference between the S, B, L, and H+ models?

The primary difference is their size, measured in parameters, which directly impacts performance and speed. The larger models (L and H+) are designed to produce sharper depth maps with better temporal consistency, while the smaller models (S and B) are faster to run, making them suitable for applications where speed is a higher priority than maximum detail.

What does 'metric depth' mean?

Metric depth means the model predicts depth in actual, real-world units (meters), as opposed to relative depth, which only indicates which objects are closer than others without specifying the actual distance. This is crucial for applications that require precise measurements of a scene.

Does Depth Pro 2 work with any camera?

The model is designed to work with imagery from an "ordinary camera." It includes a separate focal length estimator to handle images and videos where the camera's intrinsic parameters are unknown, increasing its versatility across different sources.

Source: apple/DepthPro2 on Hugging Face