Hello, i am trying to get the face detector caffe model working for a server app. I tries to use this https://docs.opencv.org/master/d5/d86/tutorial_dnn_javascript.html and this https://www.pyimagesearch.com/2018/02/26/face-detection-with-opencv-and-deep-learning/ as a template - but somehow the result from the net is always empty. I made sure the input image exists and contains a face. I am not sure what i am doing wrong, i even made sure the input dimensions for the model (300, 300) are correct.
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/dnn.hpp"
#include <math.h>
#include <iostream>
using namespace cv;
using namespace std;
using namespace dnn;
int main( int argc, char** argv)
{
Net reconNet = readNetFromCaffe("face_detector.prototxt", "face_detector.caffemodel");
Mat img = imread("./arni/arni.jpg");
//resize to target dimensions
resize(img, img, Size(300, 300));
//debugging
imwrite("arni_resized.jpg", img);
Mat blob = blobFromImage(img, 1.0, Size(300, 300), Scalar(104.0, 177.0, 123.0), false, false);
reconNet.setInput(blob);
Mat result = reconNet.forward().clone();
cout << "result from net " << result << endl;
return 0;
}
Any hint is highly welcome.