I want to convert trained model from PyTorch to tflite.
I saved trained model bellow.
How to convert model format from PyTorch to tflite?
We don’t officially support this. It might be possible by using ONNX.
Yes, first export to ONNX, then onward to the format of your choosing.
I tried this, but get the problem of pytorch and onnx working witch NCHW Tensor order, while tensorflow / tflite expects NHWC.
Has anyone been able to solve this?
I was trying to convert a vanilla mobilenet V2 model and ran into this issue as explained here on stackoverflow
My hunch is that Mobilenet V2 is too new for onnx…
Here is my Configuration:
torch 1.6.0.dev20200508 (needs pytorch-nightly to work with mobilenet V2 from torch.hub)
Try https://github.com/nerox8664/pytorch2keras Then, export it to tflite. Six months ago, I managed to export it. However, I recommend you to try pytorch mobile. It’s almost as fast as tflite but completely flawless.