2405169_en-US

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

2405169_en-US

2405169_en-US

eIQ Toolkit v1.17 PTQ silently skipped, output tflite remains full float32 without error message

Environment:
- Host: Windows11, eIQ Toolkit v1.17
- Target SOC: NXP i.MX95 19X19 board
- Model: pruned MNIST CNN, input shape [1,1,28,28]
- ONNX opset: 12, pure FP32, no pre‑inserted QDQ nodes.

Problem description:
I try to run PTQ quantization via eiq‑converter‑onnx2tflite plugin.
Both CLI and GUI Model Tool finish conversion without any error / warning log.
But the output tflite model is still full float32.
All weights, biases and activation tensors have scale=0, zero_point=0. It means PTQ calibration never actually ran.

What I have tried:
As a prerequisite, I have got an .onnx file from python which opset is 12.
Then I want to quantization via eIQ. After quantization, to do the neutron-converter via eIQ.
there are 3 ways to do this, I think.
and after quantization, we can check the quantization is done or not via to see the dtype ,scale and zp.

  •  I do this via GUI.
StepToolOutput Folderoutput 
Step101_train_mnist_cnn.py01_train_mnist_cnn_outmnist_cnn.pth 
Step202_prune_test.py02_prune_test_outprune_after.pth 
Step303_export_onnx.py03_export_onnx_outhandwrite_cnn_pruned.onnx 
Step4GUI ONNX04_eIQ_quantizationhandwrite_cnn_pruned_quantizationed.onnx 
Step5GUI ONNX2TFLITE05_eIQ_quqntizedonnx2tfliteeIQ_quqntizedonnx2tflite.tflitethere is a question about this output,all scale and zp is 0, that is to say  , there is no quantization. I donot know why.
Step6GUI converter neutron06_eIQ_neutroneIQ_quqntizedonnx2tflite_converted.tflite 
  •    I do this via command line by qty+2tflite in one step.
eiq-converter.exe --plugin eiq-converter-onnx2tflite --source D:\01_Work\AI_Project\mnist_new_demo\03_export_onnx_out\handwrite_cnn_pruned.onnx --dest D:\01_Work\AI_Project\07_CMD_OUTPUT\mnist_int8.tflite --input-shape "1,1,28,28" --precision int8_ptq --calibration-dataset D:\01_Work\AI_Project\mnist_calib_imgs --quantize-input true
eiq-converter.exe --plugin eiq-converter-onnx2tflite --source D:\01_Work\AI_Project\mnist_new_demo\03_export_onnx_out\handwrite_cnn_pruned.onnx --dest D:\01_Work\AI_Project\07_CMD_OUTPUT\mnist_int8.tflite --input-shape "1,1,28,28" --precision int8_ptq --calibration-dataset D:\01_Work\AI_Project\mnist_calib_imgs  --preprocessing "div:255.0"
I have tried this 2 command, both of them can be [success],but  all scale and zp is 0, that is to say  , there is no quantization. I donot know why.

lzm_0-1786693994048.png

  • I do this via command line by quan+2tflite in two step.
python -m onnx2quant -c "input;D:\01_Work\AI_Project\mnist_new_demo\09_mnist_calib_npy4d" -o D:\01_Work\AI_Project\09_cmd_onnx_qunitiation\model_qdq.onnx D:\01_Work\AI_Project\mnist_new_demo\03_export_onnx_out\handwrite_cnn_pruned.onnx
eiq-converter.exe --plugin eiq-converter-onnx2tflite --source D:\01_Work\AI_Project\09_cmd_onnx_qunitiation\model_qdq.onnx --dest D:\01_Work\AI_Project\09_cmd_onnx_qunitiation\mnist_int8_final.tflite --input-shape "1,1,28,28"
I have tried them, then I got a .tflite which's scale and zp is not all 0. 
Then I use this  mnist_int8_final.tflite to the GUI eiq-converter-neutron.  Then I have got a .tflite file smoothly.
But when I run it on the iMax95,
lzm_1-1786694055535.png
we can see that it did not run on the NPU.
I think the question is my .tflite file.
So I tried to use the command line to get the the right .tflite file, there is still ERROR: Internal error!
 lzm_3-1786694149754.png
lzm_2-1786694119859.png
Summary of observations:
 
1. Using eiq‑converter‑onnx2tflite (GUI or CLI) for native PTQ finishes without errors, but produces full float32 models. Quantization appears to be silently skipped.
2. When I use third‑party tool `onnx2quant` to generate QDQ‑inserted ONNX first, I can get a TFLite with non‑zero scale and zero‑point.
However this externally‑quantized model cannot be fully processed by neutron‑converter, it throws `ERROR: Internal error!` during graph optimization, and fails to generate a working NPU‑compatible model.
 
I am still learning this toolchain. It may be that I have misused parameters or followed an incorrect workflow.
 
Could anyone who has successfully run a quantized MNIST‑like CNN on i.MX95  share the verified workflow?
I would really appreciate any hints on how to correctly perform PTQ and produce a valid TFLite model that can be compiled and executed on the NPU.
 
Thank you very much.
 
 












标记 (1)
无评分
版本历史
最后更新:
昨天
更新人: