Run this model with HF Jobs
Run zeromodels/depth_anything_small on Hugging Face's managed compute, monitor its progress, and retrieve the results when it's done.
Paste one of these prompts into your coding agent:
Fine-tune on my dataset
Use HF Jobs to fine-tune https://huggingface.co/zeromodels/depth_anything_small. Ask me which dataset to train on, then push the fine-tuned model to a new model repo. Run `hf jobs --help` first to learn the CLI.
Run batch inference
Use HF Jobs to run batch inference with https://huggingface.co/zeromodels/depth_anything_small on the inputs in a mounted HF Bucket. Ask me which Bucket to use, then write the outputs back to it and keep each input ID. Run `hf jobs --help` first to learn the CLI.
Instructions to use zeromodels/depth_anything_small with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- ZeroModels
How to use zeromodels/depth_anything_small with ZeroModels:
# pip install -U zeromodels # ZeroModels is pure Keras 3, so pick a backend: "jax", "torch" or "tensorflow". import os os.environ["KERAS_BACKEND"] = "jax" from zeromodels import AutoZModel # AutoZModel reads the repo's model_type and loads the matching class. # For a task head use the matching loader, e.g. AutoZMImageClassify / AutoZMDetect / # AutoZMSemanticSegment / AutoZMTextGenerate (see zeromodels.auto). model = AutoZModel.from_weights("zeromodels/depth_anything_small") - Keras
How to use zeromodels/depth_anything_small with Keras:
# !pip install -U keras tensorflow huggingface_hub # Keras needs TensorFlow installed to read "hf://" paths, so the tensorflow backend is selected here; # "jax" and "torch" also work for computation once TensorFlow is installed. import os os.environ["KERAS_BACKEND"] = "tensorflow" import keras model = keras.saving.load_model("hf://zeromodels/depth_anything_small") - Notebooks
- Google Colab
- Kaggle
Migrate to zeromodels (rename kf_*.json -> zm_*.json, fix refs in config + README, ensure tag + badge)
Browse filesFiles changed (3)
- README.md+15-15
- kf_config.json → zm_config.jsonRenamed+37-37
- kf_preprocessor.json → zm_preprocessor.jsonRenamed+18-18
1 unmodified line2345678910112 unmodified lines141516171819202122232425261 unmodified line282930313233344 unmodified lines394041424344454647483 unmodified lines525354555657585960616263646566676869701 unmodified linepipeline_tag: depth-estimationlicense: apache-2.0base_model: LiheYoung/depth-anything-small-hflibrary_name: kerasformerstags:- keras- kerasformers- depth-anything- depth-estimation- arxiv:2401.108912 unmodified lines- tf---## ***See [our collection](https://huggingface.co/collections/kerasformers/depth-anything-v1-and-v2-6a6a965e3e9e4847e424dde2) for all versions of Depth Anything V1.***# Run Depth Anything V1 with Keras 3: JAX, PyTorch, or TensorFlow[](https://github.com/IMvision12/KerasFormers) [](https://imvision12.github.io/KerasFormers/depth_anything_v1/) [](https://huggingface.co/collections/kerasformers/depth-anything-v1-and-v2-6a6a965e3e9e4847e424dde2)# kerasformers/depth_anything_smallPaper: [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)1 unmodified lineFor more details on the model, please go to the upstream [model card](https://huggingface.co/LiheYoung/depth-anything-small-hf).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**.This is a **monocular depth** checkpoint (`DepthAnythingV1DepthEstimation`) with relative inverse depth.4 unmodified linesos.environ["KERAS_BACKEND"] = "torch" # or "jax" / "tensorflow"from PIL import Imagefrom kerasformers.models.depth_anything_v1 import DepthAnythingV1DepthEstimation, DepthAnythingV1ImageProcessormodel = DepthAnythingV1DepthEstimation.from_weights("kerasformers/depth_anything_small")processor = DepthAnythingV1ImageProcessor.from_weights("kerasformers/depth_anything_small")image = Image.open("your_image.jpg").convert("RGB")output = model(processor(image)["pixel_values"], training=False)3 unmodified linesprint(depth.shape)```Load any Depth Anything V1 variant the same way with `from_weights("kerasformers/<variant>")`:| Variant | Hub | Backbone ||---|---|---|| `depth_anything_small` | [`kerasformers/depth_anything_small`](https://huggingface.co/kerasformers/depth_anything_small) | ViT-S/14 || `depth_anything_base` | [`kerasformers/depth_anything_base`](https://huggingface.co/kerasformers/depth_anything_base) | ViT-B/14 || `depth_anything_large` | [`kerasformers/depth_anything_large`](https://huggingface.co/kerasformers/depth_anything_large) | ViT-L/14 |## Tips- Set `KERAS_BACKEND` **before** importing Keras / kerasformers.- For metric (metre) depth, use Depth Anything V2 metric heads.- See [Depth Anything V1 docs]({DOCS_URL}) and [Loading Weights](https://imvision12.github.io/KerasFormers/loading_weights/).- Community / upstream weights: `DepthAnythingV1DepthEstimation.from_weights("hf:LiheYoung/depth-anything-small-hf")`.## Special Thanks1 unmodified line2345678910112 unmodified lines141516171819202122232425261 unmodified line282930313233344 unmodified lines394041424344454647483 unmodified lines525354555657585960616263646566676869701 unmodified linepipeline_tag: depth-estimationlicense: apache-2.0base_model: LiheYoung/depth-anything-small-hflibrary_name: zeromodelstags:- keras- zeromodels- depth-anything- depth-estimation- arxiv:2401.108912 unmodified lines- tf---## ***See [our collection](https://huggingface.co/collections/zeromodels/depth-anything-v1-and-v2-6a6a965e3e9e4847e424dde2) for all versions of Depth Anything V1.***# Run Depth Anything V1 with Keras 3: JAX, PyTorch, or TensorFlow[](https://github.com/IMvision12/ZeroModels) [](https://imvision12.github.io/ZeroModels/depth_anything_v1/) [](https://huggingface.co/collections/zeromodels/depth-anything-v1-and-v2-6a6a965e3e9e4847e424dde2)# zeromodels/depth_anything_smallPaper: [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)1 unmodified lineFor more details on the model, please go to the upstream [model card](https://huggingface.co/LiheYoung/depth-anything-small-hf).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**.This is a **monocular depth** checkpoint (`DepthAnythingV1DepthEstimation`) with relative inverse depth.4 unmodified linesos.environ["KERAS_BACKEND"] = "torch" # or "jax" / "tensorflow"from PIL import Imagefrom zeromodels.models.depth_anything_v1 import DepthAnythingV1DepthEstimation, DepthAnythingV1ImageProcessormodel = DepthAnythingV1DepthEstimation.from_weights("zeromodels/depth_anything_small")processor = DepthAnythingV1ImageProcessor.from_weights("zeromodels/depth_anything_small")image = Image.open("your_image.jpg").convert("RGB")output = model(processor(image)["pixel_values"], training=False)3 unmodified linesprint(depth.shape)```Load any Depth Anything V1 variant the same way with `from_weights("zeromodels/<variant>")`:| Variant | Hub | Backbone ||---|---|---|| `depth_anything_small` | [`zeromodels/depth_anything_small`](https://huggingface.co/zeromodels/depth_anything_small) | ViT-S/14 || `depth_anything_base` | [`zeromodels/depth_anything_base`](https://huggingface.co/zeromodels/depth_anything_base) | ViT-B/14 || `depth_anything_large` | [`zeromodels/depth_anything_large`](https://huggingface.co/zeromodels/depth_anything_large) | ViT-L/14 |## Tips- Set `KERAS_BACKEND` **before** importing Keras / zeromodels.- For metric (metre) depth, use Depth Anything V2 metric heads.- See [Depth Anything V1 docs]({DOCS_URL}) and [Loading Weights](https://imvision12.github.io/ZeroModels/loading_weights/).- Community / upstream weights: `DepthAnythingV1DepthEstimation.from_weights("hf:LiheYoung/depth-anything-small-hf")`.## Special Thanks
1234567891011121314151617181920212223242526272829303132333435363738{"library_name": "kerasformers","kerasformers_version": "1.2.1","model_module": "kerasformers.models.depth_anything_v1","model_class": "DepthAnythingV1DepthEstimation","variant": "depth_anything_small","weights": "model.weights.h5","schema_version": 2,"weight_dtype": "float32","model_type": "depth_anything","vision_config": {"backbone_dim": 384,"backbone_depth": 12,"backbone_num_heads": 6,"out_indices": [9,10,11,12],"neck_hidden_sizes": [48,96,192,384],"fusion_hidden_size": 64,"reassemble_factors": [4,2,1,0.5],"depth_estimation_type": "relative","max_depth": 1.0,"image_size": 518}}1234567891011121314151617181920212223242526272829303132333435363738{"library_name": "zeromodels","zeromodels_version": "1.2.1","model_module": "zeromodels.models.depth_anything_v1","model_class": "DepthAnythingV1DepthEstimation","variant": "depth_anything_small","weights": "model.weights.h5","schema_version": 2,"weight_dtype": "float32","model_type": "depth_anything","vision_config": {"backbone_dim": 384,"backbone_depth": 12,"backbone_num_heads": 6,"out_indices": [9,10,11,12],"neck_hidden_sizes": [48,96,192,384],"fusion_hidden_size": 64,"reassemble_factors": [4,2,1,0.5],"depth_estimation_type": "relative","max_depth": 1.0,"image_size": 518}}
12345678910111213141516171819{"library_name": "kerasformers","kerasformers_version": "1.1.3","preprocessor_module": "kerasformers.models.depth_anything_v1","preprocessor_class": "DepthAnythingV1ImageProcessor","variant": "depth_anything_small","target_size": 518,"image_mean": [0.485,0.456,0.406],"image_std": [0.229,0.224,0.225],"data_format": null}12345678910111213141516171819{"library_name": "zeromodels","zeromodels_version": "1.1.3","preprocessor_module": "zeromodels.models.depth_anything_v1","preprocessor_class": "DepthAnythingV1ImageProcessor","variant": "depth_anything_small","target_size": 518,"image_mean": [0.485,0.456,0.406],"image_std": [0.229,0.224,0.225],"data_format": null}
README.md+15-15
kf_config.json → zm_config.jsonRenamed+37-37
kf_preprocessor.json → zm_preprocessor.jsonRenamed+18-18