Skip to content

Commit 294170d

Browse files
localai-botmudler
andauthored
feat(backend): add depth-anything (Depth Anything 3) C++/ggml backend + gallery (#10352)
* feat(backend): add depth-anything (Depth Anything 3) C++/ggml backend + gallery Mirrors the locate-anything-cpp backend to register a new depth-anything backend that wraps the Depth Anything 3 ggml port (depth-anything.cpp) via purego (cgo-less, no Python at inference). - backend/go/depth-anything-cpp/: gRPC backend (Load + Predict + GenerateImage), purego binding to the da_capi_* C ABI, CMake/Makefile/run/package/test scripts building depth-anything.cpp's DA_SHARED static .so per CPU variant. - backend/index.yaml: depth-anything backend meta + all hardware-variant capability entries (cpu/cuda12/cuda13/intel-sycl-f32+f16/vulkan/nvidia-l4t). - gallery/index.yaml: 8 Depth Anything 3 GGUF models (base q4_k/q8_0/f16/f32, small, large, giant, mono-large). - .github/backend-matrix.yml: one build entry per hardware variant. Assisted-by: Claude:claude-opus-4-8 Signed-off-by: Ettore Di Giacinto <mudler@localai.io> * feat(depth): typed Depth RPC + REST endpoint exposing full DA3 data Assisted-by: Claude:claude-opus-4-8 Signed-off-by: Ettore Di Giacinto <mudler@localai.io> * fix(depth): pin depth-anything.cpp to e0b6814 (ABI 3 dense C-API) The Depth RPC handler calls da_capi_depth_dense / da_capi_points (C-API ABI 3); pin the native build to the commit that exports them. Assisted-by: Claude:claude-opus-4-8 Signed-off-by: Ettore Di Giacinto <mudler@localai.io> * fix(depth): pin depth-anything.cpp to v0.1.0 release (b515c31) Repoint the native version from the now-orphaned e0b6814 to the b515c31 release commit, kept alive by the upstream v0.1.0 tag. C-API is unchanged (da_capi_abi_version == 3). Assisted-by: Claude:claude-opus-4-8 Signed-off-by: Ettore Di Giacinto <mudler@localai.io> * fix(depth): wire depth-anything-cpp into build, CI bump, and importer The backend dir, gallery index, and CI build-matrix were present but the backend was never wired into the integration points that adding-backends.md requires: - root Makefile: add to .NOTPARALLEL, the test-extra chain, a BACKEND_* definition, the docker-build target eval, and docker-build-backends (mirrors parakeet-cpp; the backend's own Makefile already documented that its `test` target is driven by test-extra). - bump_deps.yaml: register the DEPTHANYTHING_VERSION pin so the daily auto-bump bot tracks mudler/depth-anything.cpp master (it cannot see an unregistered Makefile pin). - import form: add a preference-only KnownBackend entry so depth-anything is selectable at /import-model (mirrors sam3-cpp; no reliable GGUF auto-detect signal, so pref-only per the doc's default). changed-backends.js needs no entry: the generic golang suffix branch already resolves backend/go/depth-anything-cpp/. Assisted-by: Claude:claude-opus-4-8 Signed-off-by: Ettore Di Giacinto <mudler@localai.io> * feat(depth): auto-detect importer for depth-anything GGUFs Replace the preference-only entry with a real auto-detect importer (mirrors parakeet-cpp / locate-anything): - DepthAnythingImporter matches a .gguf whose name carries a depth-anything token (depth-anything-<size>-<quant>.gguf), so /import-model recognises mudler/depth-anything.cpp-gguf repos and direct GGUF URLs without an explicit backend preference. preferences.backend= "depth-anything" still forces it. - Registered before LlamaCPPImporter so its GGUF bundles aren't claimed by the generic .gguf importer; the narrow name match means it cannot claim arbitrary llama GGUFs or the upstream safetensors PyTorch repos. - Multi-quant repos pick the smallest quant by default (q4_k -> ... -> f32, depth stays >0.998 corr even at q4_k); quantizations preference overrides. - Drops the now-redundant knownPrefOnlyBackends entry (importer-backed backends are not listed there, matching parakeet-cpp). - Table-driven Ginkgo test covers detection, negative cases (llama GGUF, upstream safetensors), default/override/fallback quant pick, and direct URL import. 10/10 specs pass. Assisted-by: Claude:claude-opus-4-8 Signed-off-by: Ettore Di Giacinto <mudler@localai.io> * fix(depth): check conn.Close error in grpc Depth client (errcheck) The new Depth() client method used a bare `defer conn.Close()`. golangci-lint runs with new-from-merge-base, so although the 39 sibling methods use the same bare form (grandfathered), the newly added line trips errcheck. Drop the result explicitly to satisfy the linter. Signed-off-by: Ettore Di Giacinto <mudler@localai.io> Assisted-by: Claude:claude-opus-4-8 * fix(depth): bump depth-anything.cpp to v0.1.1 (embeddable CMake) v0.1.0 (b515c31) used ${CMAKE_SOURCE_DIR} for its include dirs, which points at the parent project when built via add_subdirectory() as this backend does, so the container build failed with missing stb_image.h / da_gguf_keys.h. v0.1.1 (2d42897) switches to project-relative paths. Signed-off-by: Ettore Di Giacinto <mudler@localai.io> Assisted-by: Claude:claude-opus-4-8 * fix(depth): resolve gosec findings in the backend wrapper The code-scanning gate flagged three new failure-level alerts in godepthanythingcpp.go (gosec runs with -no-fail; GitHub gates on new alerts): - G301: export dirs were created with 0o755. Tighten to 0o750 (no world access needed for backend-written export output). - G304: writeDepthPNG creates req.GetDst(). That path is chosen by the LocalAI core as the intended output destination (same pattern every image backend uses), not attacker input, so annotate with #nosec G304 and document why. The remaining G103 "audit unsafe" notes on the unsafe.Slice C-buffer copies are warning-level (the same purego interop whisper/parakeet use) and do not gate the check, per the supertonic exclusion precedent in secscan.yaml. Signed-off-by: Ettore Di Giacinto <mudler@localai.io> Assisted-by: Claude:claude-opus-4-8 * fix(depth): bump depth-anything.cpp to v0.1.2 (CUDA cross-build arch) v0.1.1 forced CMAKE_CUDA_ARCHITECTURES=native, which breaks the GPU-less l4t/cublas CI builds (nvcc "Unsupported gpu architecture 'compute_'" on CMake 3.22). v0.1.2 (442eea4) drops the override and lets ggml pick its default cross-build arch list. Signed-off-by: Ettore Di Giacinto <mudler@localai.io> Assisted-by: Claude:claude-opus-4-8 --------- Signed-off-by: Ettore Di Giacinto <mudler@localai.io> Co-authored-by: Ettore Di Giacinto <mudler@localai.io>
1 parent 1ab61a0 commit 294170d

36 files changed

Lines changed: 2077 additions & 2 deletions

.github/backend-matrix.yml

Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -716,6 +716,19 @@ include:
716716
dockerfile: "./backend/Dockerfile.golang"
717717
context: "./"
718718
ubuntu-version: '2404'
719+
- build-type: 'cublas'
720+
cuda-major-version: "12"
721+
cuda-minor-version: "8"
722+
platforms: 'linux/amd64'
723+
tag-latest: 'auto'
724+
tag-suffix: '-gpu-nvidia-cuda-12-depth-anything-cpp'
725+
runs-on: 'ubuntu-latest'
726+
base-image: "ubuntu:24.04"
727+
skip-drivers: 'false'
728+
backend: "depth-anything-cpp"
729+
dockerfile: "./backend/Dockerfile.golang"
730+
context: "./"
731+
ubuntu-version: '2404'
719732
- build-type: 'cublas'
720733
cuda-major-version: "12"
721734
cuda-minor-version: "8"
@@ -1582,6 +1595,19 @@ include:
15821595
dockerfile: "./backend/Dockerfile.golang"
15831596
context: "./"
15841597
ubuntu-version: '2404'
1598+
- build-type: 'cublas'
1599+
cuda-major-version: "13"
1600+
cuda-minor-version: "0"
1601+
platforms: 'linux/amd64'
1602+
tag-latest: 'auto'
1603+
tag-suffix: '-gpu-nvidia-cuda-13-depth-anything-cpp'
1604+
runs-on: 'ubuntu-latest'
1605+
base-image: "ubuntu:24.04"
1606+
skip-drivers: 'false'
1607+
backend: "depth-anything-cpp"
1608+
dockerfile: "./backend/Dockerfile.golang"
1609+
context: "./"
1610+
ubuntu-version: '2404'
15851611
- build-type: 'cublas'
15861612
cuda-major-version: "13"
15871613
cuda-minor-version: "0"
@@ -1621,6 +1647,19 @@ include:
16211647
backend: "locate-anything-cpp"
16221648
dockerfile: "./backend/Dockerfile.golang"
16231649
context: "./"
1650+
- build-type: 'cublas'
1651+
cuda-major-version: "13"
1652+
cuda-minor-version: "0"
1653+
platforms: 'linux/arm64'
1654+
skip-drivers: 'false'
1655+
tag-latest: 'auto'
1656+
tag-suffix: '-nvidia-l4t-cuda-13-arm64-depth-anything-cpp'
1657+
base-image: "ubuntu:24.04"
1658+
ubuntu-version: '2404'
1659+
runs-on: 'ubuntu-24.04-arm'
1660+
backend: "depth-anything-cpp"
1661+
dockerfile: "./backend/Dockerfile.golang"
1662+
context: "./"
16241663
- build-type: 'cublas'
16251664
cuda-major-version: "13"
16261665
cuda-minor-version: "0"
@@ -2898,6 +2937,19 @@ include:
28982937
dockerfile: "./backend/Dockerfile.golang"
28992938
context: "./"
29002939
ubuntu-version: '2404'
2940+
- build-type: ''
2941+
cuda-major-version: ""
2942+
cuda-minor-version: ""
2943+
platforms: 'linux/amd64'
2944+
tag-latest: 'auto'
2945+
tag-suffix: '-cpu-depth-anything-cpp'
2946+
runs-on: 'ubuntu-latest'
2947+
base-image: "ubuntu:24.04"
2948+
skip-drivers: 'false'
2949+
backend: "depth-anything-cpp"
2950+
dockerfile: "./backend/Dockerfile.golang"
2951+
context: "./"
2952+
ubuntu-version: '2404'
29012953
- build-type: 'sycl_f32'
29022954
cuda-major-version: ""
29032955
cuda-minor-version: ""
@@ -2911,6 +2963,19 @@ include:
29112963
dockerfile: "./backend/Dockerfile.golang"
29122964
context: "./"
29132965
ubuntu-version: '2404'
2966+
- build-type: 'sycl_f32'
2967+
cuda-major-version: ""
2968+
cuda-minor-version: ""
2969+
platforms: 'linux/amd64'
2970+
tag-latest: 'auto'
2971+
tag-suffix: '-gpu-intel-sycl-f32-depth-anything-cpp'
2972+
runs-on: 'ubuntu-latest'
2973+
base-image: "intel/oneapi-basekit:2025.3.0-0-devel-ubuntu24.04"
2974+
skip-drivers: 'false'
2975+
backend: "depth-anything-cpp"
2976+
dockerfile: "./backend/Dockerfile.golang"
2977+
context: "./"
2978+
ubuntu-version: '2404'
29142979
- build-type: 'sycl_f16'
29152980
cuda-major-version: ""
29162981
cuda-minor-version: ""
@@ -2924,6 +2989,19 @@ include:
29242989
dockerfile: "./backend/Dockerfile.golang"
29252990
context: "./"
29262991
ubuntu-version: '2404'
2992+
- build-type: 'sycl_f16'
2993+
cuda-major-version: ""
2994+
cuda-minor-version: ""
2995+
platforms: 'linux/amd64'
2996+
tag-latest: 'auto'
2997+
tag-suffix: '-gpu-intel-sycl-f16-depth-anything-cpp'
2998+
runs-on: 'ubuntu-latest'
2999+
base-image: "intel/oneapi-basekit:2025.3.0-0-devel-ubuntu24.04"
3000+
skip-drivers: 'false'
3001+
backend: "depth-anything-cpp"
3002+
dockerfile: "./backend/Dockerfile.golang"
3003+
context: "./"
3004+
ubuntu-version: '2404'
29273005
- build-type: 'vulkan'
29283006
cuda-major-version: ""
29293007
cuda-minor-version: ""
@@ -2938,6 +3016,20 @@ include:
29383016
dockerfile: "./backend/Dockerfile.golang"
29393017
context: "./"
29403018
ubuntu-version: '2404'
3019+
- build-type: 'vulkan'
3020+
cuda-major-version: ""
3021+
cuda-minor-version: ""
3022+
platforms: 'linux/amd64'
3023+
platform-tag: 'amd64'
3024+
tag-latest: 'auto'
3025+
tag-suffix: '-gpu-vulkan-depth-anything-cpp'
3026+
runs-on: 'ubuntu-latest'
3027+
base-image: "ubuntu:24.04"
3028+
skip-drivers: 'false'
3029+
backend: "depth-anything-cpp"
3030+
dockerfile: "./backend/Dockerfile.golang"
3031+
context: "./"
3032+
ubuntu-version: '2404'
29413033
- build-type: 'vulkan'
29423034
cuda-major-version: ""
29433035
cuda-minor-version: ""
@@ -2952,6 +3044,20 @@ include:
29523044
dockerfile: "./backend/Dockerfile.golang"
29533045
context: "./"
29543046
ubuntu-version: '2404'
3047+
- build-type: 'vulkan'
3048+
cuda-major-version: ""
3049+
cuda-minor-version: ""
3050+
platforms: 'linux/arm64'
3051+
platform-tag: 'arm64'
3052+
tag-latest: 'auto'
3053+
tag-suffix: '-gpu-vulkan-depth-anything-cpp'
3054+
runs-on: 'ubuntu-24.04-arm'
3055+
base-image: "ubuntu:24.04"
3056+
skip-drivers: 'false'
3057+
backend: "depth-anything-cpp"
3058+
dockerfile: "./backend/Dockerfile.golang"
3059+
context: "./"
3060+
ubuntu-version: '2404'
29553061
- build-type: 'sycl_f32'
29563062
cuda-major-version: ""
29573063
cuda-minor-version: ""
@@ -3058,6 +3164,19 @@ include:
30583164
dockerfile: "./backend/Dockerfile.golang"
30593165
context: "./"
30603166
ubuntu-version: '2204'
3167+
- build-type: 'cublas'
3168+
cuda-major-version: "12"
3169+
cuda-minor-version: "0"
3170+
platforms: 'linux/arm64'
3171+
skip-drivers: 'false'
3172+
tag-latest: 'auto'
3173+
tag-suffix: '-nvidia-l4t-arm64-depth-anything-cpp'
3174+
base-image: "nvcr.io/nvidia/l4t-jetpack:r36.4.0"
3175+
runs-on: 'ubuntu-24.04-arm'
3176+
backend: "depth-anything-cpp"
3177+
dockerfile: "./backend/Dockerfile.golang"
3178+
context: "./"
3179+
ubuntu-version: '2204'
30613180
# whisper
30623181
- build-type: ''
30633182
cuda-major-version: ""

.github/workflows/bump_deps.yaml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ jobs:
3838
variable: "PARAKEET_VERSION"
3939
branch: "master"
4040
file: "backend/go/parakeet-cpp/Makefile"
41+
- repository: "mudler/depth-anything.cpp"
42+
variable: "DEPTHANYTHING_VERSION"
43+
branch: "master"
44+
file: "backend/go/depth-anything-cpp/Makefile"
4145
- repository: "leejet/stable-diffusion.cpp"
4246
variable: "STABLEDIFFUSION_GGML_VERSION"
4347
branch: "master"

Makefile

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Disable parallel execution for backend builds
2-
.NOTPARALLEL: backends/diffusers backends/llama-cpp backends/turboquant backends/outetts backends/piper backends/stablediffusion-ggml backends/whisper backends/crispasr backends/parakeet-cpp backends/faster-whisper backends/silero-vad backends/local-store backends/huggingface backends/rfdetr backends/rfdetr-cpp backends/insightface backends/speaker-recognition backends/kitten-tts backends/kokoro backends/chatterbox backends/llama-cpp-darwin backends/neutts build-darwin-python-backend build-darwin-go-backend backends/mlx backends/diffuser-darwin backends/mlx-vlm backends/mlx-audio backends/mlx-distributed backends/stablediffusion-ggml-darwin backends/vllm backends/vllm-omni backends/sglang backends/moonshine backends/pocket-tts backends/qwen-tts backends/faster-qwen3-tts backends/qwen-asr backends/nemo backends/voxcpm backends/whisperx backends/ace-step backends/acestep-cpp backends/fish-speech backends/voxtral backends/opus backends/trl backends/llama-cpp-quantization backends/kokoros backends/sam3-cpp backends/qwen3-tts-cpp backends/omnivoice-cpp backends/vibevoice-cpp backends/localvqe backends/tinygrad backends/sherpa-onnx backends/ds4 backends/ds4-darwin backends/liquid-audio backends/supertonic
2+
.NOTPARALLEL: backends/diffusers backends/llama-cpp backends/turboquant backends/outetts backends/piper backends/stablediffusion-ggml backends/whisper backends/crispasr backends/parakeet-cpp backends/faster-whisper backends/silero-vad backends/local-store backends/huggingface backends/rfdetr backends/rfdetr-cpp backends/insightface backends/speaker-recognition backends/kitten-tts backends/kokoro backends/chatterbox backends/llama-cpp-darwin backends/neutts build-darwin-python-backend build-darwin-go-backend backends/mlx backends/diffuser-darwin backends/mlx-vlm backends/mlx-audio backends/mlx-distributed backends/stablediffusion-ggml-darwin backends/vllm backends/vllm-omni backends/sglang backends/moonshine backends/pocket-tts backends/qwen-tts backends/faster-qwen3-tts backends/qwen-asr backends/nemo backends/voxcpm backends/whisperx backends/ace-step backends/acestep-cpp backends/fish-speech backends/voxtral backends/opus backends/trl backends/llama-cpp-quantization backends/kokoros backends/sam3-cpp backends/qwen3-tts-cpp backends/omnivoice-cpp backends/vibevoice-cpp backends/localvqe backends/tinygrad backends/sherpa-onnx backends/ds4 backends/ds4-darwin backends/liquid-audio backends/supertonic backends/depth-anything-cpp
33

44
GOCMD=go
55
GOTEST=$(GOCMD) test
@@ -595,6 +595,7 @@ test-extra: prepare-test-extra
595595
$(MAKE) -C backend/rust/kokoros test
596596
$(MAKE) -C backend/go/rfdetr-cpp test
597597
$(MAKE) -C backend/go/locate-anything-cpp test
598+
$(MAKE) -C backend/go/depth-anything-cpp test
598599
$(MAKE) -C backend/go/supertonic test
599600

600601
##
@@ -1174,6 +1175,7 @@ BACKEND_STABLEDIFFUSION_GGML = stablediffusion-ggml|golang|.|--progress=plain|tr
11741175
BACKEND_WHISPER = whisper|golang|.|false|true
11751176
BACKEND_CRISPASR = crispasr|golang|.|false|true
11761177
BACKEND_PARAKEET_CPP = parakeet-cpp|golang|.|false|true
1178+
BACKEND_DEPTH_ANYTHING_CPP = depth-anything-cpp|golang|.|false|true
11771179
BACKEND_VOXTRAL = voxtral|golang|.|false|true
11781180
BACKEND_ACESTEP_CPP = acestep-cpp|golang|.|false|true
11791181
BACKEND_QWEN3_TTS_CPP = qwen3-tts-cpp|golang|.|false|true
@@ -1265,6 +1267,7 @@ $(eval $(call generate-docker-build-target,$(BACKEND_STABLEDIFFUSION_GGML)))
12651267
$(eval $(call generate-docker-build-target,$(BACKEND_WHISPER)))
12661268
$(eval $(call generate-docker-build-target,$(BACKEND_CRISPASR)))
12671269
$(eval $(call generate-docker-build-target,$(BACKEND_PARAKEET_CPP)))
1270+
$(eval $(call generate-docker-build-target,$(BACKEND_DEPTH_ANYTHING_CPP)))
12681271
$(eval $(call generate-docker-build-target,$(BACKEND_VOXTRAL)))
12691272
$(eval $(call generate-docker-build-target,$(BACKEND_OPUS)))
12701273
$(eval $(call generate-docker-build-target,$(BACKEND_RERANKERS)))
@@ -1316,7 +1319,7 @@ $(eval $(call generate-docker-build-target,$(BACKEND_SUPERTONIC)))
13161319
docker-save-%: backend-images
13171320
docker save local-ai-backend:$* -o backend-images/$*.tar
13181321

1319-
docker-build-backends: docker-build-llama-cpp docker-build-ik-llama-cpp docker-build-turboquant docker-build-ds4 docker-build-rerankers docker-build-vllm docker-build-vllm-omni docker-build-sglang docker-build-transformers docker-build-outetts docker-build-diffusers docker-build-kokoro docker-build-faster-whisper docker-build-crispasr docker-build-coqui docker-build-chatterbox docker-build-vibevoice docker-build-liquid-audio docker-build-moonshine docker-build-pocket-tts docker-build-qwen-tts docker-build-fish-speech docker-build-faster-qwen3-tts docker-build-qwen-asr docker-build-nemo docker-build-voxcpm docker-build-whisperx docker-build-ace-step docker-build-acestep-cpp docker-build-voxtral docker-build-mlx-distributed docker-build-trl docker-build-llama-cpp-quantization docker-build-tinygrad docker-build-kokoros docker-build-sam3-cpp docker-build-rfdetr-cpp docker-build-qwen3-tts-cpp docker-build-omnivoice-cpp docker-build-vibevoice-cpp docker-build-localvqe docker-build-insightface docker-build-speaker-recognition docker-build-sherpa-onnx docker-build-cloud-proxy docker-build-supertonic
1322+
docker-build-backends: docker-build-llama-cpp docker-build-ik-llama-cpp docker-build-turboquant docker-build-ds4 docker-build-rerankers docker-build-vllm docker-build-vllm-omni docker-build-sglang docker-build-transformers docker-build-outetts docker-build-diffusers docker-build-kokoro docker-build-faster-whisper docker-build-crispasr docker-build-coqui docker-build-chatterbox docker-build-vibevoice docker-build-liquid-audio docker-build-moonshine docker-build-pocket-tts docker-build-qwen-tts docker-build-fish-speech docker-build-faster-qwen3-tts docker-build-qwen-asr docker-build-nemo docker-build-voxcpm docker-build-whisperx docker-build-ace-step docker-build-acestep-cpp docker-build-voxtral docker-build-mlx-distributed docker-build-trl docker-build-llama-cpp-quantization docker-build-tinygrad docker-build-kokoros docker-build-sam3-cpp docker-build-rfdetr-cpp docker-build-qwen3-tts-cpp docker-build-omnivoice-cpp docker-build-vibevoice-cpp docker-build-localvqe docker-build-insightface docker-build-speaker-recognition docker-build-sherpa-onnx docker-build-cloud-proxy docker-build-supertonic docker-build-depth-anything-cpp
13201323

13211324
########################################################
13221325
### Mock Backend for E2E Tests

backend/backend.proto

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ service Backend {
2424
rpc TokenizeString(PredictOptions) returns (TokenizationResponse) {}
2525
rpc Status(HealthMessage) returns (StatusResponse) {}
2626
rpc Detect(DetectOptions) returns (DetectResponse) {}
27+
rpc Depth(DepthRequest) returns (DepthResponse) {}
2728
rpc FaceVerify(FaceVerifyRequest) returns (FaceVerifyResponse) {}
2829
rpc FaceAnalyze(FaceAnalyzeRequest) returns (FaceAnalyzeResponse) {}
2930
rpc VoiceVerify(VoiceVerifyRequest) returns (VoiceVerifyResponse) {}
@@ -670,6 +671,35 @@ message DetectResponse {
670671
repeated Detection Detections = 1;
671672
}
672673

674+
// --- Depth estimation messages (Depth Anything 3) ---
675+
676+
message DepthRequest {
677+
string src = 1; // input image (filesystem path or base64-encoded payload)
678+
string dst = 2; // optional output directory for exports (glb/colmap)
679+
bool include_depth = 3; // return the per-pixel metric depth map
680+
bool include_confidence = 4; // return the per-pixel confidence map (DualDPT)
681+
bool include_pose = 5; // return camera extrinsics/intrinsics (DualDPT)
682+
bool include_sky = 6; // return the per-pixel sky map (mono models)
683+
bool include_points = 7; // back-project to a 3D point cloud (DualDPT)
684+
float points_conf_thresh = 8; // keep points with confidence >= this threshold
685+
repeated string exports = 9; // requested exports: "glb", "colmap"
686+
}
687+
688+
message DepthResponse {
689+
int32 width = 1; // processed depth-map width
690+
int32 height = 2; // processed depth-map height
691+
repeated float depth = 3; // width*height row-major metric depth
692+
repeated float confidence = 4; // width*height row-major confidence (DualDPT)
693+
repeated float sky = 5; // width*height row-major sky map (mono)
694+
repeated float extrinsics = 6; // 12 floats, 3x4 row-major (world-to-camera)
695+
repeated float intrinsics = 7; // 9 floats, 3x3 row-major
696+
int32 num_points = 8; // number of 3D points
697+
repeated float points = 9; // num_points*3 xyz, world space
698+
bytes point_colors = 10; // num_points*3 uint8 rgb
699+
repeated string export_paths = 11; // paths written for the requested exports
700+
bool is_metric = 12; // depth is in metric units
701+
}
702+
673703
// --- Face recognition messages ---
674704

675705
message FacialArea {
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
sources/
2+
build*/
3+
package/
4+
libdepthanythingcpp*.so
5+
depth-anything-cpp
6+
test-models/
7+
test-data/
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
cmake_minimum_required(VERSION 3.18)
2+
project(libdepthanythingcpp LANGUAGES C CXX)
3+
4+
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
5+
set(CMAKE_CXX_STANDARD 17)
6+
set(CMAKE_CXX_STANDARD_REQUIRED ON)
7+
8+
# Static-link ggml into the depth-anything shared library so the resulting .so
9+
# has no runtime dependency on an external libggml — only on
10+
# libc/libstdc++/libgomp, which the LocalAI package step bundles into the
11+
# docker image.
12+
set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build static libraries" FORCE)
13+
14+
# depth-anything.cpp build switches: skip CLI/tests, but build libdepthanything
15+
# itself as a SHARED library (DA_SHARED) while ggml stays static
16+
# (BUILD_SHARED_LIBS OFF above). The da_capi_* C ABI is compiled into
17+
# src/da_capi.cpp and re-exported by that shared library, so no extra MODULE
18+
# wrapper is needed (unlike locate-anything.cpp).
19+
set(DA_BUILD_CLI OFF CACHE BOOL "Disable depth-anything CLI" FORCE)
20+
set(DA_BUILD_TESTS OFF CACHE BOOL "Disable depth-anything tests" FORCE)
21+
set(DA_SHARED ON CACHE BOOL "Build libdepthanything as a shared lib" FORCE)
22+
23+
add_subdirectory(./sources/depth-anything.cpp)
24+
25+
# Emit libdepthanything.so into the top-level build dir so the Makefile can
26+
# rename it to the per-variant libdepthanythingcpp-<variant>.so.
27+
set_target_properties(depthanything PROPERTIES
28+
LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR})

0 commit comments

Comments
 (0)