Depth Anything V1 - ONNX (FP16)

FP16 ONNX exports of the two smaller Depth Anything V1 checkpoints, built for Oku3D's depth registry and usable by any ONNX Runtime consumer.

file base checkpoint size
da-v1-small_fp16_opset20_optimized.onnx LiheYoung/depth-anything-small-hf 48 MB
da-v1-base_fp16_opset20_optimized.onnx LiheYoung/depth-anything-base-hf 187 MB

Interface

input   pixel_values     float32  [1, 3, height, width]
output  predicted_depth  float32  [1, 14*(height//14), 14*(width//14)]

height and width are free and take any multiple of the patch size 14; the batch axis is fixed at 1. Feed ImageNet-normalized RGB (mean [0.485, 0.456, 0.406], std [0.229, 0.224, 0.225]). The output is relative disparity, near = high, which is the Depth Anything convention and needs no inversion for stereo warping.

Weights are FP16 while the boundary stays FP32, so a consumer hands over what it already has and the casts live inside the graph.

Accuracy

Mean absolute deviation from the PyTorch checkpoint at 518 px over the four example images, as a percentage of the reference map's own depth spread:

this export the 4-bit conversion it replaces
small 0.05 % 2.54 %
base 0.04 % 1.37 %

Throughput

GeForce RTX 5070 Ti, ONNX Runtime 1.24.4 on DirectML, free dimensions pinned per resolution, fastest of 20 runs on a fresh session (2026-09-21):

252 364 518
small 2.0 ms 3.3 ms 7.0 ms
base 2.9 ms 5.5 ms 15.6 ms

Pinning matters: the same graph with free dimensions left open runs on generic kernels and loses a large part of this.

Usage

import numpy as np, onnxruntime as ort

edge = 518
options = ort.SessionOptions()
for name in ("height", "width"):
    options.add_free_dimension_override_by_name(name, edge)

session = ort.InferenceSession(
    "da-v1-small_fp16_opset20_optimized.onnx", options,
    providers=["DmlExecutionProvider", "CPUExecutionProvider"],
)
disparity = session.run(None, {"pixel_values": tensor})[0]  # [1, edge, edge]

License

Apache-2.0, inherited from the checkpoints; see LICENSE. Upstream: Depth Anything, Yang et al., CVPR 2024.

Core ML build for macOS

The coreml/ folder holds this model rewritten so ONNX Runtime's Core ML execution provider takes the whole graph on a Mac - Neural Engine, GPU and CPU - instead of handing parts of it to the CPU. Oku3D uses it on macOS. Core ML runs only standard ONNX operators, in float16, so:

  • coreml/da-v1-small_fp16_opset20_coreml.onnx: FastGelu expanded into Add and Gelu.
  • coreml/da-v1-base_fp16_opset20_coreml.onnx: FastGelu expanded into Add and Gelu; normalization inputs past float16's range scaled down.

The weights are this repository's; only the graph around them changes. Checked against the original model on ONNX Runtime's CPU provider, the depth maps agree at a correlation of 0.9999 or better. Same license as the rest of this repository.

Downloads last month

-

Downloads are not tracked for this model. How to track
Inference Providers NEW
This model isn't deployed by any Inference Provider. ๐Ÿ™‹ Ask for provider support

Model tree for Jens-Duttke/Depth-Anything-1-ONNX

Quantized
(2)
this model