save allocation of memory for fake image
authorQoo <r97922153@gmail.com>
Tue, 16 Feb 2021 01:14:07 +0000 (20:14 -0500)
committerQoo <r97922153@gmail.com>
Tue, 16 Feb 2021 01:14:07 +0000 (20:14 -0500)
modules/dnn/src/layers/proposal_layer.cpp

index 990cfeda301940a808390a0ecba0fe89b1a11196..0e0a9ecdad86f00a1a27ab028ec8f8bdf754b3fd 100644 (file)
@@ -286,7 +286,8 @@ public:
 
         CV_Assert(imInfo.total() >= 2);
         // We've chosen the smallest data type because we need just a shape from it.
-        fakeImageBlob.create(shape(1, 1, imInfo.at<float>(0), imInfo.at<float>(1)), CV_8UC1);
+        // We don't allocate memory but just need the shape is correct.
+        Mat fakeImageBlob(shape(1, 1, imInfo.at<float>(0), imInfo.at<float>(1)), CV_8UC1, nullptr);
 
         // Generate prior boxes.
         std::vector<Mat> layerInputs(2), layerOutputs(1, priorBoxes);
@@ -427,7 +428,6 @@ private:
     Ptr<PermuteLayer> deltasPermute;
     Ptr<PermuteLayer> scoresPermute;
     uint32_t keepTopBeforeNMS, keepTopAfterNMS, featStride, baseSize;
-    Mat fakeImageBlob;
     float nmsThreshold;
     DictValue ratios, scales;
 #ifdef HAVE_OPENCL