CV / Depth-Anything

Depth-Anything-ViTS

reComputer R Series (CM5 + Hailo-10H)

在搭载 Hailo-8 或 Hailo-10H 的 reComputer R Series 上使用 Depth-Anything V1(ViT-S)进行零样本单目深度估计。

49 次下载
大小
24.6 MB
内存
4GB+
精度
Hailo HEF

选择你正在使用的设备,设置指南和文档将相应更新。

快速开始

部署
sudo docker run --rm \
  --name cm5-hailo10h-depth-anything-vits \
  --privileged \
  --net=host \
  -e PYTHONUNBUFFERED=1 \
  --device /dev/hailo0:/dev/hailo0 \
  -v /usr/lib/libhailort.so.5.1.1:/usr/lib/libhailort.so.5.1.1:ro \
  -v /usr/lib/libhailort.so:/usr/lib/libhailort.so:ro \
  ghcr.io/seeed-projects/recomputer-hailo10h-cv/depth_anything_vits:latest \
  python web_detection.py --model_path model/depth_anything_vits.hef --video_path video/test.mp4

REST API

使用 REST API 进行推理。复制以下命令。

Curl
curl -X POST "http://<Board_IP>:8000/api/models/depth_anything_vits/predict" \
  -F "file=@test.jpg"
Python
import requests
response = requests.post(
    "http://<Board_IP>:8000/api/models/depth_anything_vits/predict",
    files={"file": open("test.jpg", "rb")},
    timeout=30,
)
print(response.json())

模型详情

reComputer R Series (CM5 + Hailo-10H)

Depth-Anything-ViTS 在 reComputer R Series(CM5 + Hailo-10H)上运行

Depth-Anything V1(ViT-S 主干)通过 HailoRT 在 Hailo-10H 上进行零样本单目深度估计。 I/O 与 V2 相同,但精度略好(AbsRel 0.13 vs 0.147)。HEF 输出 224×224×1 的相对 深度图,支持 INFERNO 着色可视化和深度统计 API。

模型信息

属性值
架构ViT-S(Depth-Anything V1)
任务零样本深度估计
输入224x224x3 RGB
输出深度图 224x224x1(相对深度,FLOAT32)
参数量24.2M
运算量16.7G
AbsRel0.13
HEFHailo Model Zoo v5.4.0,Hailo-10H
HEF 大小24.6 MB(24,621,056 字节)

使用演示视频运行

bash
sudo docker run --rm \
  --name cm5-hailo10h-depth-anything-vits \
  --privileged \
  --net=host \
  -e PYTHONUNBUFFERED=1 \
  --device /dev/hailo0:/dev/hailo0 \
  -v /usr/lib/libhailort.so.5.1.1:/usr/lib/libhailort.so.5.1.1:ro \
  -v /usr/lib/libhailort.so:/usr/lib/libhailort.so:ro \
  ghcr.io/seeed-projects/recomputer-hailo10h-cv/depth_anything_vits:latest \
  python web_detection.py --model_path model/depth_anything_vits.hef --video_path video/test.mp4

打开 http://<Board_IP>:8000 查看深度叠加效果。

USB 摄像头需挂载 /dev/video0,并把 --video_path ... 改为 --camera_id 0。

REST API

bash
curl -X POST "http://<Board_IP>:8000/api/models/depth_anything_vits/predict" \
  -F "file=@test.jpg"

返回预测深度图的 depth_stats(min、max、mean、std)。

端点方法用途
/api/models/depth_anything_vits/predictPOST深度统计(JSON)
/api/video_feedGET带 INFERNO 深度叠加的 MJPEG

实现说明

  • 相对深度:输出按帧做 min-max 归一化(非公制),值越大越远;INFERNO 中暗=近、亮=远。
  • 滑块控制原图与深度着色的 alpha 混合比例。
  • normalize_in_net ImageNet RGB;无 input_conversion → letterbox 后直接喂原始 uint8 RGB。
  • 无片上后处理,输出就是深度图;封装层请求 FLOAT32 vstream,主机拿到反量化后的值。
  • 启动时从 HEF 读取实际输入尺寸(224x224)。

开发说明

  • 源码:src/hailo10h_depth_anything_vits/
  • Dockerfile:docker/hailo10h/depth_anything_vits.dockerfile
  • 容器镜像:ghcr.io/seeed-projects/recomputer-hailo10h-cv/depth_anything_vits:latest
  • HEF:Hailo Model Zoo v5.4.0(hailo10h),24,621,056 字节, SHA256 5d32051560d30cf879a4a6158edea382d4a2ec6b4b2d421e58696e8c1ec85beb
  • 所属系列:depth_anything(变体 v2_vits / vits)

输入与输出

Input: image, video, or USB camera frame. Output: relative depth map with INFERNO colormap overlay on MJPEG preview, plus depth statistics (min/max/mean/std) via API.