FP32 and 8-bit Quantized ONNX Model Pairs
Collection
FP32 paired with signed INT8, unsigned UINT8, or mixed INT8/UINT8 ONNX models. Project IDs appear only in this collection. • 42 items • Updated
FP32 ONNX version of Google Coral DeepLabV3 MobileNetV2 1.0 Pascal VOC for semantic segmentation.
| 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 tensorflow
import numpy as np
import tensorflow as tf
from huggingface_hub import hf_hub_download
repo_id = "ketiswp/google-coral-DeepLabV3-MobileNetV2-1.0-PascalVOC-fp32-onnx"
model_path = hf_hub_download(repo_id=repo_id, filename="source/model.pb")
graph_def = tf.compat.v1.GraphDef()
graph_def.ParseFromString(open(model_path, "rb").read())
graph = tf.Graph()
with graph.as_default():
tf.import_graph_def(graph_def, name="")
input_tensor = graph.get_tensor_by_name("ImageTensor:0")
output_tensor = graph.get_tensor_by_name("SemanticPredictions:0")
input_value = np.zeros((1, 513, 513, 3), dtype=input_tensor.dtype.as_numpy_dtype)
config = tf.compat.v1.ConfigProto(
intra_op_parallelism_threads=1,
inter_op_parallelism_threads=1,
device_count={"GPU": 0},
)
with tf.compat.v1.Session(graph=graph, config=config) as session:
output = session.run(output_tensor, feed_dict={input_tensor: input_value})
print(output.shape, output.dtype)
pip install huggingface_hub numpy onnxruntime
import numpy as np
import onnxruntime as ort
from huggingface_hub import hf_hub_download
repo_id = "ketiswp/google-coral-DeepLabV3-MobileNetV2-1.0-PascalVOC-fp32-onnx"
model_path = hf_hub_download(repo_id=repo_id, filename="model.onnx")
options = ort.SessionOptions()
options.intra_op_num_threads = 1
options.inter_op_num_threads = 1
options.execution_mode = ort.ExecutionMode.ORT_SEQUENTIAL
options.graph_optimization_level = ort.GraphOptimizationLevel.ORT_ENABLE_ALL
session = ort.InferenceSession(
model_path,
sess_options=options,
providers=["CPUExecutionProvider"],
)
dtype_by_ort_type = {
"tensor(float)": np.float32,
"tensor(double)": np.float64,
"tensor(float16)": np.float16,
"tensor(int64)": np.int64,
"tensor(int32)": np.int32,
"tensor(int16)": np.int16,
"tensor(int8)": np.int8,
"tensor(uint8)": np.uint8,
"tensor(bool)": np.bool_,
}
feeds = {}
for item in session.get_inputs():
shape = [dim if isinstance(dim, int) and dim > 0 else 1 for dim in item.shape]
feeds[item.name] = np.zeros(shape, dtype=dtype_by_ort_type[item.type])
outputs = session.run(None, feeds)
print([(item.name, value.shape, str(value.dtype))
for item, value in zip(session.get_outputs(), outputs)])
FP32/quantized comparison, conversion results, and reproduction code
This repository also includes the Netron graph, ONNX Dialect MLIR, and static MLIR dependency graph for this model variant.