Views
No views yet
| File | Purpose | Format |
|---|---|---|
model.onnx | Downloadable converted model | ONNX |
source/model.pb | Original model | TensorFlow GraphDef |
graphs/netron.png | ONNX graph visualization | PNG |
mlir/onnx.mlir | ONNX-MLIR import result | MLIR text |
| Item | Value |
|---|---|
| Precision | FP32 |
| ONNX file size | 8.04 MiB |
| Initializer tensors | 134 |
| Stored initializer elements | 2,097,828 |
| External weight files | None |
| Original format | TensorFlow GraphDef |
Stored initializer elements includes weights, biases, quantization scales,
zero-points, and other constant tensors. It is not a trainable-parameter count.pip install huggingface_hub numpy tensorflow1import numpy as np
2import tensorflow as tf
3from huggingface_hub import hf_hub_download
4
5repo_id = "ketiswp/google-coral-DeepLabV3-MobileNetV2-1.0-PascalVOC-fp32-onnx"
6model_path = hf_hub_download(repo_id=repo_id, filename="source/model.pb")
7graph_def = tf.compat.v1.GraphDef()
8graph_def.ParseFromString(open(model_path, "rb").read())
9graph = tf.Graph()
10with graph.as_default():
11 tf.import_graph_def(graph_def, name="")
12
13input_tensor = graph.get_tensor_by_name("ImageTensor:0")
14output_tensor = graph.get_tensor_by_name("SemanticPredictions:0")
15input_value = np.zeros((1, 513, 513, 3), dtype=input_tensor.dtype.as_numpy_dtype)
16
17config = tf.compat.v1.ConfigProto(
18 intra_op_parallelism_threads=1,
19 inter_op_parallelism_threads=1,
20 device_count={"GPU": 0},
21)
22with tf.compat.v1.Session(graph=graph, config=config) as session:
23 output = session.run(output_tensor, feed_dict={input_tensor: input_value})
24print(output.shape, output.dtype)pip install huggingface_hub numpy onnxruntime1import numpy as np
2import onnxruntime as ort
3from huggingface_hub import hf_hub_download
4
5repo_id = "ketiswp/google-coral-DeepLabV3-MobileNetV2-1.0-PascalVOC-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)])