I get the following error when trying to test the yolov5.onxx
model with opencv
File "yolov5_opnecv.py", line 119, in <module>
outs = detect(inputImage, net)
File "yolov5_opnecv.py", line 28, in detect
preds = net.forward()
cv2.error: OpenCV(4.5.4) /tmp/pip-req-build-24v3eisa/opencv/modules/dnn/src/layers/reshape_layer.cpp:106: error: (-215:Assertion failed) total(srcShape, srcRange.start, srcRange.end) == maskTotal in function 'computeShapeByReshapeMask'
blob = cv2.dnn.blobFromImage(image, 1/255.0, (INPUT_WIDTH, INPUT_HEIGHT), swapRB=True, crop=False)
On this line the input image dimensions should be the same ones as the network was trained on. Mine was 640x640