Views
No views yet
LiheYoung/depth-anything-base-hf for zeromodels. One implementation runs unmodified on TensorFlow / Torch / JAX.DepthAnythingV1DepthEstimation) with relative inverse depth.1import os
2os.environ["KERAS_BACKEND"] = "torch" # or "jax" / "tensorflow"
3
4from PIL import Image
5from zeromodels.models.depth_anything_v1 import DepthAnythingV1DepthEstimation, DepthAnythingV1ImageProcessor
6
7model = DepthAnythingV1DepthEstimation.from_weights("zeromodels/depth_anything_base")
8processor = DepthAnythingV1ImageProcessor.from_weights("zeromodels/depth_anything_base")
9
10image = Image.open("your_image.jpg").convert("RGB")
11output = model(processor(image)["pixel_values"], training=False)
12depth = processor.post_process_depth_estimation(
13 output, original_size=(image.height, image.width)
14)
15print(depth.shape)from_weights("zeromodels/<variant>"):| Variant | Hub | Backbone |
|---|---|---|
depth_anything_small | zeromodels/depth_anything_small | ViT-S/14 |
depth_anything_base | zeromodels/depth_anything_base | ViT-B/14 |
depth_anything_large | zeromodels/depth_anything_large | ViT-L/14 |
KERAS_BACKEND before importing Keras / zeromodels.DepthAnythingV1DepthEstimation.from_weights("hf:LiheYoung/depth-anything-base-hf").