8000 INT8 Quantization Not Performed in onnx2tf – Only Float32, Float16, and Dynamic Range Quantization Saved · Issue #740 · PINTO0309/onnx2tf · GitHub
[go: up one dir, main page]

Skip to content
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

INT8 Quantization Not Performed in onnx2tf – Only Float32, Float16, and Dynamic Range Quantization Saved #740

Open
cchalou98 opened this issue Feb 18, 2025 · 3 comments
Labels
Lack of reproduction methods Lack of information or resources on how to reproduce

Comments

@cchalou98
Copy link
cchalou98 commented Feb 18, 2025

Issue Type

Feature Request

OS

Linux

onnx2tf version number

1.26.7

onnx version number

1.16.1

onnxruntime version number

1.18.1

onnxsim (onnx_simplifier) version number

0.4.33

tensorflow version number

2.17.0,

Download URL for ONNX

I am using my own SPNV2 ONNX

Parameter Replacement JSON

{
  "format_version": 1,
  "operations": [
    {
      "op_name": "Resize_0",
      "param_target": "inputs",
      "param_name": "Concat_0",
      "values": [48,48]
    },
    {
      "op_name": "Resize_1",
      "param_target": "inputs",
      "param_name": "Concat_1",
      "values": [48,48]
    },
    {
      "op_name": "Resize_2",
      "param_target": "inputs",
      "param_name": "Concat_2",
      "values": [48,48]
    },
    {
      "op_name": "Resize_3",
      "param_target": "inputs",
      "param_name": "Concat_3",
      "values": [24,24]
    },
    {
      "op_name": "Resize_4",
      "param_target": "inputs",
      "param_name": "Concat_4",
      "values": [48,48]
    },
    {
      "op_name": "Resize_5",
      "param_target": "inputs",
      "param_name": "Concat_5",
      "values": [48,48]
    },
    {
      "op_name": "Resize_6",
      "param_target": "inputs",
      "param_name": "Concat_6",
      "values": [48,48]
    },
    {
      "op_name": "Resize_7",
      "param_target": "inputs",
      "param_name": "Concat_7",
      "values": [24,24]
    },
    {
      "op_name": "Resize_8",
      "param_target": "inputs",
      "param_name": "Concat_8",
      "values": [24,24]
    },
    {
      "op_name": "Resize_9",
      "param_target": "inputs",
      "param_name": "Concat_9",
      "values": [12,12]
    },
    {
      "op_name": "Resize_10",
      "param_target": "inputs",
      "param_name": "Concat_10",
      "values": [48,48]
    },
    {
      "op_name": "Resize_11",
      "param_target": "inputs",
      "param_name": "Concat_11",
      "values": [48,48]
    },
    {
      "op_name": "Resize_12",
      "param_target": "inputs",
      "param_name": "Concat_12",
      "values": [48,48]
    },
    {
      "op_name": "Resize_13",
      "param_target": "inputs",
      "param_name": "Concat_14",
      "values": [192,192]
    },
    {
      "op_name": "Reshape_0",
      "param_target": "outputs",
      "param_name": "Reshape_0",
      "post_process_transpose_perm": [0,2,3,1]
    },
    {
      "op_name": "Reshape_1",
      "param_target": "outputs",
      "param_name": "Reshape_1",
      "post_process_transpose_perm": [0,2,3,1]
    },
    {
      "op_name": "Transpose_0",
      "param_target": "attributes",
      "param_name": "perm",
      "values": [0,1,2,3]
    },
    {
      "op_name": "Transpose_1",
      "param_target": "attributes",
      "param_name": "perm",
      "values": [0,1,2,3]
    },
    {
      "op_name": "Softmax_0",
      "param_target": "attributes",
      "param_name": "axis",
      "values": 3
    }
  ]
}

Description

I am trying to convert an ONNX model to TFLite using onnx2tf, but I noticed that INT8 quantization is not being performed correctly. Instead, the script only saves:

Float32 (.tflite)
Float16 (_float16.tflite)
Dynamic Range Quantization (_dynamic_range_quant.tflite)
However, I need Full Integer Quantization (INT8) because I plan to use the converted TFLite model for VectorBlox VNNX generation, which only supports fully integer models (both weights and activations must be INT8).

@PINTO0309 PINTO0309 added the Lack of reproduction methods Lack of information or resources on how to reproduce label Feb 18, 2025
@PINTO0309
Copy link
Owner
PINTO0309 commented Feb 18, 2025
  1. The model is not shared.
  2. The commands that were executed are not even written.
  3. There are no error messages or warning messages.

Read the README carefully.

@cchalou98
Copy link
Author
  1. spnv2_efficientpose_head_only.onnx
  2. onnx2tf -i spnv2_efficientpose_head_only.onnx -oiqt -qt per-tensor
  3. I know there are no errors, I want to generate tne int8 quantization instead of float16 and float32

@PINTO0309
Copy link
Owner

There is no way that quantization would not occur if there were no errors. If you don't share the onnx file I won't respond any more.

bodypix_mobilenet050_stride8_1x3x128x160.onnx.zip

onnx2tf \
-i bodypix_mobilenet050_stride8_1x3x128x160.onnx \
-oiqt \
-qt per-tensor

Image

Image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Lack of reproduction methods Lack of information or resources on how to reproduce
Projects
None yet
Development

No branches or pull requests

2 participants
0