Skip to content

Commit 3542c98

Browse files
committed
Merge pull request opencv#10445 from pengli:dnn
2 parents 73c2a12 + 00f03c5 commit 3542c98

File tree

2 files changed

+29
-3
lines changed

2 files changed

+29
-3
lines changed

modules/dnn/src/dnn.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1123,13 +1123,13 @@ struct Net::Impl
11231123
{
11241124
if (use_umat)
11251125
{
1126+
std::vector<Mat> input_mats(ld.umat_inputBlobs.size());;
11261127
std::vector<Mat*> inputs(ld.umat_inputBlobs.size());;
11271128
std::vector<Mat> outputs(ld.umat_outputBlobs.size());
1128-
Mat mat;
11291129
for (int i = 0; i < inputs.size(); i++)
11301130
{
1131-
mat = ld.umat_inputBlobs[i].getMat(ACCESS_READ);
1132-
inputs[i] = &mat;
1131+
input_mats[i] = ld.umat_inputBlobs[i].getMat(ACCESS_READ);
1132+
inputs[i] = &input_mats[i];
11331133
}
11341134
for (int i = 0; i < outputs.size(); i++)
11351135
{

modules/dnn/test/test_layers.cpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -600,4 +600,30 @@ TEST(Layer_Test_FasterRCNN_Proposal, Accuracy)
600600
EXPECT_EQ(countNonZero(out.rowRange(numDets, out.size[0])), 0);
601601
}
602602

603+
OCL_TEST(Layer_Test_FasterRCNN_Proposal, Accuracy)
604+
{
605+
Net net = readNetFromCaffe(_tf("net_faster_rcnn_proposal.prototxt"));
606+
607+
net.setPreferableBackend(DNN_BACKEND_DEFAULT);
608+
net.setPreferableTarget(DNN_TARGET_OPENCL);
609+
610+
Mat scores = blobFromNPY(_tf("net_faster_rcnn_proposal.scores.npy"));
611+
Mat deltas = blobFromNPY(_tf("net_faster_rcnn_proposal.deltas.npy"));
612+
Mat imInfo = (Mat_<float>(1, 3) << 600, 800, 1.6f);
613+
Mat ref = blobFromNPY(_tf("net_faster_rcnn_proposal.npy"));
614+
615+
net.setInput(scores, "rpn_cls_prob_reshape");
616+
net.setInput(deltas, "rpn_bbox_pred");
617+
net.setInput(imInfo, "im_info");
618+
619+
Mat out = net.forward();
620+
621+
const int numDets = ref.size[0];
622+
EXPECT_LE(numDets, out.size[0]);
623+
normAssert(out.rowRange(0, numDets), ref);
624+
625+
if (numDets < out.size[0])
626+
EXPECT_EQ(countNonZero(out.rowRange(numDets, out.size[0])), 0);
627+
}
628+
603629
}

0 commit comments

Comments
 (0)