Views
No views yet
google/tipsv2-so400m14-dpt for zeromodels. One implementation runs unmodified on TensorFlow / Torch / JAX.1import os
2os.environ["KERAS_BACKEND"] = "torch" # or "jax" / "tensorflow"
3
4from PIL import Image
5import numpy as np
6import keras
7from zeromodels.models.tipsv2_dpt import (
8 Tipsv2DptDensePredict, # depth + segmentation
9 Tipsv2DptDepthEstimation, # depth only
10 Tipsv2DptSemanticSegment, # segmentation only
11 Tipsv2DptImageProcessor,
12)
13
14# all three load from the SAME repo
15model = Tipsv2DptDensePredict.from_weights("zeromodels/tipsv2-so400m14-dpt")
16proc = Tipsv2DptImageProcessor(image_resolution=448)
17
18image = Image.open("your_image.jpg").convert("RGB")
19pixel_values = proc(np.array(image))["pixel_values"]
20out = model(pixel_values)
21depth = keras.ops.convert_to_numpy(out["predicted_depth"]) # (1, H', W')
22seg = keras.ops.convert_to_numpy(out["segmentation_logits"]) # (1, H', W', num_labels)
23
24# single-task variants (same weights, one output each)
25depth_model = Tipsv2DptDepthEstimation.from_weights("zeromodels/tipsv2-so400m14-dpt")
26seg_model = Tipsv2DptSemanticSegment.from_weights("zeromodels/tipsv2-so400m14-dpt")| Variant | Hub |
|---|---|
tipsv2-b14-dpt | zeromodels/tipsv2-b14-dpt |
tipsv2-l14-dpt | zeromodels/tipsv2-l14-dpt |
tipsv2-so400m14-dpt | zeromodels/tipsv2-so400m14-dpt |
tipsv2-g14-dpt | zeromodels/tipsv2-g14-dpt |
KERAS_BACKEND before importing Keras / zeromodels.[0, 1] (no mean/std normalization); input resolution is 448.Tipsv2DptDensePredict.from_weights("hf:google/tipsv2-so400m14-dpt").google/tipsv2-so400m14-dpt checkpoint).