localai-org/depth-anything.cpp

A from-scratch C++17/ggml port of Depth Anything 2 and 3 (ByteDance)

What it solves

depth-anything.cpp is a high-performance, dependency-free C++ port of the Depth Anything 3 (DA3) and Depth Anything V2 models. It removes the need for a heavy Python, PyTorch, or CUDA toolkit stack during inference, allowing these models to run efficiently on a wider range of hardware, including CPUs without GPUs.

How it works

The project uses the ggml library to implement a from-scratch C++17 port of the DA3 architecture. It converts official checkpoints into a self-contained GGUF file format that stores all hyperparameters and preprocessing constants. This allows the loader to run inference without external configuration files. The engine supports quantization (f16, q8_0, q4_k, etc.) to reduce memory usage and model size, and provides a flat C API for easy embedding into other languages like Go or Rust.

Who it’s for

  • Developers who want to embed depth estimation models into native applications without Python dependencies.
  • Users running AI on consumer-grade CPUs or hardware without dedicated GPUs.
  • 3D Reconstructionists who need fast, metric depth and camera pose estimation from single or multiple images.

Highlights

  • Performance: Faster than PyTorch on CPU (up to 1.31x) with significantly lower memory overhead and faster load times.
  • Comprehensive Output: Generates dense metric depth maps, per-pixel confidence, camera extrinsics/intrinsics, sky masks, and 3D point clouds.
  • Broad Model Support: Compatible with the full DA3 family (Small, Base, Large, Giant, Mono, Metric, Nested) and Depth Anything V2.
  • Export Formats: Native, dependency-free export to .glb, COLMAP, and .PLY formats.
  • Hardware Agnostic: Optimized for CPU (via tinyBLAS, Winograd) and supports CUDA, Metal, and Vulkan backends.

Related

  • Project
  • Project
  • Project
  • Project
  • Project