fabio-sim/LightGlue-ONNX

Converting a trained model to ONNX

ikaftan opened this issue · 4 comments

HI! First of all, thanks for this helpful repository. Have you ever tried training your own model and then converting it to ONNX?

If I convert the released models and perform inference, it works fine. If I train my own model and use checkpoint_best.tar for conversion to ONNX, inference doesnt output any matches for the same input images. Thanks!

Hi @ikaftan, thank you for your interest in LightGlue-ONNX.

Unfortunately, I don't have any experience in training LightGlue models. However, even for the released pretrained models, the outputs do slightly differ between PyTorch and ONNXRuntime implementations, but I'm not sure what could've magnified this effect for custom trained models.

Thanks @fabio-sim for your fast reply! I will then try a couple more things and report here in case someone else also experiences the same issue.

@fabio-sim I notice the onnx models uses the opset 17. Is it possible to convert the model to use opset 15? I notice when I try to convert it to tflite to run on imx93 NPU, it complains about aten::grid_sampler.

Hi @ubergeekNZ, thank you for your interest in LightGlue-ONNX.

Unfortunately, the aten::grid_sampler op is required inside LightGlue.