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.