Skip to content

Add a text message for Convolution layer's input channels check - #13599

Merged
opencv-pushbot merged 1 commit into
opencv:3.4from
dkurt:dnn_conv_error_msg
Jan 9, 2019
Merged

opencv-pushbot merged 1 commit into
opencv:3.4from
dkurt:dnn_conv_error_msg

Conversation

@dkurt

@dkurt dkurt commented Jan 9, 2019 •

Copy link
Copy Markdown
Member

This pullrequest changes

Add a error message for convolutional layer in case of wrong input channels (most frequent is BGRA instead of BGR).

import cv2 as cv
import numpy as np

net = cv.dnn.readNet('opencv_face_detector.caffemodel', 'opencv_face_detector.prototxt')
inp = np.random.standard_normal([1, 4, 300, 300]).astype(np.float32)
net.setInput(inp)
out = net.forward()
Traceback (most recent call last):
  File "run.py", line 8, in <module>
    out = net.forward()
cv2.error: OpenCV(3.4.5-dev) /path/to/opencv/modules/dnn/src/layers/convolution_layer.cpp:263: error: (-2:Unspecified error) Number of input channels should be multiple of 3 but got 4 in function 'getMemoryShapes'

@alalek alalek left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you 👍

@opencv-pushbot
opencv-pushbot merged commit d0504c9 into opencv:3.4 Jan 9, 2019
@alalek alalek mentioned this pull request Jan 10, 2019
@dkurt
dkurt deleted the dnn_conv_error_msg branch May 6, 2019 05:50
SavyaSanchi-Sharma pushed a commit to SavyaSanchi-Sharma/opencv that referenced this pull request Jul 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants