From ca51bbb7ffe2c05379edd2b0078dddf05433b4d8 Mon Sep 17 00:00:00 2001 From: Wu Zhiwen Date: Wed, 29 Aug 2018 11:47:13 +0800 Subject: [PATCH] dnn: fix variance setting bug for PriorBoxLayer - The size of second channel should be size[2] of output tensor, - The Scalar should be {variance[0], variance[0], variance[0], variance[0]} for _variance.size() == 1 case. Signed-off-by: Wu Zhiwen --- modules/dnn/src/layers/prior_box_layer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/dnn/src/layers/prior_box_layer.cpp b/modules/dnn/src/layers/prior_box_layer.cpp index 6be6efa8a6..d4ffbbaa97 100644 --- a/modules/dnn/src/layers/prior_box_layer.cpp +++ b/modules/dnn/src/layers/prior_box_layer.cpp @@ -453,8 +453,8 @@ public: outputPtr = outputs[0].ptr(0, 1); if(_variance.size() == 1) { - Mat secondChannel(outputs[0].size[2], outputs[0].size[3], CV_32F, outputPtr); - secondChannel.setTo(Scalar(_variance[0])); + Mat secondChannel(1, outputs[0].size[2], CV_32F, outputPtr); + secondChannel.setTo(Scalar::all(_variance[0])); } else {