I use yolov5 to train a data set myself, and then get an error through opencv:
C:\Users\admin\.conda\envs\yolov5\python.exe D:\Demo\yolov5\test_onnx.py
[ERROR:0@0.012] global onnx_importer.cpp:1054 cv::dnn::dnn4_v20221220::ONNXImporter::handleNode DNN/ONNX: ERROR during processing node with 3 inputs and 1 outputs: [Conv]:(onnx_node!/model.2/m/m.0/cv1/conv/Conv) from domain='ai.onnx'
Traceback (most recent call last):
File "D:\Demo\yolov5\test_onnx.py", line 2, in <module>
net = cv2.dnn.readNetFromONNX('runs/train/exp8/weights/best.onnx')
cv2.error: OpenCV(4.7.0) D:\a\opencv-python\opencv-python\opencv\modules\dnn\src\onnx\onnx_importer.cpp:1073: error: (-2:Unspecified error) in function 'cv::dnn::dnn4_v20221220::ONNXImporter::handleNode'
> Node [Conv@ai.onnx]:(onnx_node!/model.2/m/m.0/cv1/conv/Conv) parse error: OpenCV(4.7.0) D:\a\opencv-python\opencv-python\opencv\modules\dnn\src\layers\convolution_layer.cpp:394: error: (-215:Assertion failed) !hasBias() || blobs[1].total() == (size_t)weightShape[0] in function 'cv::dnn::ConvolutionLayerImpl::getMemoryShapes'
I see that the best.pt file generated by yolov5 is detected and evaluated normally, and it is converted into an onnx model, and an error is reported with opencv