Depth Anything V3 Mono Large - ONNX

Performance-optimized ONNX build of Depth Anything V3 Mono Large - the monocular-specialized member of the Depth Anything V3 family - for real-time stereo and disparity workflows. The output is a ready-to-use disparity map (near = bright, far = dark, skies correctly at far) matching Depth Anything V2's convention - no postprocessing required. One file serves five input resolutions (1036², 728², 518², 364², 252²).

See it in action: Oku3D Media Player uses this model to convert any 2D video or photo into immersive 3D for autostereoscopic and lenticular displays - "Watch everything in 3D."

Key Features

  • Sky-aware inverse disparity: computes true inverse disparity 1/(depth + 0.2) and composites the model's own sky-segmentation head into the graph, so skies and far backgrounds separate cleanly from foreground silhouettes - baked directly into a single ONNX output, no runtime postprocessing needed.
  • Disparity-ready output: near = high / far = low. Drop-in replacement for Depth Anything V2 in stereo / disparity pipelines without any postprocessing changes.
  • Single-output ONNX: the upstream model emits a multi-tensor dict (depth, confidence, sky, optional camera params); this build folds everything into one disparity tensor for clean integration.
  • FP16 weights: optimized for GPU acceleration via DirectML for faster inference.
  • Five resolutions in one file: 1036×1036, 728×728, 518×518, 364×364 and 252×252.
  • Opset 21: modern ONNX operators for broader runtime optimization support.
  • Aggressive graph optimization: operator fusion and constant folding for maximum inference speed.

Despite the ViT-L/14 backbone, DA3MONO-LARGE is Apache-2.0 - free for commercial use. And it is not just "DA3 in large": it's a distinct model specialized for monocular depth (the regular multi-view DA3 line is optimized for a different task and costs mono quality) with its own sky-segmentation head.

Technical Specifications

Property Value
Input shape (1, 3, S, S) NCHW, S ∈ {1036, 728, 518, 364, 252} - exactly these, no other resolutions
Input dtype float16
Input range ImageNet-normalized RGB (mean [0.485, 0.456, 0.406], std [0.229, 0.224, 0.225])
Output shape (1, 1, S, S)
Output dtype float16
Output range [0, 5] disparity (higher = closer, sky/far = 0)
Symbolic dim names height, width (pin them via ORT free-dimension overrides for best DirectML performance)
Batch size fixed at 1
Opset 21
Unsupported input size returns a (1, 1, 1, 1) NaN tensor instead of a depth map

Requirements

  • VRAM: 0.7-1.2 GB at 518 and below, 1.7 GB at 728, 4.7 GB at 1036
  • ONNX Runtime: 1.19.0 or higher
  • Python: 3.8 or higher

Quick Start

pip install onnxruntime-directml numpy opencv-python
import cv2
import numpy as np
import onnxruntime as ort

# One of the five supported input sizes: 1036, 728, 518, 364, 252.
SIZE = 518

# Load model. Pinning the symbolic dims is optional but recommended for
# DirectML: it lets the kernels specialize for the exact tensor sizes.
opts = ort.SessionOptions()
opts.add_free_dimension_override_by_name('height', SIZE)
opts.add_free_dimension_override_by_name('width', SIZE)
session = ort.InferenceSession(
    'da-v3-mono-large_fp16_opset21_optimized.onnx',
    opts,
    providers=['DmlExecutionProvider', 'CPUExecutionProvider'],
)
input_name = session.get_inputs()[0].name
output_name = session.get_outputs()[0].name

# Load & preprocess (ImageNet-normalized RGB, NCHW float16)
img = cv2.cvtColor(cv2.imread('examples/sample1/source.jpg'), cv2.COLOR_BGR2RGB)
img = cv2.resize(img, (SIZE, SIZE))
arr = img.astype(np.float32) / 255.0
arr = (arr - [0.485, 0.456, 0.406]) / [0.229, 0.224, 0.225]
arr = np.transpose(arr, (2, 0, 1))[np.newaxis].astype(np.float16)

# Inference
disparity = session.run([output_name], {input_name: arr})[0].squeeze().astype(np.float32)

# Clip extreme values and normalize to [0, 1]
disparity = np.clip(np.nan_to_num(disparity, nan=0.0), -1e3, 1e3)
disparity_norm = (disparity - disparity.min()) / max(disparity.max() - disparity.min(), 1e-6)

# Save 8-bit PNG (near = bright, far = dark - already disparity-ready)
cv2.imwrite('disparity.png', (disparity_norm * 255).round().astype(np.uint8))

# Or 16-bit TIFF for higher precision
cv2.imwrite(
    'disparity.tif',
    (disparity_norm * 65535).round().astype(np.uint16),
    [cv2.IMWRITE_TIFF_COMPRESSION, cv2.IMWRITE_TIFF_COMPRESSION_DEFLATE],
)

Performance

Benchmarked on an AMD Radeon RX 7900 XTX using ONNX Runtime 1.23 with DirectML: FP16, batch size 1, free-dimension overrides pinned to the tested resolution. All five rows are the same 656 MB file.

Resolution Frame rate Latency VRAM
1036×1036 1.3 fps 791 ms/frame 4.7 GB
728×728 5.0 fps 201 ms/frame 1.7 GB
518×518 16.9 fps 59.1 ms/frame 1.2 GB
364×364 35.1 fps 28.5 ms/frame 0.9 GB
252×252 67.2 fps 14.9 ms/frame 0.7 GB

Comparison: Quality

Side-by-side plasma renders against the strongest variant of each earlier depth-model generation. Plasma convention is uniform (yellow = near, dark = far); every model in the table emits this convention natively. The four reference samples are deliberately shared with the sister repo Jens-Duttke/DepthPro-ONNX-HighPerf so cross-model comparisons are direct.

Model
This Model - DA V3 Mono Large (1036, fp16)
This Model - DA V3 Mono Large (728, fp16)
This Model - DA V3 Mono Large (518, fp16)
This Model - DA V3 Mono Large (364, fp16)
This Model - DA V3 Mono Large (252, fp16)
DA V2 Large (518, q4f16)
DA V2 Base (518, fp16)
DA V2 Small (518, fp16)
DA V1 Base (518, q4f16)
MiDaS DPT-Hybrid (384, q4f16)

This repo's rows (1036 / 728 / 518 / 364 / 252) are all rendered from the same ONNX file; every other model was run at its native input resolution with its own preprocessing.

License

This ONNX build is licensed under the Apache License 2.0; the underlying weights inherit the upstream Depth Anything V3 Mono Large license, which is also Apache 2.0. Commercial use, product integration, and service deployment are permitted. This repository is an independent ONNX redistribution and is not affiliated with or endorsed by the upstream Depth Anything 3 authors.

Acknowledgements

Downloads last month
-
Inference Providers NEW
This model isn't deployed by any Inference Provider. 🙋 Ask for provider support

Model tree for Jens-Duttke/Depth-Anything-3-MONO-ONNX

Quantized
(2)
this model