Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Face detection model doesn't detect any face (OpenCV with IE)

Hi, I've compile OpenCV with inference engine (IE) successfully. Since I'm using OpenCVSharp, I've also complied it with OpenCV with IE. Then, when I try to detect faces with the model face-detection-adas-0001 it doesn't detect any faces. The model is loaded successfully, it seems to do the foward pass but the output Mat has always col=-1 and row=-1. Although I'm using C#, if someone has already used this model in C++, please clarify how the input blob should be. I think that is probably what I'm getting wrong. Here is the code:

var net = CvDnn.ReadNet(model, modeltxt);
var image = System.IO.Path.Combine(Location, sampleImage);
var frame = Cv2.ImRead(image);
net.SetPreferableBackend(Net.Backend.INFERENCE_ENGINE);
net.SetPreferableTarget(Net.Target.CPU);

var frame = Cv2.ImRead(image);
var test = new Mat();
frame.ConvertTo(test, MatType.CV_8U);
var blob = CvDnn.BlobFromImage(test, 1.0, new OpenCvSharp.Size(672, 384), default, false, false);
net.SetInput(blob);
var outNames = net.GetUnconnectedOutLayersNames();

using (var predictions = net.Forward(outNames[0]))
{
       PrintMat(predictions);
}

image description

Thanks!