onnx2tflite icon indicating copy to clipboard operation
onnx2tflite copied to clipboard

max error is too big during conversion

Open liamsun2019 opened this issue 2 years ago • 2 comments

Hi author,

Following error rises up during conversion from an onnx to tflite:

ERROR:converter running::tflite model elements' max error has reached 1.4117E+01, but convert is done, please check xx.tflite carefully!

The onnx itself works normally for python. Is there any way to do further debug? Any suggestion is appreciated.

liamsun2019 avatar Aug 25 '23 04:08 liamsun2019

Hello, after the conversion is completed, the tool will compare the output of onnx and tflite for the same set of data. If the maximum element error exceeds 1e-2, an alarm will be issued, but the model is converted successfully. There will be the following situations:

  1. The tflite model works fine, then you can ignore it.
  2. The performance of the tfilte model degrades, then you may need to debug layer by layer to find out which layer is causing the error to increase. You can do this by specifying 'output_node_names' before running:
# cutoff model, redefine inputs and outputs, support middle layers
python converter.py --weights "./your_model.onnx" --outpath "./save_path" --formats "tflite" --input-node-names "layer_inputname" --output-node-names "layer_outname1" "layer_outname2"

MPolaris avatar Aug 27 '23 01:08 MPolaris

Thanks for your quick feedback

  1. The converted tflite does not work normally, i.e, the outputs are incorrect.
  2. Will try it out.

liamsun2019 avatar Aug 28 '23 01:08 liamsun2019