NOTE: The Jupyter Notebook below is included in the Chimera SDK and can be run interactively by running the following CLI command:
$ quadric sdk notebook
From the Jupyter Notebook window in your browser, select the notebook named /quadric/sdk-cli/examples/models/centernet/centernet.ipynb.
from sdk_cli.visualizers.centernet import CenternetVisualizer
from sdk_cli.node_builtins.outputs.centernet_visualization import centernet
c = CenternetVisualizer(centernet.LABELS["VOCO"])
Length of classes: 20
import onnx
from sdk_cli.utils import model_helpers
import onnxruntime as ort
import numpy as np
import matplotlib.pyplot as plt
fp_onnx_name = f"centernet_float32.onnx"
from tvm.contrib.epu.chimera_job.quantize import quadric_quantize
images_path = "../../common/calibration/coco-like"
## include quadric's cli helpers and instantiate a module to help
model = onnx.load(fp_onnx_name)
_input = model.graph.input[0]
_input_shape = [dim_value.dim_value for dim_value in _input.type.tensor_type.shape.dim]
print(f"NCHW: {_input_shape}")
dataset_input_size = (_input_shape[-1], _input_shape[-2]) # an (W, H) tuple
dataset_mean = [0.5, 0.5, 0.5]
dataset_std = [0.5, 0.5, 0.5]
mh = model_helpers.ModelHelper(dataset_input_size, dataset_mean, dataset_std)
NCHW: [1, 3, 544, 544]
/tmp/ipykernel_18898/1708068201.py:21: DeprecationWarning: Call to deprecated class ModelHelper. ('ModelHelper' class is being deprecated. Quadric APIs have been updated to use PyTorch datasets and transforms instead.) -- Deprecated since version 24.01.
mh = model_helpers.ModelHelper(dataset_input_size, dataset_mean, dataset_std)
quantize_result = quadric_quantize(fp_onnx_name, 100, mh, images_path)
2026-06-19 03:57 - INFO - epu - quantize - Collecting calibration data
2026-06-19 03:57 - INFO - epu - quantize - Optimized model to opset
2026-06-19 03:57 - INFO - epu - quantize - Converted model to opset 12
2026-06-19 03:57 - INFO - epu - quantize - Saved optimized model to centernet_float32_float32_opt.onnx
2026-06-19 03:57 - INFO - epu - quantize - Input shapes: [1, 3, 544, 544]. Input names: input
2026-06-19 03:57 - INFO - epu - quantize - Output shapes: [[1, 20, 136, 136], [1, 2, 136, 136], [1, 2, 136, 136]]. Output names: ['output', '387', '390']
2026-06-19 03:57 - INFO - epu - quantize - applying calibration data to input: input
2026-06-19 03:57 - INFO - epu - quantize - calibration set size: 9
2026-06-19 03:57 - INFO - epu - quantize - Running real quantization on this input: input with input shape: [1, 3, 544, 544]
2026-06-19 03:57 - DEBUG - epu - quantize - Full exclusion set for quantization: ['Softmax', 'Sigmoid', 'QuadricCustomOp']
2026-06-19 03:57 - DEBUG - epu - quantize - excl_nodes ['Sigmoid_98']
2026-06-19 03:57 - INFO - epu - quantize - Quantization started...
WARNING:root:Please use QuantFormat.QDQ for activation type QInt8 and weight type QInt8. Or it will lead to bad performance on x64.
2026-06-19 03:57 - INFO - epu - quantize - Quantization done succesfully!
2026-06-19 03:57 - INFO - epu - quantize - ONNX full precision model size: 102.27 MB
2026-06-19 03:57 - INFO - epu - quantize - ONNX quantized model size: 25.65 MB
2026-06-19 03:57 - INFO - epu - quantize - Saved quantized model to /quadric/sdk-cli/examples/models/centernet/centernet_opt_sym_int8_q.onnx
2026-06-19 03:57 - INFO - epu - quantize - Saved shape inferenced model to /quadric/sdk-cli/examples/models/centernet/centernet_opt_sym_int8_q.onnx
2026-06-19 03:57 - INFO - epu - quantize - Checking for remaining FLOAT/FLOAT16 types.
2026-06-19 03:57 - INFO - epu - quantize - Model still has FLOAT/FLOAT16 types. Creating ranges for floating point tensors using calibration data
Custom quantization code for ConvTranspose
Custom quantization code for ConvTranspose
Custom quantization code for ConvTranspose
2026-06-19 03:57 - INFO - epu - quantize - Saved tensor ranges to /quadric/sdk-cli/examples/models/centernet/centernet_opt_sym_int8_q.onnx.tranges
def run_onnx_all_images(images_path, onnx_name):
vis_image_list = []
allimages = mh.get_images(images_path)
ort_sess = ort.InferenceSession(onnx_name)
for image_p in allimages:
image = mh.load_image(image_p)
onnx_output = ort_sess.run([], {"input": image})
output_img = CenternetVisualizer.input_img_to_display(image)
vis_img = c.draw_boxes(onnx_output, output_img, threshold=0.5, scale=4)
vis_image_list.append(vis_img)
return vis_image_list
list_fp = run_onnx_all_images(images_path, fp_onnx_name)
print(list_fp)
[<PIL.PngImagePlugin.PngImageFile image mode=RGBA size=640x480 at 0x790007A02800>, <PIL.PngImagePlugin.PngImageFile image mode=RGBA size=640x480 at 0x79000820CE80>, <PIL.PngImagePlugin.PngImageFile image mode=RGBA size=640x480 at 0x79000806E2C0>, <PIL.PngImagePlugin.PngImageFile image mode=RGBA size=640x480 at 0x7900080B8F70>, <PIL.PngImagePlugin.PngImageFile image mode=RGBA size=640x480 at 0x790007F4E170>, <PIL.PngImagePlugin.PngImageFile image mode=RGBA size=640x480 at 0x7900079B5F60>, <PIL.PngImagePlugin.PngImageFile image mode=RGBA size=640x480 at 0x790007FF3C10>, <PIL.PngImagePlugin.PngImageFile image mode=RGBA size=640x480 at 0x790007E47610>, <PIL.PngImagePlugin.PngImageFile image mode=RGBA size=640x480 at 0x790007ED8FA0>]









from tvm.contrib.epu.chimera_job.chimera_job import ChimeraJob
cgc_job = ChimeraJob(model_p=quantize_result.qmodel_path, trange_file=quantize_result.tranges_path)
cgc_job.compile(quiet=True)
THREADS = 2
all_images = mh.get_images(images_path, THREADS)
all_inputs = [{"input": mh.load_image(image)} for image in all_images]
all_results = cgc_job.run_batch_inference_harness(inputs=all_inputs, threads=THREADS)
Processing: 100%|███████████████████████████████| 2/2 [04:29<00:00, 134.92s/it]
for i, result in enumerate(all_results):
image = mh.load_image(all_images[i])
output_img = CenternetVisualizer.input_img_to_display(image)
list_output = [result["output"], result["387"], result["390"]]
img = c.draw_boxes(list_output, output_img, threshold=0.5, scale=4)
plt.show()


print(cgc_job)
cgc_job.plot_run_statistics();
╒═════════════════════╤══════════════════════════════════════════════════════════════════════════╕
│ Module Name │ centernet_opt_sym_int8_q_QC_U_1d7_16MB_4kB_128GBps_128GBps_16_OFF_x1_x1 │
├─────────────────────┼──────────────────────────────────────────────────────────────────────────┤
│ ONNX File │ /quadric/sdk-cli/examples/models/centernet/centernet_opt_sym_int8_q.onnx │
├─────────────────────┼──────────────────────────────────────────────────────────────────────────┤
│ Product Target │ QC-U │
├─────────────────────┼──────────────────────────────────────────────────────────────────────────┤
│ Number of Cores │ 1 │
├─────────────────────┼──────────────────────────────────────────────────────────────────────────┤
│ ISS Clock Frequency │ 1.700 │
├─────────────────────┼──────────────────────────────────────────────────────────────────────────┤
│ L2M Size │ 16MB │
├─────────────────────┼──────────────────────────────────────────────────────────────────────────┤
│ LRM Size │ 4kB │
├─────────────────────┼──────────────────────────────────────────────────────────────────────────┤
│ External Read BW │ 128GBps │
├─────────────────────┼──────────────────────────────────────────────────────────────────────────┤
│ External Write BW │ 128GBps │
├─────────────────────┼──────────────────────────────────────────────────────────────────────────┤
│ MACS per PE │ 16 │
├─────────────────────┼──────────────────────────────────────────────────────────────────────────┤
│ Max L2M │ 15.267MB │
├─────────────────────┼──────────────────────────────────────────────────────────────────────────┤
│ Max LRM │ 2.750kB │
├─────────────────────┼──────────────────────────────────────────────────────────────────────────┤
│ Max Temp Ext Bytes │ 0.000MB │
├─────────────────────┼──────────────────────────────────────────────────────────────────────────┤
│ Network GMACs │ 52.861 │
╘═════════════════════╧══════════════════════════════════════════════════════════════════════════╛
╒════╤════════╤════════╤═══════════════════╤══════════════════════════╤═══════╕
│ │ Type │ Name │ shape │ type │ mse │
╞════╪════════╪════════╪═══════════════════╪══════════════════════════╪═══════╡
│ 0 │ Input │ input │ [1, 3, 544, 544] │ tensor[FixedPoint32<30>] │ n/a │
├────┼────────┼────────┼───────────────────┼──────────────────────────┼───────┤
│ 1 │ Output │ output │ [1, 20, 136, 136] │ tensor[FixedPoint32<31>] │ 0.000 │
├────┼────────┼────────┼───────────────────┼──────────────────────────┼───────┤
│ 2 │ Output │ 387 │ [1, 2, 136, 136] │ tensor[FixedPoint32<24>] │ 1.418 │
├────┼────────┼────────┼───────────────────┼──────────────────────────┼───────┤
│ 3 │ Output │ 390 │ [1, 2, 136, 136] │ tensor[FixedPoint32<30>] │ 0.000 │
╘════╧════════╧════════╧═══════════════════╧══════════════════════════╧═══════╛
Post-ISS Report 1.7 GHz ***
Fully placed-and-routed gate simulation:
╒══════════════════════════════════╤═════════╕
│ Latency (ms) │ 5.76 │
├──────────────────────────────────┼─────────┤
│ FPS │ 173.55 │
├──────────────────────────────────┼─────────┤
│ Average Power @ 3nm SSGNP (mW) │ 1821.44 │
├──────────────────────────────────┼─────────┤
│ FPS per Watt @ 3nm SSGNP (FPS/W) │ 95.28 │
├──────────────────────────────────┼─────────┤
│ Ext Rd Bytes (MB) │ 29.10 │
├──────────────────────────────────┼─────────┤
│ Ext Wr Bytes (MB) │ 1.69 │
├──────────────────────────────────┼─────────┤
│ Avg Ext Rd BW (GBps) │ 4.93 │
├──────────────────────────────────┼─────────┤
│ Avg Ext Wr BW (GBps) │ 0.29 │
├──────────────────────────────────┼─────────┤
│ MAC Utilization │ 32.94% │
╘══════════════════════════════════╧═════════╛
*** Data generated using 7nm SSGNP gatesim and scaled to 3nm
[SDK-CLI] : TotalCycles: 9,795,489
[SDK-CLI] : Executions/second: 173.55
compute : ▇▇▇▇▇▇▇▇ 1.179M
data_array : ▇▇▇▇▇▇ 855.04K
mac : ▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇▇ 7.051M
data_external: ▏ 68.375K
data_ocm : ▇▇▇ 526.174K
for more information check run directory: /quadric/sdk-cli/examples/models/centernet/ccl_build/centernet_opt_sym_int8_q_QC_U_1d7_16MB_4kB_128GBps_128GBps_16_OFF_x1_x1/run/20260619_040004_36cd7e
2026-06-19 04:04 - INFO - epu - chimera_job - Combined plots generated and saved to:
/quadric/sdk-cli/examples/models/centernet/ccl_build/centernet_opt_sym_int8_q_QC_U_1d7_16MB_4kB_128GBps_128GBps_16_OFF_x1_x1/run/20260619_040004_36cd7e/data/centernet_opt_sym_int8_q_QC_U_1d7_16MB_4kB_128GBps_128GBps_16_OFF_x1_x1.combined.png
