fabio-sim / LightGlue-ONNX

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

use trtexec #36

Closed kajo-kurisu closed 1 year ago

kajo-kurisu commented 1 year ago

i run this command python optimize.py --input weights/superpoint_lightglue.onnx and i get superpoint_lightglue_fused.onnx and superpoint_lightglue_fused_fp16.onnx but when i use trtexec --onnx='/home/sy/sy/lightglue_ws/src/LightGlue-ONNX/weights/my/sim/superpoint_lightglue_fused_fp16.onnx' --fp16 --saveEngine=superpoint_lightglue_fused_fp16.trt --warmUp=500 --duration=10 to trans them into .trt file, the following error appears

[10/10/2023-10:53:57] [E] [TRT] 3: getPluginCreator could not find plugin: MultiHeadAttention version: 1
[10/10/2023-10:53:57] [E] [TRT] ModelImporter.cpp:771: While parsing node number 272 [MultiHeadAttention -> "/transformers.0/self_attn/Reshape_5_output_0"]:
[10/10/2023-10:53:57] [E] [TRT] ModelImporter.cpp:772: --- Begin node ---
[10/10/2023-10:53:57] [E] [TRT] ModelImporter.cpp:773: input: "Transpose_0_out"
output: "/transformers.0/self_attn/Reshape_5_output_0"
name: "MultiHeadAttention_0"
op_type: "MultiHeadAttention"
attribute {
  name: "num_heads"
  i: 4
  type: INT
}
domain: "com.microsoft"

[10/10/2023-10:53:57] [E] [TRT] ModelImporter.cpp:774: --- End node ---
[10/10/2023-10:53:57] [E] [TRT] ModelImporter.cpp:777: ERROR: builtin_op_importers.cpp:5404 In function importFallbackPluginImporter:
[8] Assertion failed: creator && "Plugin not found, are the plugin name, version, and namespace correct?"
[10/10/2023-10:53:57] [E] Failed to parse onnx file
[10/10/2023-10:53:57] [I] Finished parsing network model. Parse time: 0.0864084
[10/10/2023-10:53:57] [E] Parsing model failed
[10/10/2023-10:53:57] [E] Failed to create engine from model or file.
[10/10/2023-10:53:57] [E] Engine set up failed

my tensorrt version is 8.6.1.6, onnxruntime = 1.16.0

fabio-sim commented 1 year ago

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

The fused models are intended to be run via ONNXRuntime as they use contrib operators (under the com.microsoft domain).

kajo-kurisu commented 1 year ago

thank u , i'll close this issue

fxlong commented 1 year ago

@kajo-kurisu 请问下,您转trt引擎转成功了吗

kajo-kurisu commented 1 year ago

@kajo-kurisu 请问下,您转trt引擎转成功了吗

我后来没用他的optimize.py ,用的onnx.simplify自己对onnx简化之后就能转化成功