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()
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'
System information (version)
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.
Issue submission checklist
forum.opencv.org, Stack Overflow, etc and have not found solution