Monocular depth estimation (MDE) has advanced rapidly with the emergence of foundation models such as Depth Anything. Their transformer-based architectures provide strong generalization across diverse scenes and domains, but also incur high computational and memory cost, making efficient deployment challenging. Post-Training Quantization (PTQ) provides an efficient and practical solution for model compression, yet low-bit PTQ remains challenging for MDE models. When applying PTQ to Depth Anything, we identify two key challenges: (i) independently minimizing the quantization error of the query and key projections fails to preserve the attention maps induced by their interaction, and (ii) quantization errors accumulate across layers, resulting in intermediate feature distribution shifts. To address these issues, we propose SPA-Q, a Structure-Preserving Adaptive PTQ framework for MDE, consisting of two main components. First, Attention-Preserving Calibration (APC) determines query and key quantization parameters by matching the full-precision attention distribution. Second, Channel-Wise Distribution Alignment (CWDA) learns channel-wise affine transformations to mitigate quantization-induced distribution shifts, and the learned parameters are absorbed into the weights after training. Experimental results show that SPA-Q consistently outperforms existing PTQ methods under 4-bit quantization, achieving an average 25.9% reduction in AbsRel and a 17.3% improvement in δ1 across NYUv2 and KITTI datasets.
Figures & tables
Figure 1: Comparison of calibration objectives for query-key quantization, where all improvements are measured relative to conventional local quantization error minimization. (a) MSE improvement from logits-level calibration. (b) Attention-level metric improvement from logits-level calibration. (c) Attention-level metric improvement from the proposed APC.
Figure 2: Quantization-induced distortion in intermediate features under 4-bit quantization (W4A4). (a) Distribution shift in intermediate features caused by accumulated quantization errors across layers. (b) Distortion of intermediate feature maps under W4A4, as illustrated by comparisons of patch norms with the full-precision model.
Figure 3: Overview of the SPA-Q framework. SPA-Q first applies Attention-Preserving Calibration (APC) to determine query and key quantization parameters by minimizing the row-wise KL divergence between full-precision and quantized attention maps. It then applies Channel-Wise Distribution Alignment (CWDA), where learnable affine parameters align quantized intermediate features with their full-precision counterparts using stage-wise feature maps from the transformer encoder and the depth prediction from the decoder. After optimization, the learned affine parameters are fused into the weights, introducing no additional inference overhead.
Dataset
Method
W/A
Depth Anything v1
Depth Anything v2
E. ViT-S
E. ViT-B
E. ViT-S
E. ViT-B
AbsRel ↓
δ1↑
AbsRel ↓
δ1↑
AbsRel ↓
δ1↑
AbsRel ↓
δ1↑
NYUv2
FP
32/32
0.0525
0.9720
0.0459
0.9791
0.0513
0.9736
0.0460
0.9770
BRECQ [ 25 ]
4/4
0.2535
0.5395
0.2886
0.4692
0.2714
0.5042
0.2910
0.4646
QDrop [ 26 ]
4/4
0.1742
0.7166
0.2334
0.5785
0.1773
0.7115
0.2332
0.5794
RepQ-ViT [ 27 ]
4/4
0.1959
0.6639
0.2539
0.5410
0.2053
0.6385
0.2417
0.5634
Table 1: Comparison of PTQ methods on NYUv2 [ 36 ] , KITTI [ 37 ] , ETH3D [ 38 ] , DIODE [ 39 ] , and Sintel [ 40 ] for zero-shot relative depth estimation under 4-bit quantization. E. denotes the encoder backbone used in the MDE architectures.
Figure 4: Qualitative comparison of 4-bit quantization results for Depth Anything with a ViT-S backbone on benchmarks: NYUv2 [ 36 ] , KITTI [ 37 ] , ETH3D [ 38 ] , DIODE [ 39 ] , and Sintel [ 40 ] .
Figure 5: Block-wise feature analysis under 4-bit quantization for Depth Anything v1 [ 14 ] with a ViT-B backbone across transformer blocks. (a) Mean squared error (MSE) between full-precision and quantized features. (b) Cosine similarity between full-precision and quantized features.
Table 7
Appendix figures & tables10 assets
Supplementary material from the paper’s appendix.
Appendix
Dataset
Method
W/A
Depth Anything v1
Depth Anything v2
E. ViT-S
E. ViT-B
E. ViT-S
E. ViT-B
AbsRel ↓
δ1↑
AbsRel ↓
δ1↑
AbsRel ↓
δ1↑
AbsRel ↓
δ1↑
NYUv2
FP
32/32
0.0525
0.9720
0.0459
0.9791
0.0513
0.9736
0.0460
0.9770
MinMax [ 16 ]
4/4
0.2728
0.5024
1.5735
0.1972
0.2815
0.4873
2.3712
0.1102
Percentile [ 41 ]
4/4
0.2006
0.6542
0.2522
0.5430
0.1935
0.6675
0.2543
0.5379
BRECQ [ 25 ]
4/4
0.2535
0.5395
0.2886
0.4692
0.2714
0.5042
0.2910
0.4646
Appendix
Table 4: Extended comparison with additional PTQ baselines on NYUv2 [ 36 ] and KITTI [ 37 ] for zero-shot relative depth estimation under 4-bit quantization. E. denotes the encoder backbone used in the MDE architectures.
Dataset
Method
W/A
Depth Anything v1
Depth Anything v2
E. ViT-S
E. ViT-B
E. ViT-S
E. ViT-B
AbsRel ↓
δ1↑
AbsRel ↓
δ1↑
AbsRel ↓
δ1↑
AbsRel ↓
δ1↑
NYUv2
FP
32/32
0.0525
0.9720
0.0459
0.9791
0.0513
0.9736
0.0460
0.9770
MinMax [ 16 ]
4/6
0.2417
0.5632
0.2748
0.4973
0.2599
0.5324
0.2866
0.4738
Percentile [ 41 ]
4/6
0.1050
0.8837
0.0958
0.9071
0.0891
0.9196
0.0831
0.9355
BRECQ [ 25 ]
4/6
0.2337
0.5786
0.2462
0.5542
0.2611
0.5269
0.2697
0.5084
Appendix
Table 5: Extended comparison with additional PTQ baselines on NYUv2 [ 36 ] and KITTI [ 37 ] for zero-shot relative depth estimation under W4A6 and W4A8 quantization. E. denotes the encoder backbone used in the MDE architectures.
Dataset
Method
W/A
MiDaS-BEiT-B-384
DPT-L-384
ZoeDepth (Metric)
AbsRel ↓
δ1↑
AbsRel ↓
δ1↑
AbsRel ↓
δ1↑
NYUv2
FP
32/32
0.0663
0.9568
0.0947
0.9112
0.0755
0.9544
RepQ-ViT [ 27 ]
4/4
0.2603
0.5254
0.1394
0.8139
0.4949
0.1033
QSCA [ 33 ]
4/4
0.2253
0.5998
0.1380
0.8192
0.3969
0.2054
SPA-Q (Ours)
4/4
0.1803
0.7081
0.1276
0.8425
0.3051
0.3894
KITTI
FP
32/32
0.1928
0.7076
0.1079
0.8858
0.0589
0.9664
Appendix
Table 6: Comparison of PTQ methods on NYUv2 [ 36 ] and KITTI [ 37 ] with additional MDE architectures, MiDaS-BEiT-B-384 [ 13 ] , DPT-L-384 [ 31 ] , and ZoeDepth [ 30 ] , under 4-bit quantization.
Table 7: Comparison of edge, boundary, and planarity metrics for Depth Anything v1 [ 14 ] under W4A4 and W4A6 quantization. Edge F1 [ 44 ] , Boundary F1 [ 45 ] , and ORD [ 46 ] are evaluated on NYUv2 [ 36 ] , and planarity errors (PE) are evaluated on iBims-1 [ 47 ] .
Figure 6: Block-wise feature similarity analysis under 4-bit quantization on Depth Anything v1. (a) and (b) show results on NYUv2 [ 36 ] and KITTI [ 37 ] . We compare the MSE and cosine similarity between full-precision and quantized encoder features across transformer blocks.
Figure 7: Block-wise feature similarity analysis under 4-bit quantization on Depth Anything v2. (a) and (b) show results on NYUv2 [ 36 ] and KITTI [ 37 ] . We compare the MSE and cosine similarity between full-precision and quantized encoder features across transformer blocks.
Figure 8: Feature map visualization for Depth Anything v2 with a ViT-S backbone on NYUv2 [ 36 ] under 4-bit quantization. We compare the full-precision model, W4A4 quantization, and SPA-Q.
Figure 9: Feature map visualization for Depth Anything v1 with a ViT-B backbone on NYUv2 [ 36 ] under 4-bit quantization. We compare the full-precision model, W4A4 quantization, and SPA-Q.
Figure 10: Feature map visualization for Depth Anything v2 with a ViT-S backbone on KITTI [ 37 ] under 4-bit quantization. We compare the full-precision model, W4A4 quantization, and SPA-Q.
Figure 11: Feature map visualization for Depth Anything v1 with a ViT-B backbone on KITTI [ 37 ] under 4-bit quantization. We compare the full-precision model, W4A4 quantization, and SPA-Q.
Monocular depth estimation has seen remarkable progress through foundation models achieving robust zero-shot generalization, yet their computational demands place them far beyond the reach of embedded and mobile platforms. Lightweight alternatives exist, but have been developed almost exclusively within single-domain, self-supervised paradigms, failing silently under domain shift. We present ZipDepth, a compact monocular depth network that bridges this gap by combining an efficient reparameterizable encoder-decoder with large-scale knowledge distillation from a foundation model over a large multi-domain training set. Comprising just 6.1M parameters, ZipDepth runs at real-time rates from server GPUs to power-constrained devices, achieving the best trade-off between zero-shot accuracy and deployment efficiency among lightweight models across five benchmarks, taking a significant step towards the accuracy of foundation models with 50x more parameters.
We propose DepthTCM, a physics-aware end-to-end framework for depth map compression. In our framework of DepthTCM, the high-bit depth map is first converted to a conventional 3-channel image representation losslessly using a method inspired by a physical sinusoidal fringe pattern based profiliometry system, then the 3-channel color image is encoded and decoded by a recently developed Transformer-CNN mixed neural network architecture. Specifically, DepthTCM maps depth to a smooth 3-channel using multiwavelength depth (MWD) encoding, then globally quantized the MWD encoded representation to 4 bits per channel to reduce entropy, and finally is compressed using a learned codec that combines convolutional and Transformer layers. Experiment results demonstrate the advantage of our proposed method. On Middlebury 2014, DepthTCM reaches 0.307 bpp while preserving 99.38% accuracy, a level of fidelity commensurate with lossless PNG. We additionally demonstrate practical efficiency and scalability, reporting average end-to-end inference times of 41.48 ms (encoder) and 47.45 ms (decoder) on the ScanNet++ iPhone RGB-D subset. Ablations validate our design choices: relative to 8-bit quantization, 4-bit quantization reduces bitrate by 66% while maintaining comparable reconstruction quality, with only a marginal 0.68 dB PSNR change and a 0.04% accuracy difference. In addition, Transformer--CNN blocks further improve PSNR by up to 0.75 dB over CNN-only architectures.
Monocular depth estimation (MDE) has emerged as a cost-effective alternative to hardware-dependent 3D sensing modalities, yet predicting precise metric depth remains a persistent challenge due to intrinsic scale ambiguity, edge bleeding, and limited zero-shot generalization in unseen environments. Recent multi-modal approaches incorporate 1D/3D Single-Photon Avalanche Diode (SPAD) data to resolve these ambiguities, but they mainly treat SPAD noise as a harmful artifact required for denoising or leave the noise ignored. In this paper, we present an essentially different insight: native SPAD noise is an informative prior that implicitly encodes deterministic environmental characteristics. Driven by this paradigm shift, we introduce a novel, lightweight Test-Time Gated Attention framework by Harnessing SPAD Noise, therefore dubbed HSN. Tailored for indoor scenarios, HSN leverages the synergistic combination of 1D SPAD histograms and Gate Adapters (GAs). Through three complementary optimization phases, it generates channel-wise gated attention vectors to dynamically adjust encoder feature maps at inference time, effectively resolving ambiguous scale and boundary challenges without the heavy computational overhead or dense 3D modalities that other TTA methods suffer from. Extensive experiments on challenging real-world indoor benchmarks show that HSN achieves state-of-the-art metric depth accuracy in in-domain settings, while exhibiting even greater potential under zero-shot generalization to unfamiliar environments. Furthermore, interpretability analysis reveals that the proposed gated attention mechanism adaptively shifts attention toward deeper semantic layers under intensifying SPAD noise. Code will be made publicly available.