There is a newer version of the record available.

Published May 16, 2024 | Version 1.21.4
Software Open

Tools to convert ONNX files (NCHW) to TensorFlow format (NHWC)

Description

  • Add -odrqt, --output-dynamic-range-quantized-tflite option. While output_integer_quantized_tflite already enables dynamic range quantization output, the option also triggers checks for calibration data, which is only required for full integer quantization, and causes errors when no calibration data is provided.

    This is undesirable if only dynamic quantization is wanted.

    A new option (-odrqt, --output-dynamic-range-quantized-tflite) is added to only enable dynamic range quant output, which doesn't need calibration data.

    Before:

    $ onnx2tf -i some_model_with_non_regular_input_shape.onnx -oiqt
    (other output omitted)
    Model conversion started ============================================================
    INFO: input_op_name: input shape: [1] dtype: float32
    ERROR: For INT8 quantization, the input data type must be Float32. Also, if --custom_input_op_name_np_data_path is not specified, all input OPs must assume 4D tensor image data. INPUT Name: input INPUT Shape: [1] INPUT dtype: float32
    

    After:

    $ onnx2tf -i some_model_with_non_regular_input_shape.onnx -odrqt
    (other output omitted)
    saved_model output started ==========================================================
    saved_model output complete!
    WARNING: All log messages before absl::InitializeLog() is called are written to STDERR
    W0000 00:00:1715853625.734342    7691 tf_tfl_flatbuffer_helpers.cc:390] Ignored output_format.
    W0000 00:00:1715853625.734397    7691 tf_tfl_flatbuffer_helpers.cc:393] Ignored drop_control_dependency.
    Float32 tflite output complete!
    W0000 00:00:1715853629.274694    7691 tf_tfl_flatbuffer_helpers.cc:390] Ignored output_format.
    W0000 00:00:1715853629.274724    7691 tf_tfl_flatbuffer_helpers.cc:393] Ignored drop_control_dependency.
    Float16 tflite output complete!
    W0000 00:00:1715853631.535535    7691 tf_tfl_flatbuffer_helpers.cc:390] Ignored output_format.
    W0000 00:00:1715853631.535568    7691 tf_tfl_flatbuffer_helpers.cc:393] Ignored drop_control_dependency.
    Dynamic Range Quantization tflite output complete!
    

What's Changed

  • add option to enable only dynamic range quant by @DDoSolitary in https://github.com/PINTO0309/onnx2tf/pull/633

Full Changelog: https://github.com/PINTO0309/onnx2tf/compare/1.21.3...1.21.4

Notes

If you use onnx2tf in your research, please cite it using these metadata.

Files

PINTO0309/onnx2tf-1.21.4.zip

Files (644.1 kB)

Name Size Download all
md5:8fab3bc9420304af57826ae0ab71bbce
644.1 kB Preview Download

Additional details

Related works