Can't convert my pytorch model to ONNX

I used this repo (github/com/Turoad/lanedet) to convert a pytorch model that use mobilenetv2 as backbone To ONNX but I didn’t succeeded.

i got a Runtime error that says:

RuntimeError: Exporting the operator eye to ONNX opset version 12 is not supported. Please open a bug to request ONNX export support for the missing operator.

it’s really disappointing, looking to the good result that this model gives and the quick performance that it provides,

is there any way that I can fix this bug? because I need to convert it to ONNX and then to TF lite model to use it in Android App I will provide the pretrained model that I have used and the way that I follow in converting…

Thank you so much for helping!

my colab notebook:

the pretrained model that I use:

The error message is telling you that there’s an unsupported operator called eye so you have a few options

  1. Refactor your code to remove eye
  2. Open up a bug on pytorch/pytorch and tag @garymm
  3. Implement the custom op yourself torch.onnx — PyTorch 1.11.0 documentation
  4. Update to a newer opset which does have eye supported, see what’s supported here pytorch/torch/onnx at master · pytorch/pytorch · GitHub

The way to think about this is every PyTorch operation needs to be implemented by some opset in ONNX , so there’s always a few ops that will be missing that you need workaround