Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

application stopped working with caffe network dnn module, forward()

Hello,

i am implementing a facedetector in opencv, Single Stage Headless detector SSH using the pretrained model provided, modifying the .prototxt file to be compatible without python layers accordingly to the example described in faster_rcnn_opencv which would be something like the following for each of the python proposal layers:

layer {
name: 'm2@ssh_proposal'
type: 'Proposal'
bottom: 'm2@ssh_cls_prob_reshape_output'
bottom: 'm2@ssh_bbox_pred_output'
bottom: 'im_info'
top: 'm2@ssh_boxes'
top: 'm2@ssh_cls_prob'
proposal_param {
feat_stride: 16
scale: 4
scale: 8
ratio: 1
}
}

and my code looks like:

String model = "SSH.caffemodel";
String proto = "SSH.prototxt";
Net SSH_net = readNetFromCaffe(proto, model);

Mat img = imread("test.jpg");
resize(img, img, Size(224, 224));
img = img - Scalar(102.9801, 115.9465, 122.7717);

Mat inputBlob = blobFromImage(img, 1.0f, Size(), Scalar(), true, false);
Mat imInfo = (Mat_<double>(1, 3) << 224, 224, 1);

SSH_net.setInput(inputBlob, "data");
SSH_net.setInput(imInfo, "im_info");

SSH_net.forward();

The network is being created succesfully, but at the moment of forwarding the network it just crashes.. I havent found any workaround for this, does anyone has any suggestions or ideas? or have been facing this issue? Any help is appreciated! thank you!