WongKinYiu / yolov7

Implementation of paper - YOLOv7: Trainable bag-of-freebies sets new state-of-the-art for real-time object detectors
GNU General Public License v3.0
13.39k stars 4.23k forks source link

YOLOV7 converted to ONNX model error in opencv #977

Open Jagan3534 opened 2 years ago

Jagan3534 commented 2 years ago
> Node [Identity@ai.onnx]:(onnx_node!Identity_0) parse error: OpenCV(4.6.0) /io/opencv/modules/dnn/src/layer.cpp:246: error: (-215:Assertion failed) inputs.size() in function 'getMemoryShapes'

model = cv.dnn.readNetFromONNX("/content/yolov7/runs/train/exp/weights/best.onnx") i need to work in opencv could anyone give any referance for this i developed android app using yolov3 it generated .weights file but at present i need to update could anyone help to slove this

MrWwei commented 2 years ago

I have the same problem. You can change your pytorch version to 1.10, and try again. It seems your version is higher, so it has Identity node in onnx.

Jagan3534 commented 2 years ago

I tried, i got the same error in the pytorch 1.10 thank you for reply

Kaotc commented 2 years ago

I have the same problem and i solved. I changed the PyTorch version from 1.12.0 to 1.11.0 and onnx to 1.11.0 and again exported from .pt to .onnx.