-
-
Notifications
You must be signed in to change notification settings - Fork 56.5k
dnn onnx: invalid shape dimension and wrong results in test case Test_ONNX_layers.OpenAI_CLIP_head #24300
Copy link
Copy link
Closed
Labels
bugcategory: dnncategory: dnn (onnx)ONNX suport issues in DNN moduleONNX suport issues in DNN module
Description
System Information
latest opencv and lastest onnxruntime
Detailed description
Related PR: #23419 and opencv/opencv_extra#1049.
In the above PR, several fixes are indtroduced for the clip head. Those fixes are fine, but the manually generated onnx model named "clip-vit-base-head.onnx" is invalid and cannot be run by onnxruntime:
- In the Expand operator,
shapeinput should be of typeint64instead ofint32. Please useonnx.checker.check_model(model)(it checks operator definitions and so on) before saving a manually generated onnx model. - Having that fixed, onnxruntime still complains invalid shape in the Expand operator. Changing the shape value from [1, 1, -1] to [1, 1, 1] fixes the problem. Please run the manually generated onnx model with onnxruntime to check whether it is all valid.
cc @dkurt
Steps to reproduce
Install onnxruntime, then
import numpy as np
from onnxruntime import InferenceSession
net = InferenceSession("./clip-vit-base-head.onnx")
out = net.run([], {"input": np.random.randn(1, 1, 3).astype(np.float32)})
print(out[0].shape)
Issue submission checklist
- I report the issue, it's not a question
- I checked the problem with documentation, FAQ, open issues, forum.opencv.org, Stack Overflow, etc and have not found any solution
- I updated to the latest OpenCV version and the issue is still there
- There is reproducer code and related data files (videos, images, onnx, etc)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugcategory: dnncategory: dnn (onnx)ONNX suport issues in DNN moduleONNX suport issues in DNN module