fabio-sim / LightGlue-ONNX

ONNX-compatible LightGlue: Local Feature Matching at Light Speed. Supports TensorRT, OpenVINO
Apache License 2.0
375 stars 34 forks source link

Converting a trained model to ONNX #63

Closed ikaftan closed 7 months ago

ikaftan commented 10 months ago

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!

fabio-sim commented 10 months ago

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.

ikaftan commented 10 months ago

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.

ubergeekNZ commented 9 months ago

@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.

fabio-sim commented 7 months ago

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

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