-
Notifications
You must be signed in to change notification settings - Fork 261
Description
Hardware:
GPU: Intel(R) UHD Graphics 620
Processor: Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz, 1800 Mhz, 4 Core(s), 8 Logical Processor(s)
OS:
Windows 10
Software:
Python 3.10.0
nncf 2.17.0
openvino 2025.2.0
I am trying to quantize codeformer, a float32, opset 13, onnx model to INT8 format for performance gain.
Model Inputs:
Name: x, Shape: [0, 3, 512, 512], Data Type: FLOAT
Name: w, Shape: [], Data Type: DOUBLE
A collection of 200 images (512x512) has been created. Here is the script
import numpy as np
from PIL import Image
import os
import nncf
from nncf import Dataset
import onnx
# Load your ONNX model
onnx_model = onnx.load("codeformer_opset13.onnx")
def preload_calibration_dataset(images_dir):
data = []
for filename in os.listdir(images_dir):
if filename.lower().endswith((".png", ".jpg", ".jpeg")):
img_path = os.path.join(images_dir, filename)
img = Image.open(img_path).convert("RGB").resize((512, 512))
img_np = np.array(img).astype(np.float32) / 255.0
img_np = img_np.transpose(2, 0, 1)
img_np = np.expand_dims(img_np, axis=0)
data.append({
"x": img_np,
"w": np.array(1.0, dtype=np.float64)
})
print(f"Loaded {len(data)} images for calibration.")
return data
# Wrap with nncf.Dataset
dataset = Dataset(preload_calibration_dataset("faces/class1"))
# Run quantization
quantized_model = nncf.quantize(onnx_model, dataset)
# Save the quantized ONNX model
onnx.save(quantized_model, "codeformer_int8.onnx")
The process starts and immediately hangs my laptop as soon as statistical collection starts processing the first image . Here is the captured image:

I am getting my hands on NNCF for the very first time. Am I missing something here or it's just the hardware limitation causing the issue?