Ask Your Question

Revision history [back]

I am getting bug while performing open cv based dnn face detection

error: OpenCV(3.4.2) C:\Miniconda3\conda-bld\opencv-suite_1534379934306\work\modules\dnn\src\layers\convolution_layer.cpp:236: error: (-215:Assertion failed) ngroups > 0 && inpCn % ngroups == 0 && outCn % ngroups == 0 in function 'cv::dnn::ConvolutionLayerImpl::getMemoryShapes'

This is the error amm getting I tried converting image to grayscale but it didnt worked please help its very important to me

click to hide/show revision 2
None

updated 2019-08-12 13:08:37 -0600

berak gravatar image

I am getting bug while performing open cv based dnn face detection

error: OpenCV(3.4.2) C:\Miniconda3\conda-bld\opencv-suite_1534379934306\work\modules\dnn\src\layers\convolution_layer.cpp:236: error: (-215:Assertion failed) ngroups > 0 && inpCn % ngroups == 0 && outCn % ngroups == 0 in function 'cv::dnn::ConvolutionLayerImpl::getMemoryShapes'

This is the error amm getting I tried converting image to grayscale but it didnt worked please help its very important to me

error: OpenCV(3.4.2) C:\Miniconda3\conda-bld\opencv-suite_1534379934306\work\modules\dnn\src\layers\convolution_layer.cpp:236: error: (-215:Assertion failed) ngroups > 0 && inpCn % ngroups == 0 && outCn % ngroups == 0 in function 'cv::dnn::ConvolutionLayerImpl::getMemoryShapes'

I am getting bug while performing open cv based dnn face detection

This is the error amm am getting I tried converting image to grayscale but it didnt worked please help its very important to me

error: OpenCV(3.4.2) C:\Miniconda3\conda-bld\opencv-suite_1534379934306\work\modules\dnn\src\layers\convolution_layer.cpp:236: error: (-215:Assertion failed) ngroups > 0 && inpCn % ngroups == 0 && outCn % ngroups == 0 in function 'cv::dnn::ConvolutionLayerImpl::getMemoryShapes'

I am getting bug while performing open cv based dnn face detection

This is the error am getting I tried converting image to grayscale but it didnt worked please help its very important to me

error: OpenCV(3.4.2) C:\Miniconda3\conda-bld\opencv-suite_1534379934306\work\modules\dnn\src\layers\convolution_layer.cpp:236: error: (-215:Assertion failed) ngroups > 0 && inpCn % ngroups == 0 && outCn % ngroups == 0 in function 'cv::dnn::ConvolutionLayerImpl::getMemoryShapes'

my code

import numpy as np import argparse import cv2

print("[INFO] loading model...") net = cv2.dnn.readNetFromCaffe('pk.prototxt.txt','sd.caffemodel')

image = cv2.imread('f7.jpg',cv2.IMREAD_GRAYSCALE)

(h, w) = image.shape[:2] blob = cv2.dnn.blobFromImage(cv2.resize(image, (300,300)), 1.0, (300,300), (104.0, 177.0, 123.0)) net.setInput(blob) detections = net.forward() // here am getting an error

for i in range(0, detections.shape[2]): # extract the confidence (i.e., probability) associated with the # prediction confidence = detections[0, 0, i, 2]

if confidence > 0.5:
    box = detections[0, 0, i, 3:7] * np.array([w, h, w, h])
    (startX, startY, endX, endY) = box.astype("int")
    text = "{:.2f}%".format(confidence * 100)
    y = startY - 10 if startY - 10 > 10 else startY + 10
    cv2.rectangle(image, (startX, startY), (endX, endY),
        (0, 0, 255), 2)
    cv2.putText(image, text, (startX, y),
        cv2.FONT_HERSHEY_SIMPLEX, 0.45, (0, 0, 255), 2)

cv2.imshow("Output", image) cv2.waitKey(0)

error - error: OpenCV(3.4.2) C:\Miniconda3\conda-bld\opencv-suite_1534379934306\work\modules\dnn\src\layers\convolution_layer.cpp:236: error: (-215:Assertion failed) ngroups > 0 && inpCn % ngroups == 0 && outCn % ngroups == 0 in function 'cv::dnn::ConvolutionLayerImpl::getMemoryShapes'

I am getting bug while performing open cv based dnn face detection

This is the error am getting I tried converting image to grayscale but it didnt worked please help its very important to me

I am using this prototxt https://github.com/sghoshcvc/TextBox-Models/blob/master/textbox_deploy.prototxt

error: OpenCV(3.4.2) C:\Miniconda3\conda-bld\opencv-suite_1534379934306\work\modules\dnn\src\layers\convolution_layer.cpp:236: error: (-215:Assertion failed) ngroups > 0 && inpCn % ngroups == 0 && outCn % ngroups == 0 in function 'cv::dnn::ConvolutionLayerImpl::getMemoryShapes'

my code

import numpy as np import argparse import cv2

print("[INFO] loading model...") net = cv2.dnn.readNetFromCaffe('pk.prototxt.txt','sd.caffemodel')

image = cv2.imread('f7.jpg',cv2.IMREAD_GRAYSCALE)

(h, w) = image.shape[:2] blob = cv2.dnn.blobFromImage(cv2.resize(image, (300,300)), 1.0, (300,300), (104.0, 177.0, 123.0)) net.setInput(blob) detections = net.forward() // here am getting an error

for i in range(0, detections.shape[2]): # extract the confidence (i.e., probability) associated with the # prediction confidence = detections[0, 0, i, 2]

if confidence > 0.5:
    box = detections[0, 0, i, 3:7] * np.array([w, h, w, h])
    (startX, startY, endX, endY) = box.astype("int")
    text = "{:.2f}%".format(confidence * 100)
    y = startY - 10 if startY - 10 > 10 else startY + 10
    cv2.rectangle(image, (startX, startY), (endX, endY),
        (0, 0, 255), 2)
    cv2.putText(image, text, (startX, y),
        cv2.FONT_HERSHEY_SIMPLEX, 0.45, (0, 0, 255), 2)

cv2.imshow("Output", image) cv2.waitKey(0)

error - error: OpenCV(3.4.2) C:\Miniconda3\conda-bld\opencv-suite_1534379934306\work\modules\dnn\src\layers\convolution_layer.cpp:236: error: (-215:Assertion failed) ngroups > 0 && inpCn % ngroups == 0 && outCn % ngroups == 0 in function 'cv::dnn::ConvolutionLayerImpl::getMemoryShapes'

click to hide/show revision 6
None

updated 2019-08-12 13:24:28 -0600

berak gravatar image

I am getting bug while performing open cv based dnn face detection

This is the error am getting I tried converting image to grayscale but it didnt worked please help its very important to me

I am using this prototxt https://github.com/sghoshcvc/TextBox-Models/blob/master/textbox_deploy.prototxt

error: OpenCV(3.4.2) C:\Miniconda3\conda-bld\opencv-suite_1534379934306\work\modules\dnn\src\layers\convolution_layer.cpp:236: error: (-215:Assertion failed) ngroups > 0 && inpCn % ngroups == 0 && outCn % ngroups == 0 in function 'cv::dnn::ConvolutionLayerImpl::getMemoryShapes'

my code

import numpy as np
import argparse
import cv2

cv2 print("[INFO] loading model...") net = cv2.dnn.readNetFromCaffe('pk.prototxt.txt','sd.caffemodel')

cv2.dnn.readNetFromCaffe('pk.prototxt.txt','sd.caffemodel') image = cv2.imread('f7.jpg',cv2.IMREAD_GRAYSCALE)

cv2.imread('f7.jpg',cv2.IMREAD_GRAYSCALE) (h, w) = image.shape[:2] blob = cv2.dnn.blobFromImage(cv2.resize(image, (300,300)), 1.0, (300,300), (104.0, 177.0, 123.0)) net.setInput(blob) detections = net.forward() **detections = net.forward()** // here am getting an error

error for i in range(0, detections.shape[2]): # extract the confidence (i.e., probability) associated with the # prediction confidence = detections[0, 0, i, 2]

2]

    if confidence > 0.5:
     box = detections[0, 0, i, 3:7] * np.array([w, h, w, h])
     (startX, startY, endX, endY) = box.astype("int")
     text = "{:.2f}%".format(confidence * 100)
     y = startY - 10 if startY - 10 > 10 else startY + 10
     cv2.rectangle(image, (startX, startY), (endX, endY),
         (0, 0, 255), 2)
     cv2.putText(image, text, (startX, y),
         cv2.FONT_HERSHEY_SIMPLEX, 0.45, (0, 0, 255), 2)

cv2.imshow("Output", image) cv2.waitKey(0)

cv2.waitKey(0) error - error: OpenCV(3.4.2) C:\Miniconda3\conda-bld\opencv-suite_1534379934306\work\modules\dnn\src\layers\convolution_layer.cpp:236: error: (-215:Assertion failed) ngroups > 0 && inpCn % ngroups == 0 && outCn % ngroups == 0 in function 'cv::dnn::ConvolutionLayerImpl::getMemoryShapes'

'cv::dnn::ConvolutionLayerImpl::getMemoryShapes'

I am getting bug while performing open cv based dnn face detection

This is the error am getting I tried converting image to grayscale but it didnt worked please help its very important to me

error: OpenCV(3.4.2) C:\Miniconda3\conda-bld\opencv-suite_1534379934306\work\modules\dnn\src\layers\convolution_layer.cpp:236: error: (-215:Assertion failed) ngroups > 0 && inpCn % ngroups == 0 && outCn % ngroups == 0 in function 'cv::dnn::ConvolutionLayerImpl::getMemoryShapes'

my code

import numpy as np
import argparse
import cv2

print("[INFO] loading model...")
net = cv2.dnn.readNetFromCaffe('pk.prototxt.txt','sd.caffemodel')

image = cv2.imread('f7.jpg',cv2.IMREAD_GRAYSCALE)
cv2.imread('f7.jpg')

(h, w) = image.shape[:2]
blob = cv2.dnn.blobFromImage(cv2.resize(image, (300,300)), 1.0,
    (300,300), (104.0, 177.0, 123.0))
net.setInput(blob)
**detections = net.forward()** // here am getting an error

for i in range(0, detections.shape[2]):
    # extract the confidence (i.e., probability) associated with the
    # prediction
    confidence = detections[0, 0, i, 2]

    if confidence > 0.5:
        box = detections[0, 0, i, 3:7] * np.array([w, h, w, h])
        (startX, startY, endX, endY) = box.astype("int")
        text = "{:.2f}%".format(confidence * 100)
        y = startY - 10 if startY - 10 > 10 else startY + 10
        cv2.rectangle(image, (startX, startY), (endX, endY),
            (0, 0, 255), 2)
        cv2.putText(image, text, (startX, y),
            cv2.FONT_HERSHEY_SIMPLEX, 0.45, (0, 0, 255), 2)
cv2.imshow("Output", image)
cv2.waitKey(0)

error -   error: OpenCV(3.4.2) C:\Miniconda3\conda-bld\opencv-suite_1534379934306\work\modules\dnn\src\layers\convolution_layer.cpp:236: error: (-215:Assertion failed) ngroups > 0 && inpCn % ngroups == 0 && outCn % ngroups == 0 in function 'cv::dnn::ConvolutionLayerImpl::getMemoryShapes'

I am getting bug while performing open cv based dnn face detection

This is the error am getting I tried converting image to grayscale but it didnt worked please help its very important to me

error: OpenCV(3.4.2) C:\Miniconda3\conda-bld\opencv-suite_1534379934306\work\modules\dnn\src\layers\convolution_layer.cpp:236: 

C:\Miniconda3\conda-bld\opencv-suite_1534379934306\work\modules\dnn\src\layers\convolution_layer.cpp:212: error: (-215:Assertion failed) ngroups > 0 && inpCn % ngroups == 0 && outCn % ngroups == blobs.size() != 0 in function 'cv::dnn::ConvolutionLayerImpl::getMemoryShapes'

'cv::dnn::ConvolutionLayerImpl::getMemoryShapes''

my code

import numpy as np
import argparse
import cv2

print("[INFO] loading model...")
net = cv2.dnn.readNetFromCaffe('pk.prototxt.txt','sd.caffemodel')

image = cv2.imread('f7.jpg')

(h, w) = image.shape[:2]
blob = cv2.dnn.blobFromImage(cv2.resize(image, (300,300)), 1.0,
    (300,300), (104.0, 177.0, 123.0))
net.setInput(blob)
**detections = net.forward()** // here am getting an error

for i in range(0, detections.shape[2]):
    # extract the confidence (i.e., probability) associated with the
    # prediction
    confidence = detections[0, 0, i, 2]

    if confidence > 0.5:
        box = detections[0, 0, i, 3:7] * np.array([w, h, w, h])
        (startX, startY, endX, endY) = box.astype("int")
        text = "{:.2f}%".format(confidence * 100)
        y = startY - 10 if startY - 10 > 10 else startY + 10
        cv2.rectangle(image, (startX, startY), (endX, endY),
            (0, 0, 255), 2)
        cv2.putText(image, text, (startX, y),
            cv2.FONT_HERSHEY_SIMPLEX, 0.45, (0, 0, 255), 2)
cv2.imshow("Output", image)
cv2.waitKey(0)

error -   error: OpenCV(3.4.2) C:\Miniconda3\conda-bld\opencv-suite_1534379934306\work\modules\dnn\src\layers\convolution_layer.cpp:236: C:\Miniconda3\conda-bld\opencv-suite_1534379934306\work\modules\dnn\src\layers\convolution_layer.cpp:212: error: (-215:Assertion failed) ngroups > 0 && inpCn % ngroups == 0 && outCn % ngroups == blobs.size() != 0 in function 'cv::dnn::ConvolutionLayerImpl::getMemoryShapes'