Self-Created Tools to convert ONNX files (NCHW) to TensorFlow/TFLite/Keras format (NHWC). The purpose of this tool is to solve the massive Transpose extrapolation problem in onnx-tensorflow (onnx-tf). I don't need a Star, but give me a pull request.
Currently, the copy_onnx_input_output_names_to_tflite flag converts the tflite model to json for modification, and then convert it back. For large models, the conversions take a long time and consume a large amount of disk space.
2. Summary of corrections
Flatbuffers provides Python API allowing reading and writing model files as Python objects directly. We can run flatc --python --gen-object-api to generate Python object API from the downloaded schema file and use it to read the model, add signature defs, and write it back.
3. Before/After (If there is an operating log that can be used as a reference)
4. Issue number (only if there is a related issue)
Wonderful. Inference by signature also seems to work correctly. I have had the same problem as you for a long time and this is a much smarter implementation. Thanks.
1. Content and background
Currently, the
copy_onnx_input_output_names_to_tflite
flag converts the tflite model to json for modification, and then convert it back. For large models, the conversions take a long time and consume a large amount of disk space.2. Summary of corrections
Flatbuffers provides Python API allowing reading and writing model files as Python objects directly. We can run
flatc --python --gen-object-api
to generate Python object API from the downloaded schema file and use it to read the model, add signature defs, and write it back.3. Before/After (If there is an operating log that can be used as a reference)
4. Issue number (only if there is a related issue)