-
-
Notifications
You must be signed in to change notification settings - Fork 56.5k
YOLOv3 Incorrect Size of input array/Inconsistent shape for ConcatLayer in function 'getMemoryShapes' #16831
Copy link
Copy link
Closed
Labels
Description
System information (version)
- OpenCV => 4.2.0.32 (unofficial opencv-python)
- Operating System / Platform => Windows 64 Bit / WSL1 Ubuntu 18.04
- System => Python 3.6.8
Detailed description
I'm having trouble loading YOLOv3's into OpenCV's dnn module. I'm following this tutorial but instead of using the full YOLOv3 I'm using Tiny YOLOv3 trained on my own dataset. I run into the following error:
[ERROR:0] global /io/opencv/modules/dnn/src/dnn.cpp (3066) getLayerShapesRecursively OPENCV/DNN: [Concat]:(concat_20): getMemoryShapes() throws exception. inputs=2 outputs=1/1
[ERROR:0] global /io/opencv/modules/dnn/src/dnn.cpp (3069) getLayerShapesRecursively input[0] = [ 1 128 28 28 ]
[ERROR:0] global /io/opencv/modules/dnn/src/dnn.cpp (3069) getLayerShapesRecursively input[1] = [ 1 256 27 27 ]
[ERROR:0] global /io/opencv/modules/dnn/src/dnn.cpp (3073) getLayerShapesRecursively output[0] = [ 1 128 28 28 ]
[ERROR:0] global /io/opencv/modules/dnn/src/dnn.cpp (3075) getLayerShapesRecursively Exception message: OpenCV(4.2.0) /io/opencv/modules/dnn/src/layers/concat_layer.cpp:102: error: (-201:Incorrect size of input array) Inconsistent shape for ConcatLayer in function 'getMemoryShapes'
Traceback (most recent call last):
File "yolo-server.py", line 86, in <module>
layerOutputs = net.forward(ln)
cv2.error: OpenCV(4.2.0) /io/opencv/modules/dnn/src/layers/concat_layer.cpp:102: error: (-201:Incorrect size of input array) Inconsistent shape for ConcatLayer in function 'getMemoryShapes'I suspect the problem is with the network and the input loading image - but I'm loading a 416x416 image which should be resized in darknet. I suspect there's another problem with slicing or the cfg file. When running it through darknet works well.
Steps to reproduce
- Load code from this link
- cfg file can be found here
- weights etc can be found here
Issue submission checklist
- I report the issue, it's not a question
- I checked the problem with documentation, FAQ, open issues,
answers.opencv.org, Stack Overflow, etc and have not found solution - I updated to latest OpenCV version and the issue is still there
- There is reproducer code and related data files: videos, images, onnx, etc
Possibly related to the following Issues/PRs:
Reactions are currently unavailable