IMvision12 commited on
Commit
62b7993
·
verified ·
1 Parent(s): 822702f

Migrate to zeromodels (rename kf_*.json -> zm_*.json, fix refs in config + README, ensure tag + badge)

Browse files
README.md CHANGED
@@ -2,10 +2,10 @@
2
  pipeline_tag: depth-estimation
3
  license: apache-2.0
4
  base_model: depth-anything/Depth-Anything-V2-Small-hf
5
- library_name: kerasformers
6
  tags:
7
  - keras
8
- - kerasformers
9
  - depth-anything-v2
10
  - depth-estimation
11
  - arxiv:2406.09414
@@ -14,13 +14,13 @@ tags:
14
  - tf
15
  ---
16
 
17
- ## ***See [our collection](https://huggingface.co/collections/kerasformers/depth-anything-v1-and-v2-6a6a965e3e9e4847e424dde2) for all versions of Depth Anything V2.***
18
 
19
  # Run Depth Anything V2 with Keras 3: JAX, PyTorch, or TensorFlow
20
 
21
- [![GitHub](https://img.shields.io/badge/GitHub-KerasFormers-black?logo=github)](https://github.com/IMvision12/KerasFormers) [![Docs](https://img.shields.io/badge/Docs-Depth--Anything--V2-blue)](https://imvision12.github.io/KerasFormers/depth_anything_v2/) [![Collection](https://img.shields.io/badge/HF-Depth--Anything--V2%20collection-yellow)](https://huggingface.co/collections/kerasformers/depth-anything-v1-and-v2-6a6a965e3e9e4847e424dde2)
22
 
23
- # kerasformers/depth_anything_v2_small
24
 
25
  Paper: [Depth Anything V2 (arXiv:2406.09414)](https://arxiv.org/abs/2406.09414) · [HF Papers](https://huggingface.co/papers/2406.09414)
26
 
@@ -28,7 +28,7 @@ Depth Anything V2 keeps V1's architecture and improves data (synthetic labels pl
28
 
29
  For more details on the model, please go to the upstream [model card](https://huggingface.co/depth-anything/Depth-Anything-V2-Small-hf).
30
 
31
- Pure-**Keras 3** conversion of [`depth-anything/Depth-Anything-V2-Small-hf`](https://huggingface.co/depth-anything/Depth-Anything-V2-Small-hf) for [kerasformers](https://github.com/IMvision12/KerasFormers). One implementation runs unmodified on **TensorFlow / Torch / JAX**.
32
 
33
  This is a **monocular depth** checkpoint (`DepthAnythingV2DepthEstimation`, relative).
34
 
@@ -39,10 +39,10 @@ import os
39
  os.environ["KERAS_BACKEND"] = "torch" # or "jax" / "tensorflow"
40
 
41
  from PIL import Image
42
- from kerasformers.models.depth_anything_v2 import DepthAnythingV2DepthEstimation, DepthAnythingV2ImageProcessor
43
 
44
- model = DepthAnythingV2DepthEstimation.from_weights("kerasformers/depth_anything_v2_small")
45
- processor = DepthAnythingV2ImageProcessor.from_weights("kerasformers/depth_anything_v2_small")
46
 
47
  image = Image.open("your_image.jpg").convert("RGB")
48
  output = model(processor(image)["pixel_values"], training=False)
@@ -52,25 +52,25 @@ depth = processor.post_process_depth_estimation(
52
  print(depth.shape)
53
  ```
54
 
55
- Load any Depth Anything V2 variant the same way with `from_weights("kerasformers/<variant>")`:
56
 
57
  | Variant | Hub | Output |
58
  |---|---|---|
59
- | `depth_anything_v2_small` | [`kerasformers/depth_anything_v2_small`](https://huggingface.co/kerasformers/depth_anything_v2_small) | relative |
60
- | `depth_anything_v2_base` | [`kerasformers/depth_anything_v2_base`](https://huggingface.co/kerasformers/depth_anything_v2_base) | relative |
61
- | `depth_anything_v2_large` | [`kerasformers/depth_anything_v2_large`](https://huggingface.co/kerasformers/depth_anything_v2_large) | relative |
62
- | `depth_anything_v2_metric_indoor_small` | [`kerasformers/depth_anything_v2_metric_indoor_small`](https://huggingface.co/kerasformers/depth_anything_v2_metric_indoor_small) | metric indoor |
63
- | `depth_anything_v2_metric_indoor_base` | [`kerasformers/depth_anything_v2_metric_indoor_base`](https://huggingface.co/kerasformers/depth_anything_v2_metric_indoor_base) | metric indoor |
64
- | `depth_anything_v2_metric_indoor_large` | [`kerasformers/depth_anything_v2_metric_indoor_large`](https://huggingface.co/kerasformers/depth_anything_v2_metric_indoor_large) | metric indoor |
65
- | `depth_anything_v2_metric_outdoor_small` | [`kerasformers/depth_anything_v2_metric_outdoor_small`](https://huggingface.co/kerasformers/depth_anything_v2_metric_outdoor_small) | metric outdoor |
66
- | `depth_anything_v2_metric_outdoor_base` | [`kerasformers/depth_anything_v2_metric_outdoor_base`](https://huggingface.co/kerasformers/depth_anything_v2_metric_outdoor_base) | metric outdoor |
67
- | `depth_anything_v2_metric_outdoor_large` | [`kerasformers/depth_anything_v2_metric_outdoor_large`](https://huggingface.co/kerasformers/depth_anything_v2_metric_outdoor_large) | metric outdoor |
68
 
69
  ## Tips
70
 
71
- - Set `KERAS_BACKEND` **before** importing Keras / kerasformers.
72
  - Indoor and outdoor metric heads are not interchangeable.
73
- - See [Depth Anything V2 docs]({DOCS_URL}) and [Loading Weights](https://imvision12.github.io/KerasFormers/loading_weights/).
74
  - Community / upstream weights: `DepthAnythingV2DepthEstimation.from_weights("hf:depth-anything/Depth-Anything-V2-Small-hf")`.
75
 
76
  ## Special Thanks
 
2
  pipeline_tag: depth-estimation
3
  license: apache-2.0
4
  base_model: depth-anything/Depth-Anything-V2-Small-hf
5
+ library_name: zeromodels
6
  tags:
7
  - keras
8
+ - zeromodels
9
  - depth-anything-v2
10
  - depth-estimation
11
  - arxiv:2406.09414
 
14
  - tf
15
  ---
16
 
17
+ ## ***See [our collection](https://huggingface.co/collections/zeromodels/depth-anything-v1-and-v2-6a6a965e3e9e4847e424dde2) for all versions of Depth Anything V2.***
18
 
19
  # Run Depth Anything V2 with Keras 3: JAX, PyTorch, or TensorFlow
20
 
21
+ [![GitHub](https://img.shields.io/badge/GitHub-ZeroModels-black?logo=github)](https://github.com/IMvision12/ZeroModels) [![Docs](https://img.shields.io/badge/Docs-Depth--Anything--V2-blue)](https://imvision12.github.io/ZeroModels/depth_anything_v2/) [![Collection](https://img.shields.io/badge/HF-Depth--Anything--V2%20collection-yellow)](https://huggingface.co/collections/zeromodels/depth-anything-v1-and-v2-6a6a965e3e9e4847e424dde2)
22
 
23
+ # zeromodels/depth_anything_v2_small
24
 
25
  Paper: [Depth Anything V2 (arXiv:2406.09414)](https://arxiv.org/abs/2406.09414) · [HF Papers](https://huggingface.co/papers/2406.09414)
26
 
 
28
 
29
  For more details on the model, please go to the upstream [model card](https://huggingface.co/depth-anything/Depth-Anything-V2-Small-hf).
30
 
31
+ Pure-**Keras 3** conversion of [`depth-anything/Depth-Anything-V2-Small-hf`](https://huggingface.co/depth-anything/Depth-Anything-V2-Small-hf) for [zeromodels](https://github.com/IMvision12/ZeroModels). One implementation runs unmodified on **TensorFlow / Torch / JAX**.
32
 
33
  This is a **monocular depth** checkpoint (`DepthAnythingV2DepthEstimation`, relative).
34
 
 
39
  os.environ["KERAS_BACKEND"] = "torch" # or "jax" / "tensorflow"
40
 
41
  from PIL import Image
42
+ from zeromodels.models.depth_anything_v2 import DepthAnythingV2DepthEstimation, DepthAnythingV2ImageProcessor
43
 
44
+ model = DepthAnythingV2DepthEstimation.from_weights("zeromodels/depth_anything_v2_small")
45
+ processor = DepthAnythingV2ImageProcessor.from_weights("zeromodels/depth_anything_v2_small")
46
 
47
  image = Image.open("your_image.jpg").convert("RGB")
48
  output = model(processor(image)["pixel_values"], training=False)
 
52
  print(depth.shape)
53
  ```
54
 
55
+ Load any Depth Anything V2 variant the same way with `from_weights("zeromodels/<variant>")`:
56
 
57
  | Variant | Hub | Output |
58
  |---|---|---|
59
+ | `depth_anything_v2_small` | [`zeromodels/depth_anything_v2_small`](https://huggingface.co/zeromodels/depth_anything_v2_small) | relative |
60
+ | `depth_anything_v2_base` | [`zeromodels/depth_anything_v2_base`](https://huggingface.co/zeromodels/depth_anything_v2_base) | relative |
61
+ | `depth_anything_v2_large` | [`zeromodels/depth_anything_v2_large`](https://huggingface.co/zeromodels/depth_anything_v2_large) | relative |
62
+ | `depth_anything_v2_metric_indoor_small` | [`zeromodels/depth_anything_v2_metric_indoor_small`](https://huggingface.co/zeromodels/depth_anything_v2_metric_indoor_small) | metric indoor |
63
+ | `depth_anything_v2_metric_indoor_base` | [`zeromodels/depth_anything_v2_metric_indoor_base`](https://huggingface.co/zeromodels/depth_anything_v2_metric_indoor_base) | metric indoor |
64
+ | `depth_anything_v2_metric_indoor_large` | [`zeromodels/depth_anything_v2_metric_indoor_large`](https://huggingface.co/zeromodels/depth_anything_v2_metric_indoor_large) | metric indoor |
65
+ | `depth_anything_v2_metric_outdoor_small` | [`zeromodels/depth_anything_v2_metric_outdoor_small`](https://huggingface.co/zeromodels/depth_anything_v2_metric_outdoor_small) | metric outdoor |
66
+ | `depth_anything_v2_metric_outdoor_base` | [`zeromodels/depth_anything_v2_metric_outdoor_base`](https://huggingface.co/zeromodels/depth_anything_v2_metric_outdoor_base) | metric outdoor |
67
+ | `depth_anything_v2_metric_outdoor_large` | [`zeromodels/depth_anything_v2_metric_outdoor_large`](https://huggingface.co/zeromodels/depth_anything_v2_metric_outdoor_large) | metric outdoor |
68
 
69
  ## Tips
70
 
71
+ - Set `KERAS_BACKEND` **before** importing Keras / zeromodels.
72
  - Indoor and outdoor metric heads are not interchangeable.
73
+ - See [Depth Anything V2 docs]({DOCS_URL}) and [Loading Weights](https://imvision12.github.io/ZeroModels/loading_weights/).
74
  - Community / upstream weights: `DepthAnythingV2DepthEstimation.from_weights("hf:depth-anything/Depth-Anything-V2-Small-hf")`.
75
 
76
  ## Special Thanks
kf_config.json → zm_config.json RENAMED
@@ -1,38 +1,38 @@
1
- {
2
- "library_name": "kerasformers",
3
- "kerasformers_version": "1.2.1",
4
- "model_module": "kerasformers.models.depth_anything_v2",
5
- "model_class": "DepthAnythingV2DepthEstimation",
6
- "variant": "depth_anything_v2_small",
7
- "weights": "model.weights.h5",
8
- "schema_version": 2,
9
- "weight_dtype": "float32",
10
- "model_type": "depth_anything",
11
- "vision_config": {
12
- "backbone_dim": 384,
13
- "backbone_depth": 12,
14
- "backbone_num_heads": 6,
15
- "out_indices": [
16
- 3,
17
- 6,
18
- 9,
19
- 12
20
- ],
21
- "neck_hidden_sizes": [
22
- 48,
23
- 96,
24
- 192,
25
- 384
26
- ],
27
- "fusion_hidden_size": 64,
28
- "reassemble_factors": [
29
- 4,
30
- 2,
31
- 1,
32
- 0.5
33
- ],
34
- "depth_estimation_type": "relative",
35
- "max_depth": 1.0,
36
- "image_size": 518
37
- }
38
  }
 
1
+ {
2
+ "library_name": "zeromodels",
3
+ "zeromodels_version": "1.2.1",
4
+ "model_module": "zeromodels.models.depth_anything_v2",
5
+ "model_class": "DepthAnythingV2DepthEstimation",
6
+ "variant": "depth_anything_v2_small",
7
+ "weights": "model.weights.h5",
8
+ "schema_version": 2,
9
+ "weight_dtype": "float32",
10
+ "model_type": "depth_anything",
11
+ "vision_config": {
12
+ "backbone_dim": 384,
13
+ "backbone_depth": 12,
14
+ "backbone_num_heads": 6,
15
+ "out_indices": [
16
+ 3,
17
+ 6,
18
+ 9,
19
+ 12
20
+ ],
21
+ "neck_hidden_sizes": [
22
+ 48,
23
+ 96,
24
+ 192,
25
+ 384
26
+ ],
27
+ "fusion_hidden_size": 64,
28
+ "reassemble_factors": [
29
+ 4,
30
+ 2,
31
+ 1,
32
+ 0.5
33
+ ],
34
+ "depth_estimation_type": "relative",
35
+ "max_depth": 1.0,
36
+ "image_size": 518
37
+ }
38
  }
kf_preprocessor.json → zm_preprocessor.json RENAMED
@@ -1,19 +1,19 @@
1
- {
2
- "library_name": "kerasformers",
3
- "kerasformers_version": "1.1.3",
4
- "preprocessor_module": "kerasformers.models.depth_anything_v2",
5
- "preprocessor_class": "DepthAnythingV2ImageProcessor",
6
- "variant": "depth_anything_v2_small",
7
- "target_size": 518,
8
- "image_mean": [
9
- 0.485,
10
- 0.456,
11
- 0.406
12
- ],
13
- "image_std": [
14
- 0.229,
15
- 0.224,
16
- 0.225
17
- ],
18
- "data_format": null
19
  }
 
1
+ {
2
+ "library_name": "zeromodels",
3
+ "zeromodels_version": "1.1.3",
4
+ "preprocessor_module": "zeromodels.models.depth_anything_v2",
5
+ "preprocessor_class": "DepthAnythingV2ImageProcessor",
6
+ "variant": "depth_anything_v2_small",
7
+ "target_size": 518,
8
+ "image_mean": [
9
+ 0.485,
10
+ 0.456,
11
+ 0.406
12
+ ],
13
+ "image_std": [
14
+ 0.229,
15
+ 0.224,
16
+ 0.225
17
+ ],
18
+ "data_format": null
19
  }