Run this model with HF Jobs
Run zeromodels/depth_anything_v2_large 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_v2_large. 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_v2_large 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_v2_large with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- ZeroModels
How to use zeromodels/depth_anything_v2_large 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_v2_large") - Keras
How to use zeromodels/depth_anything_v2_large 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_v2_large") - DepthAnythingV2
How to use zeromodels/depth_anything_v2_large with DepthAnythingV2:
# Install from https://github.com/DepthAnything/Depth-Anything-V2 # Load the model and infer depth from an image import cv2 import torch from huggingface_hub import hf_hub_download from depth_anything_v2.dpt import DepthAnythingV2 # instantiate the model model = DepthAnythingV2(encoder="<ENCODER>", features=<NUMBER_OF_FEATURES>, out_channels=<OUT_CHANNELS>) # load the weights filepath = hf_hub_download(repo_id="zeromodels/depth_anything_v2_large", filename="depth_anything_v2_<ENCODER>.pth", repo_type="model") state_dict = torch.load(filepath, map_location="cpu") model.load_state_dict(state_dict) model.eval() raw_img = cv2.imread("your/image/path") depth = model.infer_image(raw_img) # HxW raw depth map in numpy - 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+21-21
- 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 lines525354555657585960616263646566676869707172737475761 unmodified linepipeline_tag: depth-estimationlicense: cc-by-nc-4.0base_model: depth-anything/Depth-Anything-V2-Large-hflibrary_name: kerasformerstags:- keras- kerasformers- depth-anything-v2- depth-estimation- arxiv:2406.094142 unmodified lines- tf---## ***See [our collection](https://huggingface.co/collections/kerasformers/depth-anything-v1-and-v2-6a6a965e3e9e4847e424dde2) for all versions of Depth Anything V2.***# Run Depth Anything V2 with Keras 3: JAX, PyTorch, or TensorFlow[](https://github.com/IMvision12/KerasFormers) [](https://imvision12.github.io/KerasFormers/depth_anything_v2/) [](https://huggingface.co/collections/kerasformers/depth-anything-v1-and-v2-6a6a965e3e9e4847e424dde2)# kerasformers/depth_anything_v2_largePaper: [Depth Anything V2 (arXiv:2406.09414)](https://arxiv.org/abs/2406.09414) · [HF Papers](https://huggingface.co/papers/2406.09414)1 unmodified lineFor more details on the model, please go to the upstream [model card](https://huggingface.co/depth-anything/Depth-Anything-V2-Large-hf).Pure-**Keras 3** conversion of [`depth-anything/Depth-Anything-V2-Large-hf`](https://huggingface.co/depth-anything/Depth-Anything-V2-Large-hf) for [kerasformers](https://github.com/IMvision12/KerasFormers). One implementation runs unmodified on **TensorFlow / Torch / JAX**.This is a **monocular depth** checkpoint (`DepthAnythingV2DepthEstimation`, relative).4 unmodified linesos.environ["KERAS_BACKEND"] = "torch" # or "jax" / "tensorflow"from PIL import Imagefrom kerasformers.models.depth_anything_v2 import DepthAnythingV2DepthEstimation, DepthAnythingV2ImageProcessormodel = DepthAnythingV2DepthEstimation.from_weights("kerasformers/depth_anything_v2_large")processor = DepthAnythingV2ImageProcessor.from_weights("kerasformers/depth_anything_v2_large")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 V2 variant the same way with `from_weights("kerasformers/<variant>")`:| Variant | Hub | Output ||---|---|---|| `depth_anything_v2_small` | [`kerasformers/depth_anything_v2_small`](https://huggingface.co/kerasformers/depth_anything_v2_small) | relative || `depth_anything_v2_base` | [`kerasformers/depth_anything_v2_base`](https://huggingface.co/kerasformers/depth_anything_v2_base) | relative || `depth_anything_v2_large` | [`kerasformers/depth_anything_v2_large`](https://huggingface.co/kerasformers/depth_anything_v2_large) | relative || `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 || `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 || `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 || `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 || `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 || `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 |## Tips- Set `KERAS_BACKEND` **before** importing Keras / kerasformers.- Indoor and outdoor metric heads are not interchangeable.- See [Depth Anything V2 docs]({DOCS_URL}) and [Loading Weights](https://imvision12.github.io/KerasFormers/loading_weights/).- Community / upstream weights: `DepthAnythingV2DepthEstimation.from_weights("hf:depth-anything/Depth-Anything-V2-Large-hf")`.## Special Thanks1 unmodified line2345678910112 unmodified lines141516171819202122232425261 unmodified line282930313233344 unmodified lines394041424344454647483 unmodified lines525354555657585960616263646566676869707172737475761 unmodified linepipeline_tag: depth-estimationlicense: cc-by-nc-4.0base_model: depth-anything/Depth-Anything-V2-Large-hflibrary_name: zeromodelstags:- keras- zeromodels- depth-anything-v2- depth-estimation- arxiv:2406.094142 unmodified lines- tf---## ***See [our collection](https://huggingface.co/collections/zeromodels/depth-anything-v1-and-v2-6a6a965e3e9e4847e424dde2) for all versions of Depth Anything V2.***# Run Depth Anything V2 with Keras 3: JAX, PyTorch, or TensorFlow[](https://github.com/IMvision12/ZeroModels) [](https://imvision12.github.io/ZeroModels/depth_anything_v2/) [](https://huggingface.co/collections/zeromodels/depth-anything-v1-and-v2-6a6a965e3e9e4847e424dde2)# zeromodels/depth_anything_v2_largePaper: [Depth Anything V2 (arXiv:2406.09414)](https://arxiv.org/abs/2406.09414) · [HF Papers](https://huggingface.co/papers/2406.09414)1 unmodified lineFor more details on the model, please go to the upstream [model card](https://huggingface.co/depth-anything/Depth-Anything-V2-Large-hf).Pure-**Keras 3** conversion of [`depth-anything/Depth-Anything-V2-Large-hf`](https://huggingface.co/depth-anything/Depth-Anything-V2-Large-hf) for [zeromodels](https://github.com/IMvision12/ZeroModels). One implementation runs unmodified on **TensorFlow / Torch / JAX**.This is a **monocular depth** checkpoint (`DepthAnythingV2DepthEstimation`, relative).4 unmodified linesos.environ["KERAS_BACKEND"] = "torch" # or "jax" / "tensorflow"from PIL import Imagefrom zeromodels.models.depth_anything_v2 import DepthAnythingV2DepthEstimation, DepthAnythingV2ImageProcessormodel = DepthAnythingV2DepthEstimation.from_weights("zeromodels/depth_anything_v2_large")processor = DepthAnythingV2ImageProcessor.from_weights("zeromodels/depth_anything_v2_large")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 V2 variant the same way with `from_weights("zeromodels/<variant>")`:| Variant | Hub | Output ||---|---|---|| `depth_anything_v2_small` | [`zeromodels/depth_anything_v2_small`](https://huggingface.co/zeromodels/depth_anything_v2_small) | relative || `depth_anything_v2_base` | [`zeromodels/depth_anything_v2_base`](https://huggingface.co/zeromodels/depth_anything_v2_base) | relative || `depth_anything_v2_large` | [`zeromodels/depth_anything_v2_large`](https://huggingface.co/zeromodels/depth_anything_v2_large) | relative || `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 || `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 || `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 || `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 || `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 || `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 |## Tips- Set `KERAS_BACKEND` **before** importing Keras / zeromodels.- Indoor and outdoor metric heads are not interchangeable.- See [Depth Anything V2 docs]({DOCS_URL}) and [Loading Weights](https://imvision12.github.io/ZeroModels/loading_weights/).- Community / upstream weights: `DepthAnythingV2DepthEstimation.from_weights("hf:depth-anything/Depth-Anything-V2-Large-hf")`.## Special Thanks
1234567891011121314151617181920212223242526272829303132333435363738{"library_name": "kerasformers","kerasformers_version": "1.2.1","model_module": "kerasformers.models.depth_anything_v2","model_class": "DepthAnythingV2DepthEstimation","variant": "depth_anything_v2_large","weights": "model.weights.h5","schema_version": 2,"weight_dtype": "float32","model_type": "depth_anything","vision_config": {"backbone_dim": 1024,"backbone_depth": 24,"backbone_num_heads": 16,"out_indices": [5,12,18,24],"neck_hidden_sizes": [256,512,1024,1024],"fusion_hidden_size": 256,"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_v2","model_class": "DepthAnythingV2DepthEstimation","variant": "depth_anything_v2_large","weights": "model.weights.h5","schema_version": 2,"weight_dtype": "float32","model_type": "depth_anything","vision_config": {"backbone_dim": 1024,"backbone_depth": 24,"backbone_num_heads": 16,"out_indices": [5,12,18,24],"neck_hidden_sizes": [256,512,1024,1024],"fusion_hidden_size": 256,"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_v2","preprocessor_class": "DepthAnythingV2ImageProcessor","variant": "depth_anything_v2_large","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_v2","preprocessor_class": "DepthAnythingV2ImageProcessor","variant": "depth_anything_v2_large","target_size": 518,"image_mean": [0.485,0.456,0.406],"image_std": [0.229,0.224,0.225],"data_format": null}
README.md+21-21
kf_config.json → zm_config.jsonRenamed+37-37
kf_preprocessor.json → zm_preprocessor.jsonRenamed+18-18