-
Notifications
You must be signed in to change notification settings - Fork 74
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
RTMDet int8 quantization #644
Comments
The problem of model accuracy degradation after INT8 quantization and the problem of conversion to the Float32 model need to be separated and debugged as separate problems. The issue of accuracy degradation after INT8 quantization is not related to onnx2tf.
As a result, Float32's tflite model only incurred an error of about
|
Hi @PINTO0309, Thanks for your quick response. Reading it again, I could have identified the SiLu/Swish activation, sorry for that. So I should retrain the original pytorch model with a different activation function (eg using relu), correct? |
If I understand correctly, you are correct. |
Hi @PINTO0309, One thing: Edgeyolo has the same kind of patterns in the onnx graph and is exporting fine without accuracy degradation during INT8 quantization. So it Swish is not necessarily a problem, it might be some combination of things. |
Then it must be a post-processing https://github.com/PINTO0309/PINTO_model_zoo/tree/main/426_YOLOX-Body-Head-Hand |
Thanks for your reply again! Why are you sharing this repo and screenshot? It's a different model, right? |
Have you not read the issues linked in the README? It's a pain to explain because the same issue is posted over and over again. |
Yes I did but I still don't understand your reply. Sorry. But willing to add my insights and more detailed explanation if I understand the issue. |
First, click on this label. There should be almost every exchange on basic quantization like the one you've been asking about. The query is as follows. https://github.com/PINTO0309/onnx2tf/issues?q=label%3AQuantization+is%3Aclosed Among the most important issues are the following. The issue you fixed the broken link for me the other day was an issue that contained quite important information, but for some reason I had to delete the issue. Sorry about that. [YOLOX-TI] ERROR: onnx_op_name: /head/ScatterND #269 Of the structure of the model body, the destruction of the quantization range by Since there is no single cause for the significant loss of accuracy in quantized models, I will not attempt to explain all of them here. |
@PINTO0309 Thanks! This helps. I found out I took the wrong node names in 'onnx2tf -i end2end.onnx -osd -onimc /backbone/stage1/stage1.1/Concat' I have to take the outputs of that node instead. (#520) I think it's a concat problem somewhere indeed. I already made the last concat to be the same scale/meaning, like in the ticket you mention, edgeyolo and yolov8, but Ill start inspecting the other concats in the graph. |
Issue Type
Others
OS
Linux
onnx2tf version number
1.22.0
onnx version number
1.15.0
onnxruntime version number
1.17.1
onnxsim (onnx_simplifier) version number
0.4.33
tensorflow version number
2.16.1
Download URL for ONNX
end2end_onnxsim.onnx.zip
Parameter Replacement JSON
None
Description
I want to convert the onnx file (RTMdet) to tflite. I already removed the post processing part and made sure the last concat is in equal space (normalized bounding box coordinates by dividing xywh by width and height of output)
The quantified tflite file still is different from the tflite float32 output. So I want to debug the complete graph.
My idea is to do underneath three steps for multiple spots in the graph:
However, on converting (truncating) I found the following issue:
onnx2tf -i end2end.onnx -osd -onimc /backbone/stage1/stage1.1/Concat
Model optimizing complete!
Automatic generation of each OP name started ========================================
Automatic generation of each OP name complete!
INFO: Finish!
Model loaded ========================================================================
Model conversion started ============================================================
Traceback (most recent call last):
File "/usr/local/bin/onnx2tf", line 8, in
sys.exit(main())
File "/usr/local/lib/python3.10/dist-packages/onnx2tf/onnx2tf.py", line 2380, in main
model = convert(
File "/usr/local/lib/python3.10/dist-packages/onnx2tf/onnx2tf.py", line 924, in convert
batch_size = inputs[0].shape[0]
IndexError: list index out of range
My questions:
Thanks so much for your help!
The text was updated successfully, but these errors were encountered: