Depth Anything V2
Dedicated Deployment または self-hosted Inference で単眼深度推定に Depth Anything V2 を使用します
コードサンプル
3
モデルを実行する
import os
import cv2
import numpy as np
import requests
from inference_sdk import InferenceHTTPClient
content = requests.get("https://media.roboflow.com/notebooks/examples/bicycle.png").content
image = cv2.imdecode(np.frombuffer(content, np.uint8), cv2.IMREAD_COLOR)
client = InferenceHTTPClient(
api_url="https://your-deployment.roboflow.cloud",
api_key=os.environ["ROBOFLOW_API_KEY"],
)
result = client.depth_estimation(image)
depth = np.array(result["normalized_depth"], dtype=np.float32)
depth = cv2.resize(depth, (image.shape[1], image.shape[0]))
depth_vis = (depth * 255).astype(np.uint8)
depth_color = cv2.applyColorMap(depth_vis, cv2.COLORMAP_INFERNO)
cv2.imwrite("depth_annotated.png", np.hstack([image, depth_color]))
推論速度
モデル
レイテンシ (ms)
最終更新
役に立ちましたか?