-
-
Notifications
You must be signed in to change notification settings - Fork 56.5k
onnx load error #20273
Copy link
Copy link
Closed
Labels
Milestone
Description
System information (version)
- OpenCV => 4.4.0
- Operating System / Platform => Ubuntu18.04
- Tested with Python 3.7 and onnx==1.9.0, opset_version=12
Detailed description
-
I export a onnx of SPIN model, a human pose estimation deep network, using onnx==1.9.0.
(https://github.com/nkolot/SPIN) -
Exporting the model was successful, but the following error occurred when onnx load using opencv.
import cv2
model = cv2.dnn.readNet('output.onnx')
cvimg = np.zeros((224,224, 3), np.uint8)
blob = cv2.dnn.blobFromImage(cvimg, 1.0 / 255.0, (224,224), (0.0, 0.0, 0.0), False, False);
model.setInput(blob)
prob = model.forward()
- Error message:
Traceback (most recent call last):
File "export_onnx.py", line 31, in <module>
prob = model.forward()
cv2.error: OpenCV(4.4.0) /tmp/pip-req-build-v7sdauef/opencv/modules/dnn/src/layers/fully_connected_layer.cpp:176: error: (-215:Assertion failed) srcMat.dims == 2 && srcMat.cols == weights.cols && dstMat.rows == srcMat.rows && dstMat.cols == weights.rows && srcMat.type() == weights.type() && weights.type() == dstMat.type() && srcMat.type() == CV_32F && (biasMat.empty() || (biasMat.type() == srcMat.type() && biasMat.isContinuous() && (int)biasMat.total() == dstMat.cols)) in function 'run'
- I guess the <1> node (concatenate) and <2> node(fully conneceted layer) are problem. The <1> node concatenates the previous layer[name: 508, (1x2048)] and the constant torch array init_pose(1x144), init_shape(1x10), init_cam(1x3). I wonder if the current version of opencv supports the process of concatenating an intermediate feature layer and a constant array and putting it as input to the fully connected layer. How can we solve this problem?
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 solution - I updated to 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
