Views
No views yet
| File | Purpose | Format |
|---|---|---|
model.onnx | Downloadable converted model | ONNX |
model.onnx | Original model; no duplicate source file | ONNX |
graphs/netron.png | ONNX graph visualization | PNG |
mlir/onnx.mlir | ONNX-MLIR import result | MLIR text |
| Item | Value |
|---|---|
| Precision | FP32 |
| ONNX file size | 7.51 MiB |
| Initializer tensors | 106 |
| Stored initializer elements | 1,959,408 |
| External weight files | None |
| Original format | ONNX |
Stored initializer elements includes weights, biases, quantization scales,
zero-points, and other constant tensors. It is not a trainable-parameter count.model.onnx file above is the source-compatible downloadable model for this variant.pip install huggingface_hub numpy onnxruntime1import numpy as np
2import onnxruntime as ort
3from huggingface_hub import hf_hub_download
4
5repo_id = "ketiswp/stm32ai-MobileNetV2-0.5-ImageNet-PyTorch-224-fp32-onnx"
6model_path = hf_hub_download(repo_id=repo_id, filename="model.onnx")
7
8options = ort.SessionOptions()
9options.intra_op_num_threads = 1
10options.inter_op_num_threads = 1
11options.execution_mode = ort.ExecutionMode.ORT_SEQUENTIAL
12options.graph_optimization_level = ort.GraphOptimizationLevel.ORT_ENABLE_ALL
13session = ort.InferenceSession(
14 model_path,
15 sess_options=options,
16 providers=["CPUExecutionProvider"],
17)
18
19dtype_by_ort_type = {
20 "tensor(float)": np.float32,
21 "tensor(double)": np.float64,
22 "tensor(float16)": np.float16,
23 "tensor(int64)": np.int64,
24 "tensor(int32)": np.int32,
25 "tensor(int16)": np.int16,
26 "tensor(int8)": np.int8,
27 "tensor(uint8)": np.uint8,
28 "tensor(bool)": np.bool_,
29}
30feeds = {}
31for item in session.get_inputs():
32 shape = [dim if isinstance(dim, int) and dim > 0 else 1 for dim in item.shape]
33 feeds[item.name] = np.zeros(shape, dtype=dtype_by_ort_type[item.type])
34
35outputs = session.run(None, feeds)
36print([(item.name, value.shape, str(value.dtype))
37 for item, value in zip(session.get_outputs(), outputs)])