Run this model with HF Jobs
Run starifiedwill/DAV2SW 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/starifiedwill/DAV2SW. 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/starifiedwill/DAV2SW 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 starifiedwill/DAV2SW with libraries, inference providers, notebooks, and local apps. Follow these links to get started.
- Libraries
- DepthAnythingV2
How to use starifiedwill/DAV2SW 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="starifiedwill/DAV2SW", 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
Depth Anything V2 Small, as files a web page can run
The Small model of Depth Anything V2 (commit a561b849,
weights depth_anything_v2_vits.pth), packed so that a web page can download it and run it in the visitor's own
browser with ONNX Runtime Web. The photo being read never has to leave the visitor's device.
This is not the makers' own release. The model and its weights are theirs; only the packing below is new.
Files
| File | What it holds |
|---|---|
graph.onnx |
The model's steps, without its weights (it asks for them under weights.f32) |
weights-0.bin to weights-4.bin |
The weights and the grid of positions as 16-bit floats, one stream cut in five |
manifest.json |
How the pieces fit together, and the SHA-256 of every file |
LICENSE |
The makers' license (Apache 2.0) |
Reading it
- Join the five pieces in order (49,418,240 bytes) and read them as little-endian 16-bit floats, widened to 32-bit.
- The first 24,183,040 values are the weights, in the order
graph.onnxasks for them: hand them to the runtime as the external dataweights.f32(96,732,160 bytes). - The next 1,370 x 384 values are the model's positions for a 37 x 37 grid of patches, the class token's first.
The graph has two inputs and one output:
image: float32,[1, 3, H, W], red, green, blue, prepared as the makers' code prepares it (shorter side to 518, each side a multiple of 14, cubic resize, mean and deviation of ImageNet).pos: float32,[1, 1 + rows x cols, 384], the positions for this picture's grid of patches. For a 37 x 37 picture they are the stored ones; for any other size the patches' part is resized the makers' way (cubic, by the patch counts plus 0.1).depth: relative nearness at the fed size, larger is nearer.
What was changed from the makers' release
- Exported from their PyTorch code to ONNX with the picture size left free. The positions became a second input, because the makers resize them in plain Python, which an export would fix at one size.
- The weights are stored as 16-bit floats instead of 32-bit to halve the download. Against the makers' code on the same pixels the depth differs by at most 0.0094 of a picture's depth range (mean at most 0.0007).
License
Apache 2.0, the license of the makers' Small model. Their larger models are under a non-commercial license and are not here.
- Downloads last month
- -