Depth Anything V2 Small optimized for Arm-based mobile CPUs with SME2
An INT8-quantized version of Depth Anything V2 Small for monocular depth estimation, exported to ExecuTorch (.pte) and optimized for Arm-based mobile CPUs with SME2.
Summary
This repository contains an Arm-optimized version of Depth Anything V2 Small for monocular depth estimation, quantized to INT8 via static post-training quantization (PTQ) with per-channel symmetric weights and per-tensor symmetric activations. The model is provided in ExecuTorch (.pte) format, targeting Mobile CPU systems.
This version is intended to demonstrate efficient inference on Arm-based platforms while preserving the original model's intended behavior. Arm evaluated the model and measured the published performance and memory results on a representative evaluation target. The included Python example and locked uv environment target a Linux arm64 host; the representative evaluation target measurements must not be interpreted as Linux host performance results.
Key results
| Area | Result |
|---|---|
| Model format | ExecuTorch (.pte) |
| Target device class | Mobile CPU |
| Reference device | vivo X300 (aarch64, 8-core CPU, Android 16 / OriginOS 6) |
| Example environment | AWS Graviton, Ubuntu arm64 |
| Primary performance result | p50 latency 727.726 ms, 1.37 FPS (1.84x faster than baseline) |
| Accuracy result | RMSE 0.3474 m, AbsRel 0.0600, delta1 (< 1.25) 96.35% |
| Size / memory result | 26.564 MB (3.56x smaller), peak memory 380.10 MB (1.16x less) |
Original model
| Field | Value |
|---|---|
| Original model | Depth Anything V2 Small |
| Original source | Hugging Face |
| Original developer | Depth Anything team (HKU / TikTok) |
| Original model card | depth-anything/Depth-Anything-V2-Small-hf |
| Original license | Apache-2.0 |
Model files
| File | Description |
|---|---|
depth_anything_v2_small_executorch_optimized.pte |
Arm-optimized INT8 model for deployment |
example.py |
Minimal inference example |
pyproject.toml |
Pinned runtime dependencies for example.py, resolved with uv |
uv.lock |
Locked dependency resolution for pyproject.toml |
config.yaml |
Model input/output contract used by the example |
benchmarks/ |
FP32 baseline and Arm-optimized benchmark records |
Performance
Performance was measured on the vivo X300 reference configuration below. The Graviton environment documented for example.py verifies portability of the inference flow but does not provide or imply equivalent Graviton performance.
Reference configuration
| Field | Value |
|---|---|
| Device / platform | vivo X300 |
| CPU architecture | aarch64 |
| CPU | C1-Ultra, C1-Premium, C1-Pro, 8 cores |
| System memory | 16 GB |
| OS | Android 16 / OriginOS 6 |
| Runtime | ExecuTorch 1.1.0 |
| Execution backend | CPU (XNNPACK, KleidiAI) |
| Precision | INT8, static PTQ — per-channel symmetric weights, per-tensor symmetric activations (zero-point 0) |
| Batch size | 1 |
| Threads | 1 |
| Input resolution | 518x686 |
| Runs / warmup | 50 / 10 |
Performance results
| Metric | Original / baseline | Arm-optimized | Improvement |
|---|---|---|---|
| Model size (MB) | 94.516 | 26.564 | 3.56x smaller |
| End-to-end latency p50 (ms) | 1336.611 | 727.726 | 1.84x faster |
| End-to-end latency p90 (ms) | 1344.712 | 735.644 | 1.83x faster |
| End-to-end latency p99 (ms) | 1350.503 | 737.494 | 1.83x faster |
| Model load time (ms) | 30.270 | 30.547 | Slower |
| Time to first inference (ms) | 1122.838 | 750.388 | 1.50x faster |
| Peak memory, USS (MB) | 439.43 | 380.10 | 1.16x less |
| Frames per second | 0.80 | 1.37 | 1.71x |
Accuracy
Accuracy was evaluated using the same preprocessing, input resolution, and evaluation protocol described below. Where possible, the optimized model is compared against the original model under the same evaluation conditions.
Evaluation setup
| Field | Value |
|---|---|
| Dataset | NYU Depth V2 |
| Split | Test (official raw-depth test split) |
| Sample count | 654 |
| Metric(s) | RMSE (m), AbsRel, delta1 (< 1.25) |
| Prediction alignment | Per-image affine scale-and-shift fit to ground truth in disparity space before computing metrics |
| Runtime | ExecuTorch 1.1.0 (Arm-optimized) / PyTorch (baseline), CPU with XNNPACK and KleidiAI |
Accuracy results
| Metric | Original / baseline | Arm-optimized | Change |
|---|---|---|---|
| AbsRel (lower is better) | 0.0512 | 0.0600 | +0.0088 |
| RMSE, m (lower is better) | 0.3108 | 0.3474 | +0.0366 |
| delta1 (< 1.25), % (higher is better) | 97.32 | 96.35 | -0.97 pp |
Accuracy was measured using the evaluation setup described above. Users should re-evaluate the model on their own data before production use.
Arm optimization approach
Arm optimized this model for efficient inference on Arm-based platforms using a hardware-aware conversion and validation flow.
For this release, Arm used:
| Optimization area | Applied? | Notes |
|---|---|---|
| Model conversion | Yes | Loaded from Hugging Face with eager attention, wrapped to return a plain depth tensor, and converted to ExecuTorch .pte via the shared PT2E export pipeline |
| Quantization | Yes | INT8 static PTQ with histogram observers — per-channel symmetric weights, per-tensor symmetric activations; calibrated on 100 NYU Depth V2 samples |
| Runtime/backend selection | Yes | XNNPACK + KleidiAI delegate on the ExecuTorch CPU backend |
| Graph/runtime compatibility updates | Yes | Kept aten.linear undecomposed for direct XNNPACK delegation and used group-based partitioning; no post-quantization graph surgery was required |
| Accuracy validation | Yes | Compared against the original model under the same evaluation protocol |
| Performance validation | Yes | Measured on the reference Arm platform |
The goal of this process is to improve deployment characteristics such as latency, memory use, model size, and runtime compatibility while preserving the model's intended behavior. Detailed conversion scripts, calibration configuration, or backend-specific implementation details may be provided separately where appropriate.
Using this model
Install dependencies
Note: The Python/uv example runs on AWS Graviton (Ubuntu arm64) to confirm runtime compatibility only, and is intended as a guideline for building an equivalent run script on Mobile CPU systems.
The reproducible Python example environment targets AWS Graviton running Ubuntu on arm64. Dependencies are declared in pyproject.toml; its lock includes Linux aarch64 wheels for the ExecuTorch/XNNPACK runtime and preprocessing packages. Resolve and install them with uv:
uv python install
uv sync --frozen
Run the example
uv run example.py
The ordinary command prints a finite disparity summary and does not overwrite the committed expected results. To write new output files, pass an explicit directory:
uv run example.py --output-dir outputs
The script reads sample_input.jpg, runs inference with depth_anything_v2_small_executorch_optimized.pte, and optionally writes:
sample_output.png— grayscale disparity map at the original image resolution (255= nearest)depth.json— input/output metadata and raw disparity statistics
Expected input
| Property | Value |
|---|---|
| Shape | [1, 3, 518, 686] |
| Dtype | float32 |
| Range | [0.0, 1.0] before normalization; the tensor passed to the model is normalized (approximately [-2.12, 2.64]) |
| Preprocessing | Convert RGB uint8 HWC pixels to NumPy float64 in [0, 1] by dividing by 255.0; resize directly to 518x686 (H x W) with OpenCV INTER_CUBIC; normalize in NumPy with ImageNet mean [0.485, 0.456, 0.406] and std [0.229, 0.224, 0.225]; transpose to CHW, cast to float32, and add the batch dimension. This matches the calibration and evaluation pipeline. |
Expected output
| Property | Value |
|---|---|
| Shape | [1, 518, 686] |
| Format | Relative disparity map (higher values are closer), not metric depth |
| Postprocessing | squeeze the singleton channel dimension if present; apply per-sample min-max normalization to [0, 1]; bilinearly resize to the original image resolution for visualization and save as an 8-bit grayscale image |
Intended use
This model is intended for developers evaluating monocular depth estimation workloads on Arm-based platforms. It is suitable as a reference implementation for benchmarking, prototyping, and integration exploration.
Limitations
- Evaluated on the 654-image official NYU Depth V2 test split, which contains indoor scenes; outdoor and highly out-of-distribution domains are not covered by these results.
- The input size is fixed at 518x686. This artifact matches the paper-aligned NYU 4:3 geometry; other aspect ratios require a separately exported static shape.
- The output is relative disparity, not metric depth. Converting it to metric depth requires affine scale-and-shift alignment outside the model.
- Performance was measured on a vivo X300; other Arm devices may run slower or faster and may have different XNNPACK or KleidiAI delegation coverage.
- The Python/uv example targets AWS Graviton on Ubuntu arm64. It establishes runtime compatibility only; no Graviton latency or memory benchmark is reported here.
Additional notes
Quantization was performed with PT2E static quantization using histogram observers, INT8 per-channel symmetric weights, and per-tensor symmetric activations with zero-point 0. No layers were kept in FP32; the whole model was quantized. Calibration used 100 samples from a Hugging Face-compatible NYU Depth V2 subset, separate from the 654-image official test split used for evaluation.
This artifact uses a 518x686 (H x W) input, matching the paper-aligned NYU 4:3 geometry, rather than a square 518x518 shape. The square shape requires aspect-distorting resizing, while 518x686 processes more pixels and retains the intended geometry.
- Sample input:
sample_input.jpgis derived from Living room (Unsplash) by Jarosław Ceborski, via Wikimedia Commons (CC0 1.0).
About this version
Original Model: Depth Anything V2 Small by Depth Anything team (HKU / TikTok) - Repository
Optimization/conversion: Arm-Optimized version for execution on Arm-based platforms.
Converted/optimized by: Arm
License: The Original Model and the Optimized Model are subject to Apache-2.0.
This repository contains a converted or optimized version of the Original Model (the “Optimized Model”). The Original Model has been converted or optimized as described above for execution on Arm-based platforms.
No retraining or fine-tuning of the Original Model was performed as part of the conversion or optimization. The conversion or optimization was not intended to change the Original Model’s behavior or intended use.
Original Model and Documentation
For information about the Original Model, including its development, training data, intended uses, limitations and other relevant information, please refer to the Original Model repository. Information in that repository was provided by the original developer or other third parties and, unless expressly stated otherwise, has not been independently verified by Arm.
Licenses and Third-Party Terms
Use of the Original Model and the Optimized Model is subject to the applicable licenses, usage restrictions and other terms identified above and in the relevant repositories. Publication of the Optimized Model does not grant any rights beyond those provided under the applicable license terms.
You are responsible for reviewing those terms and ensuring that your use of the Original Model and the Optimized Model is permitted.
Purpose of this Release
The Optimized Model is provided as a reference implementation to demonstrate and evaluate execution and performance on Arm-based systems. It is not a production-ready or supported solution.
Arm’s publication of the Optimized Model does not constitute an endorsement or certification of the Original Model or a representation that the Optimized Model is suitable for production use or any particular purpose.
To the fullest extent permitted by applicable law (i) the Optimized Model is provided “as is.” Arm makes no representations or warranties that the Original Model, the Optimized Model or their outputs are accurate, safe, secure, non-infringing, legally compliant, suitable for production use or fit for any particular purpose; and (ii) Arm will not be liable for any loss or damage arising from or in connection with the Optimized Model, its use or its outputs.
You are responsible for independently evaluating the Optimized Model, its outputs and its suitability for your intended use, including compliance with applicable legal, regulatory, safety and security requirements.
Arm does not commit to provide ongoing support, maintenance or updates for the Optimized Model. Any use of or reliance on the Optimized Model or its outputs is at your own risk.
- Downloads last month
- 50
Model tree for Arm/depth-anything-v2-small-int8-xnnpack-executorch-vivo-x300
Base model
depth-anything/Depth-Anything-V2-Small-hf