IMvision12 commited on
Commit
e4c325e
·
verified ·
1 Parent(s): f9c69d8

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: LiheYoung/depth-anything-small-hf
5
- library_name: kerasformers
6
  tags:
7
  - keras
8
- - kerasformers
9
  - depth-anything
10
  - depth-estimation
11
  - arxiv:2401.10891
@@ -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 V1.***
18
 
19
  # Run Depth Anything V1 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--V1-blue)](https://imvision12.github.io/KerasFormers/depth_anything_v1/) [![Collection](https://img.shields.io/badge/HF-Depth--Anything--V1%20collection-yellow)](https://huggingface.co/collections/kerasformers/depth-anything-v1-and-v2-6a6a965e3e9e4847e424dde2)
22
 
23
- # kerasformers/depth_anything_small
24
 
25
  Paper: [Depth Anything: Unleashing the Power of Large-Scale Unlabeled Data (arXiv:2401.10891)](https://arxiv.org/abs/2401.10891) · [HF Papers](https://huggingface.co/papers/2401.10891)
26
 
@@ -28,7 +28,7 @@ Depth Anything estimates depth from a single image. A DINOv2 ViT backbone feeds
28
 
29
  For more details on the model, please go to the upstream [model card](https://huggingface.co/LiheYoung/depth-anything-small-hf).
30
 
31
- Pure-**Keras 3** conversion of [`LiheYoung/depth-anything-small-hf`](https://huggingface.co/LiheYoung/depth-anything-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 (`DepthAnythingV1DepthEstimation`) with relative inverse depth.
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_v1 import DepthAnythingV1DepthEstimation, DepthAnythingV1ImageProcessor
43
 
44
- model = DepthAnythingV1DepthEstimation.from_weights("kerasformers/depth_anything_small")
45
- processor = DepthAnythingV1ImageProcessor.from_weights("kerasformers/depth_anything_small")
46
 
47
  image = Image.open("your_image.jpg").convert("RGB")
48
  output = model(processor(image)["pixel_values"], training=False)
@@ -52,19 +52,19 @@ depth = processor.post_process_depth_estimation(
52
  print(depth.shape)
53
  ```
54
 
55
- Load any Depth Anything V1 variant the same way with `from_weights("kerasformers/<variant>")`:
56
 
57
  | Variant | Hub | Backbone |
58
  |---|---|---|
59
- | `depth_anything_small` | [`kerasformers/depth_anything_small`](https://huggingface.co/kerasformers/depth_anything_small) | ViT-S/14 |
60
- | `depth_anything_base` | [`kerasformers/depth_anything_base`](https://huggingface.co/kerasformers/depth_anything_base) | ViT-B/14 |
61
- | `depth_anything_large` | [`kerasformers/depth_anything_large`](https://huggingface.co/kerasformers/depth_anything_large) | ViT-L/14 |
62
 
63
  ## Tips
64
 
65
- - Set `KERAS_BACKEND` **before** importing Keras / kerasformers.
66
  - For metric (metre) depth, use Depth Anything V2 metric heads.
67
- - See [Depth Anything V1 docs]({DOCS_URL}) and [Loading Weights](https://imvision12.github.io/KerasFormers/loading_weights/).
68
  - Community / upstream weights: `DepthAnythingV1DepthEstimation.from_weights("hf:LiheYoung/depth-anything-small-hf")`.
69
 
70
  ## Special Thanks
 
2
  pipeline_tag: depth-estimation
3
  license: apache-2.0
4
  base_model: LiheYoung/depth-anything-small-hf
5
+ library_name: zeromodels
6
  tags:
7
  - keras
8
+ - zeromodels
9
  - depth-anything
10
  - depth-estimation
11
  - arxiv:2401.10891
 
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 V1.***
18
 
19
  # Run Depth Anything V1 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--V1-blue)](https://imvision12.github.io/ZeroModels/depth_anything_v1/) [![Collection](https://img.shields.io/badge/HF-Depth--Anything--V1%20collection-yellow)](https://huggingface.co/collections/zeromodels/depth-anything-v1-and-v2-6a6a965e3e9e4847e424dde2)
22
 
23
+ # zeromodels/depth_anything_small
24
 
25
  Paper: [Depth Anything: Unleashing the Power of Large-Scale Unlabeled Data (arXiv:2401.10891)](https://arxiv.org/abs/2401.10891) · [HF Papers](https://huggingface.co/papers/2401.10891)
26
 
 
28
 
29
  For more details on the model, please go to the upstream [model card](https://huggingface.co/LiheYoung/depth-anything-small-hf).
30
 
31
+ Pure-**Keras 3** conversion of [`LiheYoung/depth-anything-small-hf`](https://huggingface.co/LiheYoung/depth-anything-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 (`DepthAnythingV1DepthEstimation`) with relative inverse depth.
34
 
 
39
  os.environ["KERAS_BACKEND"] = "torch" # or "jax" / "tensorflow"
40
 
41
  from PIL import Image
42
+ from zeromodels.models.depth_anything_v1 import DepthAnythingV1DepthEstimation, DepthAnythingV1ImageProcessor
43
 
44
+ model = DepthAnythingV1DepthEstimation.from_weights("zeromodels/depth_anything_small")
45
+ processor = DepthAnythingV1ImageProcessor.from_weights("zeromodels/depth_anything_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 V1 variant the same way with `from_weights("zeromodels/<variant>")`:
56
 
57
  | Variant | Hub | Backbone |
58
  |---|---|---|
59
+ | `depth_anything_small` | [`zeromodels/depth_anything_small`](https://huggingface.co/zeromodels/depth_anything_small) | ViT-S/14 |
60
+ | `depth_anything_base` | [`zeromodels/depth_anything_base`](https://huggingface.co/zeromodels/depth_anything_base) | ViT-B/14 |
61
+ | `depth_anything_large` | [`zeromodels/depth_anything_large`](https://huggingface.co/zeromodels/depth_anything_large) | ViT-L/14 |
62
 
63
  ## Tips
64
 
65
+ - Set `KERAS_BACKEND` **before** importing Keras / zeromodels.
66
  - For metric (metre) depth, use Depth Anything V2 metric heads.
67
+ - See [Depth Anything V1 docs]({DOCS_URL}) and [Loading Weights](https://imvision12.github.io/ZeroModels/loading_weights/).
68
  - Community / upstream weights: `DepthAnythingV1DepthEstimation.from_weights("hf:LiheYoung/depth-anything-small-hf")`.
69
 
70
  ## 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_v1",
5
- "model_class": "DepthAnythingV1DepthEstimation",
6
- "variant": "depth_anything_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
- 9,
17
- 10,
18
- 11,
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_v1",
5
+ "model_class": "DepthAnythingV1DepthEstimation",
6
+ "variant": "depth_anything_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
+ 9,
17
+ 10,
18
+ 11,
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_v1",
5
- "preprocessor_class": "DepthAnythingV1ImageProcessor",
6
- "variant": "depth_anything_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_v1",
5
+ "preprocessor_class": "DepthAnythingV1ImageProcessor",
6
+ "variant": "depth_anything_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
  }