Depth Anything V2
Paper
•
2406.09414
•
Published
•
103
Depth Anything V2 models (Base and Large) converted to CoreML format for optimized inference on Apple Silicon (M-series chips).
| Model | Size | Parameters | Performance (M4 Pro est.) | License |
|---|---|---|---|---|
| Small F16 | 48 MB | 24.8M | Apache-2.0 | |
| Base F16 | 172 MB | 97.5M | CC-BY-NC-4.0 | |
| Large F16 | 590 MB | 335.3M | CC-BY-NC-4.0 |
All models use Float16 precision and run on Apple's Neural Engine + GPU + CPU.
Both Base and Large models are CC-BY-NC-4.0 (non-commercial only), following the official Depth Anything V2 licensing.
For commercial use, you must use the Small model (Apache-2.0), which is available directly from Apple's CoreML model zoo.
Base model:
curl -L -o DepthAnythingV2BaseF16.mlpackage.tar.gz \
"https://huggingface.co/mrgnw/depth-anything-v2-coreml/resolve/main/DepthAnythingV2BaseF16.mlpackage.tar.gz"
tar -xzf DepthAnythingV2BaseF16.mlpackage.tar.gz
Large model:
curl -L -o DepthAnythingV2LargeF16.mlpackage.tar.gz \
"https://huggingface.co/mrgnw/depth-anything-v2-coreml/resolve/main/DepthAnythingV2LargeF16.mlpackage.tar.gz"
tar -xzf DepthAnythingV2LargeF16.mlpackage.tar.gz
Small model (from Apple):
curl -L -o DepthAnythingV2SmallF16.mlpackage.zip \
"https://ml-assets.apple.com/coreml/models/Image/DepthEstimation/DepthAnything/DepthAnythingV2SmallF16.mlpackage.zip"
unzip DepthAnythingV2SmallF16.mlpackage.zip
import CoreML
let modelURL = URL(fileURLWithPath: "DepthAnythingV2BaseF16.mlpackage")
let config = MLModelConfiguration()
config.computeUnits = .all // Use Neural Engine + GPU + CPU
let model = try MLModel(contentsOf: modelURL, configuration: config)
// Input: RGB image (1, 3, 518, 518)
// Output: depth map (1, 518, 518)
M4 Pro (estimated):
These are 10-20x faster than ONNX CPU inference because they use the Apple Neural Engine.
@article{yang2024depth,
title={Depth Anything V2},
author={Yang, Lihe and Kang, Bingyi and Huang, Zilong and Zhao, Zhen and Xu, Xiaogang and Feng, Jiashi and Zhao, Hengshuang},
journal={arXiv:2406.09414},
year={2024}
}