|
Download README.md from mlboydaisuke/Metric3D-v2-OpenVINO: direct link, hf CLI and curl.
- Browser
- Download file 6.01 kB
-
https://huggingface.co/mlboydaisuke/Metric3D-v2-OpenVINO/resolve/main/README.md
- Command line
-
hf download hf://mlboydaisuke/Metric3D-v2-OpenVINO/README.md
-
curl -L -o README.md https://huggingface.co/mlboydaisuke/Metric3D-v2-OpenVINO/resolve/main/README.md
6.01 kB
| license: bsd-2-clause | |
| base_model: mlboydaisuke/Metric3D-v2-LiteRT | |
| base_model_relation: quantized | |
| library_name: openvino | |
| pipeline_tag: depth-estimation | |
| tags: | |
| - openvino | |
| - onnx | |
| - intel-npu | |
| # Metric3D-v2-OpenVINO | |
| Metric3D-v2 for Intel NPUs, GPUs and CPUs: metric3d_fp16 from [mlboydaisuke/Metric3D-v2-LiteRT](https://huggingface.co/mlboydaisuke/Metric3D-v2-LiteRT/tree/4f1d6e6b8fb131bc3f3bbe94860a056b8b5d433e) as ONNX (tf2onnx 1.17.0, opset 17), OpenVINO IR with fp32 weights, and a precompiled Intel NPU blob. tf2onnx 1.17.0 drops the bias of 24 FULLY_CONNECTED layers of metric3d_fp16; these files were converted with a one-line fix of that handler (`convert/patch_tf2onnx.py` in the GitHub repo), and their outputs match the `.tflite`. On the NPU of a Core Ultra 9 386H the blob runs in 80.40 ms per run, numpy input to numpy output. | |
| Scripts, raw records, and the same table for all 52 graphs of LiteRT-Models: https://github.com/john-rocky/windows-zoo | |
| ## Files | |
| | file | bytes | sha256 | | |
| |---|---|---| | |
| | `metric3d_fp16.onnx` | 153,956,920 | `05beedc220e804dd418a4e75faa20d001505ef64ca79ae558c30290571b2e185` | | |
| | `openvino/metric3d_fp16.xml` | 5,556,781 | `4df486a82b7b0ab2ee49dd1c09e6155b24db3bd48e22ba2407f726edadd3d006` | | |
| | `openvino/metric3d_fp16.bin` | 150,206,156 | `f8c415fbcc763f3772229e74865e2641151f4d21224a096087bf457129684039` | | |
| | `npu/metric3d_fp16.blob` | 105,549,953 | `fef43f864791c18a60e802d3d2d3abb12c373bd0ad248d19ca25f898f83d340d` | | |
| The NPU blob was compiled with OpenVINO 2026.4.1, Intel NPU driver 32.0.100.4841 (OpenVINO reports NPU_DRIVER_VERSION 1004841, NPU_COMPILER_VERSION 524292). If `import_model` refuses a blob on another driver or OpenVINO version, compile the IR instead (the commented line in the snippet). | |
| ## How it was measured | |
| MSI Stealth 16 AI+ (Core Ultra 9 386H, RTX 5080 Laptop GPU at a 95 W power limit, Windows 11 build 26200.9711, on AC power), 2026-11-07. On the laptop, each row is one process: load, one run, 5 warmup runs, then the median of 30 timed runs (2 warmup + 10 timed runs when the first run takes more than 3 s), numpy input to numpy output, every runtime at its default settings, one process at a time, each started after the CPU, the RTX and the Intel GPU had gone idle (the thresholds are in METHOD.md of the GitHub repo). Output check: each output against the CPU output in fp32 on the same input (ONNX Runtime's CPU EP); PASS = cosine ≥ 0.99, no NaN or Inf, and top-1 agreement ≥ 0.99 for class scores. No Snapdragon rows: Qualcomm AI Hub measured the file before the bias fix (its numbers are in the GitHub table). | |
| ## Speed and output check | |
| | processor | runtime | file | ms | load s | output check | | |
| |---|---|---|---|---|---| | |
| | Intel AI Boost NPU | OpenVINO 2026.4.1 | `npu/` blob (`import_model`) | 80.40 | 0.08 | PASS (cos ≥ 0.9991) | | |
| | Intel AI Boost NPU | ONNX Runtime 1.31.1 + OpenVINO EP 1.8.1 | `.onnx`, compiled when the session loads | 69.92 | 314.25 | PASS (cos ≥ 0.9991) | | |
| | Intel Graphics (iGPU) | ONNX Runtime 1.31.1 + OpenVINO EP 1.8.1 | `.onnx` | 56.25 | 10.06 | PASS (cos ≥ 0.9988) | | |
| | RTX 5080 Laptop (95 W limit) | ONNX Runtime 1.31.1, CUDA EP | fp16 copy of the `.onnx` (not in this repo) | 58.00 | 1.66 | PASS (cos ≥ 0.9991) | | |
| | RTX 5080 Laptop (95 W limit) | ONNX Runtime 1.31.1, CUDA EP | `.onnx` | 57.03 | 1.67 | PASS (cos ≥ 0.9999) | | |
| | Core Ultra 9 386H CPU | ONNX Runtime 1.31.1, CPU EP | `.onnx` | 1367.07 | 0.76 | reference | | |
| The ONNX file against the source `.tflite` (LiteRT interpreter on the CPU, the same input): PASS, cosine ≥ 0.9999 for every output. | |
| ## Run it on the Intel NPU | |
| Download this repo, then run the snippets from its folder: | |
| ```sh | |
| pip install huggingface_hub | |
| hf download mlboydaisuke/Metric3D-v2-OpenVINO --local-dir Metric3D-v2-OpenVINO | |
| cd Metric3D-v2-OpenVINO | |
| ``` | |
| OpenVINO (`pip install openvino==2026.4.1`): | |
| ```python | |
| import numpy as np | |
| import openvino as ov | |
| core = ov.Core() | |
| if "NPU" not in core.available_devices: | |
| raise SystemExit(f"no Intel NPU visible to OpenVINO: {core.available_devices}") | |
| with open("npu/metric3d_fp16.blob", "rb") as f: | |
| compiled = core.import_model(f.read(), "NPU") # precompiled: no compile at load | |
| # or compile the IR on this machine: compiled = core.compile_model("openvino/metric3d_fp16.xml", "NPU") | |
| # replace the zeros with your preprocessed input (float32, the shapes printed by compiled.inputs) | |
| feeds = {i.get_any_name(): np.zeros(list(i.shape), np.float32) for i in compiled.inputs} | |
| outputs = compiled(feeds) | |
| print({o.get_any_name(): outputs[o].shape for o in compiled.outputs}) | |
| ``` | |
| ONNX Runtime with the OpenVINO EP (`pip install onnxruntime==1.31.1 onnxruntime-ep-openvino==1.8.1`): | |
| ```python | |
| import numpy as np | |
| import onnxruntime as ort | |
| import onnxruntime_ep_openvino as ov_ep | |
| ort.register_execution_provider_library(ov_ep.get_ep_name(), ov_ep.get_library_path()) | |
| npu = [d for d in ort.get_ep_devices() | |
| if d.ep_name == ov_ep.get_ep_name() and d.ep_metadata.get("ov_device") == "NPU"] | |
| if not npu: | |
| raise SystemExit("no Intel NPU visible to the OpenVINO EP") | |
| so = ort.SessionOptions() | |
| so.add_provider_for_devices(npu, {}) | |
| sess = ort.InferenceSession("metric3d_fp16.onnx", sess_options=so) # compiles for the NPU here | |
| # replace the zeros with your preprocessed input (float32) | |
| feeds = {i.name: np.zeros(i.shape, np.float32) for i in sess.get_inputs()} | |
| outputs = sess.run(None, feeds) | |
| print([o.shape for o in outputs]) | |
| ``` | |
| ## Branch `windows-model-zoo` | |
| The branch [`windows-model-zoo`](https://huggingface.co/mlboydaisuke/Metric3D-v2-OpenVINO/tree/windows-model-zoo) adds the 2 files that [windows-model-zoo](https://github.com/john-rocky/windows-model-zoo) runs. `unfixed/`: the conversion without the bias fix above, with its fp16 copy. To use the model, take main's files. | |
| ## Licence | |
| BSD-2-Clause, the licence of [mlboydaisuke/Metric3D-v2-LiteRT](https://huggingface.co/mlboydaisuke/Metric3D-v2-LiteRT). The source card names the upstream model as `yvanyin/metric3d` (not a Hugging Face repo). | |