File size: 3,601 Bytes
4d055c7
 
 
 
 
 
 
 
d6eab0b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
9607015
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4d055c7
 
 
 
 
 
 
 
 
 
 
 
 
 
bf6e93c
4d055c7
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
---
license: apache-2.0
---

# Depth Anything Core ML Models

See [the Files tab](https://huggingface.co/coreml-projects/depth-anything/tree/main) for converted models.

Depth Anything model was introduced in the paper [Depth Anything: Unleashing the Power of Large-Scale Unlabeled Data](https://arxiv.org/abs/2401.10891) by Lihe Yang et al. and first released in [this repository](https://github.com/LiheYoung/Depth-Anything).

[Online demo](https://huggingface.co/spaces/LiheYoung/Depth-Anything) is also provided.

Disclaimer: The team releasing Depth Anything did not write a model card for this model so this model card has been written by the Hugging Face team.

## Model description

Depth Anything leverages the [DPT](https://huggingface.co/docs/transformers/model_doc/dpt) architecture with a [DINOv2](https://huggingface.co/docs/transformers/model_doc/dinov2) backbone.

The model is trained on ~62 million images, obtaining state-of-the-art results for both relative and absolute depth estimation.

<img src="https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/transformers/model_doc/depth_anything_overview.jpg"
alt="drawing" width="600"/>

<small> Depth Anything overview. Taken from the <a href="https://arxiv.org/abs/2401.10891">original paper</a>.</small>

## Evaluation - Variants

| Variant                                                 | Parameters | Size (MB) | Weight precision | Act. precision | abs-rel error | abs-rel reference |
| ------------------------------------------------------- | ---------: | --------: | ---------------- | -------------- | ------------: | ----------------: |
| base-original (PyTorch)                                 |      97.5M |       390 | Float32          | Float32        |               |                   |
| small-original (PyTorch)                                |      24.8M |      99.2 | Float32          | Float32        |        0.1589 |     base-original |
| [base-float32](depth-anything-base-float32.mlpackage)   |      97.5M |     194.6 | Float32          | Float32        |        0.0056 |     base-original |
| [base-float16](depth-anything-base-float16.mlpackage)   |      97.5M |     194.6 | Float16          | Float16        |        0.0061 |     base-original |
| [small-float32](depth-anything-small-float32.mlpackage) |      24.8M |      99.0 | Float32          | Float32        |        0.0073 |    small-original |
| [small-float16](depth-anything-small-float16.mlpackage) |      24.8M |      45.8 | Float16          | Float16        |        0.0077 |    small-original |

## Evaluation - Inference time

The following results use the small-float16 variant.

| Device               | OS   | Inference time (ms) | Dominant compute unit |
| -------------------- | ---- | ------------------: | --------------------- |
| iPhone 14            | 17.5 |              160.59 | Neural Engine         |
| iPhone 14 Pro Max    | 17.5 |              119.33 | Neural Engine         |
| iPhone 15            | 17.0 |               99.42 | Neural Engine         |
| iPhone 15 Pro Max    | 17.4 |               116.1 | Neural Engine         |
| MacBook Pro (M1 Max) | 14.5 |               32.20 | GPU                   |


## Download

Install `huggingface-hub`

```bash
pip install huggingface-hub
```

To download one of the `.mlpackage` folders to the `models` directory:

```bash
huggingface-cli download \
  --local-dir models --local-dir-use-symlinks False \
  coreml-projects/depth-anything \
  --include "DepthAnythingSmallF16.mlpackage/*"
```

To download everything, skip the `--include` argument.