EfficientViT-Depth-5M-int8
INT8 QDQ version of EfficientViT-Depth-5M: a 4.85M-parameter relative-depth model with an EfficientViT-M2 encoder and a Lite-DPT decoder.
This is an independent community model, not an official Depth Anything release. The float parent was distilled from Depth Anything V2 Small; this repository contains the quantized ONNX graph.
Float vs INT8 size/quality comparison.
NYUv2 indoor scene; float vs INT8 at 336×448.
Qualitative examples on ADE20K/NYUv2 scenes; per-row color scale.
Highlights
- 3.48 MB static ONNX, down from 9.84 MB float
- 0.8319 NYU-654 δ1 at 336×448
- 0.6729 teacher-fidelity δ1 on 700 held-out images
- 24.9 ms / 40.1 FPS on CPU with ONNX Runtime, 8 threads, 336×448
- Static 336×448 graph only
Comparison
All quality numbers are at 336×448 on the 654-image NYUv2 Eigen test split.
| model | params | disk | NYU-654 δ1 | teacher fidelity δ1 | CPU latency |
|---|---|---|---|---|---|
| Depth Anything V2 Small | 24.79M | 99.06 MB | 0.9213 | 1.000 | — |
| Depth Anything V2 Tiny (8-layer) | 16.50M | 66.04 MB | 0.8936 | 0.8976 | — |
| EfficientViT-Depth-5M float | 4.85M | 9.84 MB | 0.8546 | 0.7242 | 12.1 ms / 82.5 FPS |
| EfficientViT-Depth-5M INT8 | 4.85M | 3.48 MB | 0.8319 | 0.6729 | 24.9 ms / 40.1 FPS |
| EfficientViT-Depth-5M 4-bit (experimental) | 4.85M | 2.31 MB | 0.6456 | 0.4260 | — |
This INT8 model is 35.4% of the float parent’s size and 94.7% smaller than the 8-layer Tiny, but it loses 2.27 NYU δ1 points and 5.13 fidelity δ1 points relative to the float parent. It also runs about 2× slower than the float ONNX graph on this CPU because QDQ overhead dominates on a small convolutional network.
Why not 4-bit?
Direct ONNX 4-bit QDQ was tested and rejected:
| variant | size | NYU-654 δ1 | fidelity δ1 |
|---|---|---|---|
| INT8 QDQ (shipped) | 3.48 MB | 0.8319 | 0.6729 |
| 4-bit weights + int8 activations | 2.31 MB | 0.6456 | 0.4260 |
| 4-bit weights + int16 activations | 2.31 MB | ~0.66 (100-image) | ~0.41 (50-image) |
The model is roughly 95% convolutional. ONNX Runtime’s 4-bit path is MatMul-oriented; direct 4-bit convolution QDQ collapses edge and detail quality. A true 4-bit compact model would require 4-bit-aware QAT or a runtime/NPU with native 4-bit convolution support. The valid quantized artifact is this INT8 model.
Quantization
| setting | value |
|---|---|
| format | ONNX QDQ |
| weights | INT8, per-channel |
| activations | INT8 |
| calibration | MinMax, 256 stratified images |
| input | static 1×3×336×448 |
| output | static 1×336×448 inverse depth |
Metrics
NYUv2 Eigen-654, 336×448
| metric | value |
|---|---|
| δ1 | 0.831850 |
| AbsRel | 0.136737 |
| RMSE | 0.084210 |
Teacher fidelity, 700 held-out images
| metric | value |
|---|---|
| δ1 | 0.672902 |
| AbsRel | 0.368645 |
| Pearson | 0.892266 |
| gradient corr | 0.365290 |
The float parent scores 0.854563 / 0.724169 on the same protocol.
Usage
pip install -r requirements.txt
python example.py --image photo.jpg --output depth_int8.png
The graph is static at 336×448. Resize the RGB image to exactly that size, apply ImageNet normalization, and run:
import numpy as np
from PIL import Image
import onnxruntime as ort
mean = np.array([0.485, 0.456, 0.406], dtype=np.float32)
std = np.array([0.229, 0.224, 0.225], dtype=np.float32)
image = Image.open("photo.jpg").convert("RGB").resize((448, 336), Image.Resampling.BICUBIC)
x = np.asarray(image, dtype=np.float32) / 255.0
x = (x - mean) / std
x = np.transpose(x, (2, 0, 1))[None].astype(np.float32)
session = ort.InferenceSession("efficientvit_depth_5m_int8.onnx", providers=["CPUExecutionProvider"])
depth = session.run(None, {session.get_inputs()[0].name: x})[0][0]
# inverse depth: higher = closer; not metric depth
For non-336×448 inputs use the dynamic float graph in the parent repository, or re-export this model at the target resolution.
When to use this model
Use INT8 when 3.48 MB is the hard constraint or the target runtime has a native INT8 path that actually accelerates it.
Use the float parent when:
- CPU latency matters (12.1 ms vs 24.9 ms here),
- detail/fidelity matters (0.8546 vs 0.8319 NYU δ1),
- you need dynamic resolution.
Limitations
- Relative inverse depth only; no metric scale.
- Static 336×448; no dynamic shape.
- Fine structures and thin objects are weaker than the float model.
- CPU QDQ can be slower than float; benchmark the target runtime before selecting it.
- Not an official Depth Anything release and not affiliated with its authors.
Files
| file | description |
|---|---|
efficientvit_depth_5m_int8.onnx |
static 336×448 INT8 QDQ ONNX |
config.json |
architecture and quantization metadata |
preprocessor_config.json |
resize/normalization metadata |
metrics.json |
full metrics and artifact hash |
example.py |
ONNX Runtime example |
comparison.png |
quality and size comparison |
example.png |
float vs INT8 example on an indoor scene |
examples.png |
five-scene qualitative gallery |
checksums.txt |
SHA256 checksums |
License
Apache-2.0. See LICENSE and NOTICE. The float parent and teacher are also Apache-2.0.
Contact
Petros Fanioudakis — @Petrouil