YOLO-World icon indicating copy to clipboard operation
YOLO-World copied to clipboard

Result dismatch between onnx and image_demo.py

Open taofuyu opened this issue 1 year ago • 11 comments

I use this config and its weight to run image_demo.py by --text 'person,tree', the result is: 000000000872

I export this pre-trained model to onnx, and then inference this onnx model, the result is: dd

As you can see, these scores are different. I have checked that input images are same.

taofuyu avatar Mar 21 '24 09:03 taofuyu

@taofuyu, are the categories the same between the two models?

wondervictor avatar Mar 21 '24 16:03 wondervictor

@taofuyu, are the categories the same between the two models?

yes, when exporting ONNX, I use the same categories as image_demo.py. You could verify this, maybe I mistake something.

taofuyu avatar Mar 22 '24 01:03 taofuyu

infer_onnx.txt And this is my script to inference onnx, maybe can help someone. It detaches YOLOv5KeepRatioResize and LetterResize from mmyolo, which are used in the test_pipeline of config, to ensure the input of onnx is same as image_demo.py.

taofuyu avatar Mar 22 '24 02:03 taofuyu

Nice work, I'll check it.

wondervictor avatar Mar 22 '24 04:03 wondervictor

updates: a very strange phenomenon, parameters in exported onnx and corresponding checkpoint are different. Take the BN of the first conv layer as an example: 1711097302143 1711097351440

taofuyu avatar Mar 22 '24 08:03 taofuyu

BN and Convolution are fused. See: https://pytorch.org/tutorials/intermediate/custom_function_conv_bn_tutorial.html

wondervictor avatar Mar 22 '24 09:03 wondervictor

Hello, any updates ?

taofuyu avatar Apr 03 '24 03:04 taofuyu

Hi @taofuyu, I'll check it as soon as possible in these days. Please let me know if you have any updates.

wondervictor avatar Apr 03 '24 08:04 wondervictor

Hi, how's it going so far? It's been almost 3 months.

ccl-private avatar Jun 28 '24 07:06 ccl-private

I found this issue on mmdeploy. https://github.com/open-mmlab/mmdeploy/issues/1903 I don't know if there is any direct connection between the two

ccl-private avatar Jun 28 '24 08:06 ccl-private

@wondervictor @taofuyu

ccl-private avatar Jun 28 '24 08:06 ccl-private