Fix an issue https://github.com/opencv/opencv/issues/11102
authorDmitry Kurtaev <dmitry.kurtaev+github@gmail.com>
Sun, 18 Mar 2018 07:49:12 +0000 (10:49 +0300)
committerDmitry Kurtaev <dmitry.kurtaev+github@gmail.com>
Sun, 18 Mar 2018 07:49:12 +0000 (10:49 +0300)
modules/dnn/src/layers/lrn_layer.cpp
modules/dnn/test/test_googlenet.cpp

index 0fa541f..0e3b638 100644 (file)
@@ -208,7 +208,7 @@ public:
             float alpha1 = alpha1_, bias1 = bias1_, beta1 = beta1_;
             int k, channels = channels_, ksize = ksize_;
 
-            AutoBuffer<float> buf_((channels + ksize*2 + 4)*2);
+            AutoBuffer<float> buf_((channels + ksize + 1)*2);
             float* acc = (float*)buf_;
             float* buf = acc + channels + ksize + 1;
             for( k = 0; k <= ksize; k++ )
index 697f780..14bf68e 100644 (file)
@@ -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<Mat> inpMats;