Skip to content

convert uint8 tflite model to onnx has dequant and quant nodes #2338

Open
@tensorbuffer

Description

@tensorbuffer

Describe the bug

The generated graph has consecutive dequant and quant node, with same scale and zero point. These are not needed.
The weights can have one dequant to make it from uint8 to float.

Urgency

Kind of urgent. If this path (tflite to onnx) doesn't work, need to look into pb to onnx, but then pb have QAT fake quant nodes, not sure if that has issue converting or not.

System information

  • OS Platform and Distribution (e.g., Linux Ubuntu 18.04*): Ubuntu 20.04.6 LTS
  • TensorFlow Version:2.11.0
  • Python version:3.8.17
  • ONNX version (if applicable, e.g. 1.11*):1.15.0
  • ONNXRuntime version (if applicable, e.g. 1.11*):1.16.3

To Reproduce

python -m tf2onnx.convert --opset 16 --tflite ../tree_seg.tflite --output tree_seg.onnx

Screenshots

tflite2onnx
the two nodes between the two conv nodes are not needed.

Additional context

tree_seg.zip

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugAn unexpected problem or unintended behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions