Depth Estimation
Core ML
File size: 1,877 Bytes
a82f75b
e3b374e
 
 
a82f75b
e3b374e
 
a82f75b
e3b374e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---

tags:
- depth-estimation
library_name: coreml
license: apple-ascl
base_model:
  - apple/DepthPro
---


This repo contains [DepthPro.mlpackage](DepthPro.mlpackage)(1900 MB).

# DepthPro CoreML Models

DepthPro is a monocular depth estimation model. This means that it is trained to predict depth on a single image.

[DepthPro paper](https://arxiv.org/pdf/2410.02073)

[DepthPro original repo](https://huggingface.co/apple/DepthPro)

# Model Inputs and Outputs

### Inputs

- `image`: $1536 \times 1536$ 3 color image ($[1 \times 3 \times 1536 \times 1536]$ ImageType).
- `originalWidth`: A scalar containing the original width of the image before resizing ($[1 \times 1 \times 1 \times 1]$ TensorType).

### Outputs

- `depthMeters`:  $1536 \times 1536$ 1 channel tensor containing depth in meters ($[1 \times 1 \times 1536 \times 1536]$ Tensor).

# Download

Install `huggingface-cli`

```bash

brew install huggingface-cli

```

To download:

```bash

huggingface-cli download \

  --local-dir models --local-dir-use-symlinks False \

  coreml-projects/DepthPro-coreml \

  --include "DepthPro.mlpackage/*""

```

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

# Conversion Tutorial 

The [`huggingface/coreml-examples`](https://github.com/huggingface/coreml-examples/blob/main/tutorials/DepthPro/depth_pro_coreml_guide.ipynb) repository contains sample conversion code for `DepthPro.mlpackage` and other models.

# Swift Integration

The [`huggingface/coreml-examples`](https://github.com/huggingface/coreml-examples/blob/main/DepthProSample/README.md) repository contains sample Swift code for `DepthPro.mlpackage` and other models. See [the instructions there](https://github.com/huggingface/coreml-examples/tree/main/DepthProSample) to build the demo app, which shows how to use the model in your own Swift apps.