CV / Depth-Anything

Depth-Anything-V2-ViTS

Depth-Anything-V2-Small (ViT-S backbone) outputs a 224x224 relative depth map. The app normalizes it, applies an INFERNO colormap, and alpha-blends onto the original frame. First variant of the depth_anything family.

2 downloads
Grootte
35 MB
Geheugen
4GB+
Precisie
Hailo HEF / HailoRT 4.23.x

Kies het apparaat dat je gebruikt. De installatiehandleiding en documentatie worden dienovereenkomstig bijgewerkt.

Aan de slag

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

REST API

Gebruik de REST API om inferentie uit te voeren. Kopieer de onderstaande commando's.

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

Modeldetails

Depth-Anything-V2-ViTS on reComputer R Series (CM5 + Hailo-8)

Depth-Anything-V2-Small (ViT-S backbone) performs zero-shot monocular depth estimation on Hailo-8. The HEF outputs a 224×224×1 relative depth map; the app normalizes it, applies an INFERNO colormap, and alpha-blends onto the original frame.

Model Info

PropertyValue
ArchitectureViT-S (Depth-Anything-V2-Small-hf)
TaskZero-shot depth estimation
Input224x224x3 RGB
OutputDepth map 224x224x1 (relative)
Parameters24.2M
Operations16.7G
AbsRel0.147
HEFHailo Model Zoo v2.19.0, Hailo-8

Run With Demo Video

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

Open http://<Board_IP>:8000 to view the depth overlay.

REST API

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

Returns depth_stats (min, max, mean, std) for the predicted depth map.

EndpointMethodPurpose
/api/models/depth_anything_v2_vits/predictPOSTDepth statistics (JSON)
/api/video_feedGETMJPEG with INFERNO depth overlay

Implementation Notes

  • Relative depth: output is per-frame min-max normalized (not metric). Higher = farther. Dark (INFERNO) = close, bright = far.
  • Slider controls alpha blend between original frame and depth colormap.
  • normalize_in_net ImageNet RGB; no input_conversion → feed raw uint8 RGB.
  • No on-chip post-processing — raw FLOAT32 depth map output.

Development Notes

  • Source: src/rpi5_hailo8_depth_anything_v2_vits/
  • Container: ghcr.io/seeed-projects/recomputer-hailo8-cv/depth_anything_v2_vits:latest
  • Family: depth_anything (variants v2_vits / vits)

Invoer en uitvoer

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.