My environment is windows 7 x64 tensorflow 1.12 GPU:GTX1060 visual studio 2015 and the dataset has only 1 class. I trained a faster_rcnn_inception_v2_coco model by tensorflow-object detection api, then I did the inference by the C++ code like:
string weights = "C:\\tf_od_api\\models\\faster_rcnn_inception_v2_coco\\pb\\frozen_inference_graph.pb";
string prototxt = "C:\\tf_od_api\\models\\faster_rcnn_inception_v2_coco\\pb\\graph.pbtxt";
cv::dnn::Net net = cv::dnn::readNetFromTensorflow(weights, prototxt);
cv::Mat frame = cv::imread("C:\\hsir\\build\\bin\\test\\test-c1-1.bmp");
cv::Mat blob = cv::dnn::blobFromImage(frame, 1, cv::Size(inWidth, inHeight), false, true);
net.setInput(blob);
cv::Mat outPut = net.forward();
cv::Mat detectionMat = cv::Mat(outPut.size[2], outPut.size[3], CV_32F, outPut.ptr<float>());
it works fine by my code with opencv 4.0.0 and 4.0.1 installed by win-pack, but I tried to put it in a project of my team which seems to use customized opencv from 4.0.0, then the detectionMat is totally wrong. I traced the bug and just copied the same code into a function of the project, but the result was still wrong. There was no error or warning shows up and nothing wrong with reading the model, image and forward(); The correct result should be only one object detected with confidence 1.0 and the others with confidence 0.0. The wrong result has 100 objects detected with 0.5~0.99 confidences but none of them close to the real object.
Does anyone know what is wrong with the