Manojb commited on
Commit
43e3ecf
·
verified ·
1 Parent(s): ec92ec2

Cloned from Intel/dpt-large

Browse files
Files changed (6) hide show
  1. .gitattributes +4 -11
  2. README.md +176 -0
  3. config.json +47 -0
  4. model.safetensors +3 -0
  5. preprocessor_config.json +19 -0
  6. pytorch_model.bin +3 -0
.gitattributes CHANGED
@@ -1,35 +1,28 @@
1
  *.7z filter=lfs diff=lfs merge=lfs -text
2
  *.arrow filter=lfs diff=lfs merge=lfs -text
3
  *.bin filter=lfs diff=lfs merge=lfs -text
 
4
  *.bz2 filter=lfs diff=lfs merge=lfs -text
5
- *.ckpt filter=lfs diff=lfs merge=lfs -text
6
  *.ftz filter=lfs diff=lfs merge=lfs -text
7
  *.gz filter=lfs diff=lfs merge=lfs -text
8
  *.h5 filter=lfs diff=lfs merge=lfs -text
9
  *.joblib filter=lfs diff=lfs merge=lfs -text
10
  *.lfs.* filter=lfs diff=lfs merge=lfs -text
11
- *.mlmodel filter=lfs diff=lfs merge=lfs -text
12
  *.model filter=lfs diff=lfs merge=lfs -text
13
  *.msgpack filter=lfs diff=lfs merge=lfs -text
14
- *.npy filter=lfs diff=lfs merge=lfs -text
15
- *.npz filter=lfs diff=lfs merge=lfs -text
16
  *.onnx filter=lfs diff=lfs merge=lfs -text
17
  *.ot filter=lfs diff=lfs merge=lfs -text
18
  *.parquet filter=lfs diff=lfs merge=lfs -text
19
  *.pb filter=lfs diff=lfs merge=lfs -text
20
- *.pickle filter=lfs diff=lfs merge=lfs -text
21
- *.pkl filter=lfs diff=lfs merge=lfs -text
22
  *.pt filter=lfs diff=lfs merge=lfs -text
23
  *.pth filter=lfs diff=lfs merge=lfs -text
24
  *.rar filter=lfs diff=lfs merge=lfs -text
25
- *.safetensors filter=lfs diff=lfs merge=lfs -text
26
- saved_model/**/* filter=lfs diff=lfs merge=lfs -text
27
  *.tar.* filter=lfs diff=lfs merge=lfs -text
28
- *.tar filter=lfs diff=lfs merge=lfs -text
29
  *.tflite filter=lfs diff=lfs merge=lfs -text
30
  *.tgz filter=lfs diff=lfs merge=lfs -text
31
- *.wasm filter=lfs diff=lfs merge=lfs -text
32
  *.xz filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
- *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
1
  *.7z filter=lfs diff=lfs merge=lfs -text
2
  *.arrow filter=lfs diff=lfs merge=lfs -text
3
  *.bin filter=lfs diff=lfs merge=lfs -text
4
+ *.bin.* filter=lfs diff=lfs merge=lfs -text
5
  *.bz2 filter=lfs diff=lfs merge=lfs -text
 
6
  *.ftz filter=lfs diff=lfs merge=lfs -text
7
  *.gz filter=lfs diff=lfs merge=lfs -text
8
  *.h5 filter=lfs diff=lfs merge=lfs -text
9
  *.joblib filter=lfs diff=lfs merge=lfs -text
10
  *.lfs.* filter=lfs diff=lfs merge=lfs -text
 
11
  *.model filter=lfs diff=lfs merge=lfs -text
12
  *.msgpack filter=lfs diff=lfs merge=lfs -text
 
 
13
  *.onnx filter=lfs diff=lfs merge=lfs -text
14
  *.ot filter=lfs diff=lfs merge=lfs -text
15
  *.parquet filter=lfs diff=lfs merge=lfs -text
16
  *.pb filter=lfs diff=lfs merge=lfs -text
 
 
17
  *.pt filter=lfs diff=lfs merge=lfs -text
18
  *.pth filter=lfs diff=lfs merge=lfs -text
19
  *.rar filter=lfs diff=lfs merge=lfs -text
20
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
 
21
  *.tar.* filter=lfs diff=lfs merge=lfs -text
 
22
  *.tflite filter=lfs diff=lfs merge=lfs -text
23
  *.tgz filter=lfs diff=lfs merge=lfs -text
 
24
  *.xz filter=lfs diff=lfs merge=lfs -text
25
  *.zip filter=lfs diff=lfs merge=lfs -text
26
+ *.zstandard filter=lfs diff=lfs merge=lfs -text
27
  *tfevents* filter=lfs diff=lfs merge=lfs -text
28
+ model.safetensors filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,176 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: apache-2.0
3
+ tags:
4
+ - vision
5
+ - depth-estimation
6
+ widget:
7
+ - src: https://huggingface.co/datasets/mishig/sample_images/resolve/main/tiger.jpg
8
+ example_title: Tiger
9
+ - src: https://huggingface.co/datasets/mishig/sample_images/resolve/main/teapot.jpg
10
+ example_title: Teapot
11
+ - src: https://huggingface.co/datasets/mishig/sample_images/resolve/main/palace.jpg
12
+ example_title: Palace
13
+
14
+ model-index:
15
+ - name: dpt-large
16
+ results:
17
+ - task:
18
+ type: monocular-depth-estimation
19
+ name: Monocular Depth Estimation
20
+ dataset:
21
+ type: MIX-6
22
+ name: MIX-6
23
+ metrics:
24
+ - type: Zero-shot transfer
25
+ value: 10.82
26
+ name: Zero-shot transfer
27
+ config: Zero-shot transfer
28
+ verified: false
29
+ ---
30
+
31
+ ## Model Details: DPT-Large (also known as MiDaS 3.0)
32
+
33
+ Dense Prediction Transformer (DPT) model trained on 1.4 million images for monocular depth estimation.
34
+ It was introduced in the paper [Vision Transformers for Dense Prediction](https://arxiv.org/abs/2103.13413) by Ranftl et al. (2021) and first released in [this repository](https://github.com/isl-org/DPT).
35
+ DPT uses the Vision Transformer (ViT) as backbone and adds a neck + head on top for monocular depth estimation.
36
+ ![model image](https://huggingface.co/datasets/huggingface/documentation-images/resolve/main/dpt_architecture.jpg)
37
+
38
+ The model card has been written in combination by the Hugging Face team and Intel.
39
+
40
+ | Model Detail | Description |
41
+ | ----------- | ----------- |
42
+ | Model Authors - Company | Intel |
43
+ | Date | March 22, 2022 |
44
+ | Version | 1 |
45
+ | Type | Computer Vision - Monocular Depth Estimation |
46
+ | Paper or Other Resources | [Vision Transformers for Dense Prediction](https://arxiv.org/abs/2103.13413) and [GitHub Repo](https://github.com/isl-org/DPT) |
47
+ | License | Apache 2.0 |
48
+ | Questions or Comments | [Community Tab](https://huggingface.co/Intel/dpt-large/discussions) and [Intel Developers Discord](https://discord.gg/rv2Gp55UJQ)|
49
+
50
+ | Intended Use | Description |
51
+ | ----------- | ----------- |
52
+ | Primary intended uses | You can use the raw model for zero-shot monocular depth estimation. See the [model hub](https://huggingface.co/models?search=dpt) to look for fine-tuned versions on a task that interests you. |
53
+ | Primary intended users | Anyone doing monocular depth estimation |
54
+ | Out-of-scope uses | This model in most cases will need to be fine-tuned for your particular task. The model should not be used to intentionally create hostile or alienating environments for people.|
55
+
56
+
57
+ ### How to use
58
+
59
+ The easiest is leveraging the pipeline API:
60
+
61
+ ```
62
+ from transformers import pipeline
63
+
64
+ pipe = pipeline(task="depth-estimation", model="Intel/dpt-large")
65
+ result = pipe(image)
66
+ result["depth"]
67
+ ```
68
+
69
+ In case you want to implement the entire logic yourself, here's how to do that for zero-shot depth estimation on an image:
70
+
71
+ ```python
72
+ from transformers import DPTImageProcessor, DPTForDepthEstimation
73
+ import torch
74
+ import numpy as np
75
+ from PIL import Image
76
+ import requests
77
+
78
+ url = "http://images.cocodataset.org/val2017/000000039769.jpg"
79
+ image = Image.open(requests.get(url, stream=True).raw)
80
+
81
+ processor = DPTImageProcessor.from_pretrained("Intel/dpt-large")
82
+ model = DPTForDepthEstimation.from_pretrained("Intel/dpt-large")
83
+
84
+ # prepare image for the model
85
+ inputs = processor(images=image, return_tensors="pt")
86
+
87
+ with torch.no_grad():
88
+ outputs = model(**inputs)
89
+ predicted_depth = outputs.predicted_depth
90
+
91
+ # interpolate to original size
92
+ prediction = torch.nn.functional.interpolate(
93
+ predicted_depth.unsqueeze(1),
94
+ size=image.size[::-1],
95
+ mode="bicubic",
96
+ align_corners=False,
97
+ )
98
+
99
+ # visualize the prediction
100
+ output = prediction.squeeze().cpu().numpy()
101
+ formatted = (output * 255 / np.max(output)).astype("uint8")
102
+ depth = Image.fromarray(formatted)
103
+ ```
104
+
105
+ For more code examples, we refer to the [documentation](https://huggingface.co/docs/transformers/master/en/model_doc/dpt).
106
+
107
+
108
+ | Factors | Description |
109
+ | ----------- | ----------- |
110
+ | Groups | Multiple datasets compiled together |
111
+ | Instrumentation | - |
112
+ | Environment | Inference completed on Intel Xeon Platinum 8280 CPU @ 2.70GHz with 8 physical cores and an NVIDIA RTX 2080 GPU. |
113
+ | Card Prompts | Model deployment on alternate hardware and software will change model performance |
114
+
115
+ | Metrics | Description |
116
+ | ----------- | ----------- |
117
+ | Model performance measures | Zero-shot Transfer |
118
+ | Decision thresholds | - |
119
+ | Approaches to uncertainty and variability | - |
120
+
121
+ | Training and Evaluation Data | Description |
122
+ | ----------- | ----------- |
123
+ | Datasets | The dataset is called MIX 6, and contains around 1.4M images. The model was initialized with ImageNet-pretrained weights.|
124
+ | Motivation | To build a robust monocular depth prediction network |
125
+ | Preprocessing | "We resize the image such that the longer side is 384 pixels and train on random square crops of size 384. ... We perform random horizontal flips for data augmentation." See [Ranftl et al. (2021)](https://arxiv.org/abs/2103.13413) for more details. |
126
+
127
+ ## Quantitative Analyses
128
+ | Model | Training set | DIW WHDR | ETH3D AbsRel | Sintel AbsRel | KITTI δ>1.25 | NYU δ>1.25 | TUM δ>1.25 |
129
+ | --- | --- | --- | --- | --- | --- | --- | --- |
130
+ | DPT - Large | MIX 6 | 10.82 (-13.2%) | 0.089 (-31.2%) | 0.270 (-17.5%) | 8.46 (-64.6%) | 8.32 (-12.9%) | 9.97 (-30.3%) |
131
+ | DPT - Hybrid | MIX 6 | 11.06 (-11.2%) | 0.093 (-27.6%) | 0.274 (-16.2%) | 11.56 (-51.6%) | 8.69 (-9.0%) | 10.89 (-23.2%) |
132
+ | MiDaS | MIX 6 | 12.95 (+3.9%) | 0.116 (-10.5%) | 0.329 (+0.5%) | 16.08 (-32.7%) | 8.71 (-8.8%) | 12.51 (-12.5%)
133
+ | MiDaS [30] | MIX 5 | 12.46 | 0.129 | 0.327 | 23.90 | 9.55 | 14.29 |
134
+ | Li [22] | MD [22] | 23.15 | 0.181 | 0.385 | 36.29 | 27.52 | 29.54 |
135
+ | Li [21] | MC [21] | 26.52 | 0.183 | 0.405 | 47.94 | 18.57 | 17.71 |
136
+ | Wang [40] | WS [40] | 19.09 | 0.205 | 0.390 | 31.92 | 29.57 | 20.18 |
137
+ | Xian [45] | RW [45] | 14.59 | 0.186 | 0.422 | 34.08 | 27.00 | 25.02 |
138
+ | Casser [5] | CS [8] | 32.80 | 0.235 | 0.422 | 21.15 | 39.58 | 37.18 |
139
+
140
+ Table 1. Comparison to the state of the art on monocular depth estimation. We evaluate zero-shot cross-dataset transfer according to the
141
+ protocol defined in [30]. Relative performance is computed with respect to the original MiDaS model [30]. Lower is better for all metrics. ([Ranftl et al., 2021](https://arxiv.org/abs/2103.13413))
142
+
143
+
144
+ | Ethical Considerations | Description |
145
+ | ----------- | ----------- |
146
+ | Data | The training data come from multiple image datasets compiled together. |
147
+ | Human life | The model is not intended to inform decisions central to human life or flourishing. It is an aggregated set of monocular depth image datasets. |
148
+ | Mitigations | No additional risk mitigation strategies were considered during model development. |
149
+ | Risks and harms | The extent of the risks involved by using the model remain unknown. |
150
+ | Use cases | - |
151
+
152
+ | Caveats and Recommendations |
153
+ | ----------- |
154
+ | Users (both direct and downstream) should be made aware of the risks, biases and limitations of the model. There are no additional caveats or recommendations for this model. |
155
+
156
+
157
+
158
+ ### BibTeX entry and citation info
159
+
160
+ ```bibtex
161
+ @article{DBLP:journals/corr/abs-2103-13413,
162
+ author = {Ren{\'{e}} Ranftl and
163
+ Alexey Bochkovskiy and
164
+ Vladlen Koltun},
165
+ title = {Vision Transformers for Dense Prediction},
166
+ journal = {CoRR},
167
+ volume = {abs/2103.13413},
168
+ year = {2021},
169
+ url = {https://arxiv.org/abs/2103.13413},
170
+ eprinttype = {arXiv},
171
+ eprint = {2103.13413},
172
+ timestamp = {Wed, 07 Apr 2021 15:31:46 +0200},
173
+ biburl = {https://dblp.org/rec/journals/corr/abs-2103-13413.bib},
174
+ bibsource = {dblp computer science bibliography, https://dblp.org}
175
+ }
176
+ ```
config.json ADDED
@@ -0,0 +1,47 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "architectures": [
3
+ "DPTForDepthEstimation"
4
+ ],
5
+ "attention_probs_dropout_prob": 0.0,
6
+ "auxiliary_loss_weight": 0.4,
7
+ "backbone_out_indices": [
8
+ 5,
9
+ 11,
10
+ 17,
11
+ 23
12
+ ],
13
+ "fusion_hidden_size": 256,
14
+ "head_in_index": -1,
15
+ "hidden_act": "gelu",
16
+ "hidden_dropout_prob": 0.0,
17
+ "hidden_size": 1024,
18
+ "image_size": 384,
19
+ "initializer_range": 0.02,
20
+ "intermediate_size": 4096,
21
+ "layer_norm_eps": 1e-12,
22
+ "model_type": "dpt",
23
+ "neck_hidden_sizes": [
24
+ 256,
25
+ 512,
26
+ 1024,
27
+ 1024
28
+ ],
29
+ "num_attention_heads": 16,
30
+ "num_channels": 3,
31
+ "num_hidden_layers": 24,
32
+ "patch_size": 16,
33
+ "qkv_bias": true,
34
+ "readout_type": "project",
35
+ "reassemble_factors": [
36
+ 4,
37
+ 2,
38
+ 1,
39
+ 0.5
40
+ ],
41
+ "semantic_classifier_dropout": 0.1,
42
+ "semantic_loss_ignore_index": 255,
43
+ "torch_dtype": "float32",
44
+ "transformers_version": "4.18.0.dev0",
45
+ "use_auxiliary_head": true,
46
+ "use_batch_norm_in_fusion_residual": false
47
+ }
model.safetensors ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c173e7fd575c4d6c2164621063fed3a0e7e2eb6adbfb7c1845b364bc0fed9ce8
3
+ size 1367456044
preprocessor_config.json ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "do_normalize": true,
3
+ "do_resize": true,
4
+ "ensure_multiple_of": 1,
5
+ "feature_extractor_type": "DPTFeatureExtractor",
6
+ "image_mean": [
7
+ 0.5,
8
+ 0.5,
9
+ 0.5
10
+ ],
11
+ "image_std": [
12
+ 0.5,
13
+ 0.5,
14
+ 0.5
15
+ ],
16
+ "keep_aspect_ratio": false,
17
+ "resample": 2,
18
+ "size": 384
19
+ }
pytorch_model.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:71150941604c39c1c770a72a7b2f56487669f0e3a4d99c8759e233fb1be24080
3
+ size 1367581165