I used the function to get the model without get any error.
“torch.onnx.export(net, img_tensor, output, verbose=False, opset_version=11)”
I’m trying to load onnx as title, but get error below.
[ERROR:0] global /data_2t/sam/CentOS/opencv_build/opencv/modules/dnn/src/onnx/onnx_importer.cpp (694) handleNode DNN/ONNX: ERROR during processing node with 2 inputs and 1 outputs: [MatMul]:(2060)
terminate called after throwing an instance of 'cv::Exception'
what(): OpenCV(4.5.3-dev) /data_2t/sam/CentOS/opencv_build/opencv/modules/dnn/src/onnx/onnx_importer.cpp:713: error: (-2:Unspecified error) in function 'handleNode'
> Node [MatMul]:(2060) parse error: OpenCV(4.5.3-dev) /data_2t/sam/CentOS/opencv_build/opencv/modules/dnn/src/onnx/onnx_importer.cpp:1475: error: (-215:Assertion failed) constBlobs.find(node_proto.input(0)) == constBlobs.end() in function 'parseMatMul'
>
Aborted (core dumped)
The error happen at the node [2060] which mapped to the network at line 23
in MHSA.py I thought.
Here I produce the model with no pre-train version and how I load my model code.