Assertion failed at getMemoryShapes in dnn

asked 2018-03-20 08:18:12 -0500

KlaimNod gravatar image

updated 2018-03-20 08:46:36 -0500


I've been trying to run a face detector by using FaceBoxes ( by creating a network via the use of readNetFromCaffe and prototext, caffemodel available there. But when I try to obtain the output of the 'net' I create I run into the following issue; image description

String modelConfiguration = "D:/FaceBoxes-master/FaceBoxes-master/faceboxes_deploy.prototxt";
String modelBinary = "D:/FaceBoxes-master/FaceBoxes-master/FaceBoxes_1024x1024.caffemodel";
dnn::Net net = readNetFromCaffe(modelConfiguration, modelBinary);
vector<String> layers = net.getLayerNames();
for (int i = 0; i < layers.size(); i++)
    cout << layers[i] << endl;
Mat img = imread("D:/USERDATA/VUT58IL/Faces/Male/3.jpg");
resize(img, img, Size(1024, 1024), CV_INTER_CUBIC);
Mat inBlob = blobFromImage(img, 0.007843, Size(1024, 1024), Scalar::all(127.5), false, false);
net.setInput(inBlob, "data");
Mat out = net.forward("detection_out");

I am unable to find any solutions for this. Any help is greatly appreciated. Thank you!

edit retag flag offensive close merge delete


@KlaimNod, If you can recompile OpenCV, comment a line CV_Assert(!_aspectRatios.empty(), _minSize > 0);at Then remove all the aspect_ratio: 1 from .prototxt.

dkurt gravatar imagedkurt ( 2018-03-21 06:41:07 -0500 )edit

@KlaimNod, There is also a bug in batch norm layer (where use_global_stats is set to false). We'll fix it and prior boxes generator in the future PR. Thank you!

dkurt gravatar imagedkurt ( 2018-03-22 00:22:31 -0500 )edit

@dkurt, Thank you for the reply! Will try to recompile OpenCV but any rough estimate as to when the fix will be pushed?

KlaimNod gravatar imageKlaimNod ( 2018-03-22 08:26:37 -0500 )edit
dkurt gravatar imagedkurt ( 2018-03-22 10:47:09 -0500 )edit

@KlaimNod @dkrut I'm still getting the same/similar error ... in the dnn class: try { layerSupportInPlace = l->getMemoryShapes(is, requiredOutputs, os, ints); }

Im trying to use with its pretrained model. To change the .prototxt file didnt help, I think i misunderstood you solution, can you gibe me a hint how to fix it? Thank you for your time

nowen gravatar imagenowen ( 2020-10-26 09:09:41 -0500 )edit