提交 15df161b 编写于 作者: V Vadim Pisarevsky

Merge pull request #9959 from dkurt:reset_detection_outputs

......@@ -240,6 +240,9 @@ public:
if (numKept == 0)
{
// Set confidences to zeros.
Range ranges[] = {Range::all(), Range::all(), Range::all(), Range(2, 3)};
outputs[0](ranges).setTo(0);
return;
}
int outputShape[] = {1, 1, (int)numKept, 7};
......
......@@ -139,6 +139,35 @@ TEST(Reproducibility_SSD, Accuracy)
normAssert(ref, out);
}
TEST(Reproducibility_MobileNet_SSD, Accuracy)
{
const string proto = findDataFile("dnn/MobileNetSSD_deploy.prototxt", false);
const string model = findDataFile("dnn/MobileNetSSD_deploy.caffemodel", false);
Net net = readNetFromCaffe(proto, model);
Mat sample = imread(_tf("street.png"));
Mat inp = blobFromImage(sample, 1.0f / 127.5, Size(300, 300), Scalar(127.5, 127.5, 127.5), false);
net.setInput(inp);
Mat out = net.forward();
Mat ref = blobFromNPY(_tf("mobilenet_ssd_caffe_out.npy"));
normAssert(ref, out);
// Check that detections aren't preserved.
inp.setTo(0.0f);
net.setInput(inp);
out = net.forward();
const int numDetections = out.size[2];
ASSERT_NE(numDetections, 0);
for (int i = 0; i < numDetections; ++i)
{
float confidence = out.ptr<float>(0, 0, i)[2];
ASSERT_EQ(confidence, 0);
}
}
TEST(Reproducibility_ResNet50, Accuracy)
{
Net net = readNetFromCaffe(findDataFile("dnn/ResNet-50-deploy.prototxt", false),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册