axinc-ai / ailia-models-tflite

Quantized version of model library
21 stars 1 forks source link

conversion code of model from pytorch to tflite #37

Closed sudipxerox closed 1 year ago

sudipxerox commented 1 year ago

I have gone through the code, but I was unable to find that portion of code to convert the model from pytorch to tflite. can you please share the portion of code you are using to convert the model to tflite.

I also used a code to convert the model to tflite, but getting error -> MicrosoftTeams-image (19)

please help me to resolve the issue

kyakuno commented 1 year ago

@sudipxerox I think onnx2tf is useful to convert tflite from onnx. https://github.com/PINTO0309/onnx2tf

Step.1 torch model to onnx.

python3 torch_to_onnx.py

https://github.com/axinc-ai/export-to-tflite/blob/torch/torch/torch_to_onnx.py

Step.2 onnx to pb and tflite (float).

python3 -m onnx2tf -i efficientnetlite.onnx -osd