diff --git a/modules/dnn/src/layers/lrn_layer.cpp b/modules/dnn/src/layers/lrn_layer.cpp index 0fa541f2a0..0e3b63803e 100644 --- a/modules/dnn/src/layers/lrn_layer.cpp +++ b/modules/dnn/src/layers/lrn_layer.cpp @@ -208,7 +208,7 @@ public: float alpha1 = alpha1_, bias1 = bias1_, beta1 = beta1_; int k, channels = channels_, ksize = ksize_; - AutoBuffer buf_((channels + ksize*2 + 4)*2); + AutoBuffer buf_((channels + ksize + 1)*2); float* acc = (float*)buf_; float* buf = acc + channels + ksize + 1; for( k = 0; k <= ksize; k++ ) diff --git a/modules/dnn/test/test_googlenet.cpp b/modules/dnn/test/test_googlenet.cpp index 697f78025f..14bf68e635 100644 --- a/modules/dnn/test/test_googlenet.cpp +++ b/modules/dnn/test/test_googlenet.cpp @@ -78,7 +78,9 @@ OCL_TEST(Reproducibility_GoogLeNet, Accuracy) net.setPreferableTarget(DNN_TARGET_OPENCL); // Initialize network for a single image in the batch but test with batch size=2. - net.setInput(blobFromImage(Mat(224, 224, CV_8UC3))); + Mat inp = Mat(224, 224, CV_8UC3); + randu(inp, -1, 1); + net.setInput(blobFromImage(inp)); net.forward(); std::vector inpMats;