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. Each build serves five input resolutions (1036², 728², 518², 364², 252²).
[!TIP]
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 or 4-bit weights: two builds of the same model, see Files below.
Five resolutions per 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
returns a (1, 1, 1, 1) NaN tensor instead of a depth map
Files
Two builds. Same five resolutions, same input and output convention - they differ only in how
the weights are stored:
File
Weights
Size
da-v3-mono-large_fp16_opset21_optimized.onnx
FP16
656 MB
da-v3-mono-large_q4f16_opset21_optimized.onnx
4-bit, FP16 activations
336 MB
In the q4f16 build the matrix multiplications that carry the model's weights are stored at 4
bits per value (block size 128); activations, the decoder convolutions and the position
embeddings stay FP16. It needs roughly half the VRAM, and at the small resolutions it is also
faster, because those are limited by memory bandwidth rather than by compute. Its output
differs from the FP16 build by less than 0.8% of the disparity range at every resolution.
Requirements
VRAM: see the table below - 0.4 GB at the low end, 1.7 GB at 1036
ONNX Runtime: 1.19.0 or higher (1.22+ for the q4f16 build, which uses MatMulNBits)
1import cv2
2import numpy as np
3import onnxruntime as ort
45# One of the five supported input sizes: 1036, 728, 518, 364, 252.6SIZE =51878# Load model. The symbolic dims stay free here - see "Free-dimension9# overrides" below before pinning them.10session = ort.InferenceSession(11'da-v3-mono-large_fp16_opset21_optimized.onnx',# or ..._q4f16_...12 providers=['DmlExecutionProvider','CPUExecutionProvider'],13)14input_name = session.get_inputs()[0].name
15output_name = session.get_outputs()[0].name
1617# Load & preprocess (ImageNet-normalized RGB, NCHW float16)18img = cv2.cvtColor(cv2.imread('examples/sample1/source.jpg'), cv2.COLOR_BGR2RGB)19img = cv2.resize(img,(SIZE, SIZE))20arr = img.astype(np.float32)/255.021arr =(arr -[0.485,0.456,0.406])/[0.229,0.224,0.225]22arr = np.transpose(arr,(2,0,1))[np.newaxis].astype(np.float16)2324# Inference25disparity = session.run([output_name],{input_name: arr})[0].squeeze().astype(np.float32)2627# Clip extreme values and normalize to [0, 1]28disparity = np.clip(np.nan_to_num(disparity, nan=0.0),-1e3,1e3)29disparity_norm =(disparity - disparity.min())/max(disparity.max()- disparity.min(),1e-6)3031# Save 8-bit PNG (near = bright, far = dark - already disparity-ready)32cv2.imwrite('disparity.png',(disparity_norm *255).round().astype(np.uint8))3334# Or 16-bit TIFF for higher precision35cv2.imwrite(36'disparity.tif',37(disparity_norm *65535).round().astype(np.uint16),38[cv2.IMWRITE_TIFF_COMPRESSION, cv2.IMWRITE_TIFF_COMPRESSION_DEFLATE],39)
Free-dimension overrides
Pinning height and width to the resolution you feed lets ONNX Runtime resolve the If
dispatch at session build instead of per inference. It is worth 1-2% and is never required.
Do not pin them on ONNX Runtime 1.24 through 1.27. Every branch of the dispatch carries its
own fixed shape, so a concrete outer shape contradicts four of the five, and these versions
neither reject that nor confine themselves to the branch that matches. Measured on this file:
ONNX Runtime
Pinned to a supported resolution
1.23
correct, matches the symbolic run
1.24.4
access violation while building the session (CPU EP), or a constant depth map (DirectML)
1.25.1, 1.26.0, 1.27.0
builds and runs, returns a silently wrong depth map
1.28.0
correct, matches the symbolic run
Left symbolic, the file is correct on every version tested, and that is how the example renders
in this repository were produced.
Performance
Benchmarked on an AMD Radeon RX 7900 XTX using ONNX Runtime 1.23 with DirectML: batch size 1,
free-dimension overrides pinned to the tested resolution.
Resolution
fp16
fp16 VRAM
q4f16
q4f16 VRAM
1036×1036
6.9 fps
1.7 GB
6.7 fps
1.4 GB
728×728
16.4 fps
1.2 GB
15.9 fps
0.9 GB
518×518
31.7 fps
0.9 GB
33.7 fps
0.6 GB
364×364
58.9 fps
0.8 GB
63.4 fps
0.5 GB
252×252
88.6 fps
0.7 GB
101.3 fps
0.4 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.
Each resolution appears twice, once per build. The q4f16 renders are there to be checked rather than taken on trust - click any pair and compare them at full size. 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
Depth Anything 3 by ByteDance Seed - the upstream model and weights.