Open WorldTreeBug opened 2 years ago
Having a similar error
[ERROR:0@2.127] global C:/M/mingw-w64-opencv/src/opencv-4.6.0/modules/dnn/src/onnx/onnx_importer.cpp (1018) handleNode DNN/ONNX: ERROR during processing node with 1 inputs and 1 outputs: [Identity]:(onnx_node!Identity_0) from domain='ai.onnx' OpenCV: terminate handler is called! The last OpenCV error is: OpenCV(4.6.0) Error: Unspecified error (> Node [Identity@ai.onnx]:(onnx_node!Identity_0) parse error: OpenCV(4.6.0) C:/M/mingw-w64-opencv/src/opencv-4.6.0/modules/dnn/src/layer.cpp:246: error: (-215:Assertion failed) inputs.size() in function 'getMemoryShapes' ) in handleNode, file C:/M/mingw-w64-opencv/src/opencv-4.6.0/modules/dnn/src/onnx/onnx_importer.cpp, line 1040
- 从以下链接下载 yolov5n-face.pt:https://drive.google.com/file/d/18oenL6tjFkdR1f5IgpYeQfDFqU4w3jEr/view?usp=sharing
- 通过脚本生成的 onnx 文件 export.py
export PYTHONPATH="$PWD" && python export.py --weights weights/yolov5n-face.pt --img 640 --batch 1
- 尝试使用生成的onnx文件运行opencv演示(yolov5-face-landmarks-opencv-v2),但失败了
[ERROR:0@0.287] global /Users/runner/work/opencv-python/opencv-python/opencv/modules/dnn/src/onnx/onnx_importer.cpp (1021) handleNode DNN/ONNX: ERROR during processing node with 1 inputs and 1 outputs: [Identity]:(onnx_node!Identity_0) from domain='ai.onnx' Traceback (most recent call last): File "/faceDetection/yolov5-face-landmarks-opencv-v2/main.py", line 114, in <module> yolonet = yolov5(args.yolo_type, confThreshold=args.confThreshold, nmsThreshold=args.nmsThreshold, objThreshold=args.objThreshold) File "/faceDetection/yolov5-face-landmarks-opencv-v2/main.py", line 17, in __init__ self.net = cv2.dnn.readNet(yolo_type+'-face.onnx') cv2.error: OpenCV(4.6.0) /Users/runner/work/opencv-python/opencv-python/opencv/modules/dnn/src/onnx/onnx_importer.cpp:1040: error: (-2:Unspecified error) in function 'handleNode' \> Node [Identity@ai.onnx]:(onnx_node!Identity_0) parse error: OpenCV(4.6.0) /Users/runner/work/opencv-python/opencv-python/opencv/modules/dnn/src/layer.cpp:246: error: (-215:Assertion failed) inputs.size() in function 'getMemoryShapes'
来自yolov5-face-landmarks-opencv-v2演示main_export_onnx.py脚本无法生成onnx模型。
File "/faceDetection/yolov5-face/main_export_onnx.py", line 89, in forward x[0] = x[0].view(-1, self.no) TypeError: 'tuple' object does not support item assignment
请问有解决办法吗?我也在这里遇到了问题
Downloaded yolov5n-face.pt from the following link: https://drive.google.com/file/d/18oenL6tjFkdR1f5IgpYeQfDFqU4w3jEr/view?usp=sharing
Generated onnx file by export.py script
export PYTHONPATH="$PWD" && python export.py --weights weights/yolov5n-face.pt --img 640 --batch 1
[ERROR:0@0.287] global /Users/runner/work/opencv-python/opencv-python/opencv/modules/dnn/src/onnx/onnx_importer.cpp (1021) handleNode DNN/ONNX: ERROR during processing node with 1 inputs and 1 outputs: [Identity]:(onnx_node!Identity_0) from domain='ai.onnx' Traceback (most recent call last): File "/faceDetection/yolov5-face-landmarks-opencv-v2/main.py", line 114, in <module> yolonet = yolov5(args.yolo_type, confThreshold=args.confThreshold, nmsThreshold=args.nmsThreshold, objThreshold=args.objThreshold) File "/faceDetection/yolov5-face-landmarks-opencv-v2/main.py", line 17, in __init__ self.net = cv2.dnn.readNet(yolo_type+'-face.onnx') cv2.error: OpenCV(4.6.0) /Users/runner/work/opencv-python/opencv-python/opencv/modules/dnn/src/onnx/onnx_importer.cpp:1040: error: (-2:Unspecified error) in function 'handleNode' \> Node [Identity@ai.onnx]:(onnx_node!Identity_0) parse error: OpenCV(4.6.0) /Users/runner/work/opencv-python/opencv-python/opencv/modules/dnn/src/layer.cpp:246: error: (-215:Assertion failed) inputs.size() in function 'getMemoryShapes'
PS. main_export_onnx.py script from the yolov5-face-landmarks-opencv-v2 demo fails to generate onnx model.
File "/faceDetection/yolov5-face/main_export_onnx.py", line 89, in forward x[0] = x[0].view(-1, self.no) TypeError: 'tuple' object does not support item assignment