From d4d12164aa130fcf4c6e7cf3c003b9285df0ff22 Mon Sep 17 00:00:00 2001 From: WeiChungChang Date: Tue, 23 Feb 2021 16:09:55 -0500 Subject: [PATCH] Merge pull request #19529 from WeiChungChang:3.4 * improve map allocation check * fix accoring to CR --- modules/dnn/src/layers/detection_output_layer.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/dnn/src/layers/detection_output_layer.cpp b/modules/dnn/src/layers/detection_output_layer.cpp index 55ef36f95c..2dd6f5fb73 100644 --- a/modules/dnn/src/layers/detection_output_layer.cpp +++ b/modules/dnn/src/layers/detection_output_layer.cpp @@ -852,16 +852,16 @@ public: for (int i = 0; i < num; ++i, locData += numPredsPerClass * numLocClasses * 4) { LabelBBox& labelBBox = locPreds[i]; + int start = shareLocation ? -1 : 0; + for (int c = 0; c < numLocClasses; ++c) { + labelBBox[start++].resize(numPredsPerClass); + } for (int p = 0; p < numPredsPerClass; ++p) { int startIdx = p * numLocClasses * 4; for (int c = 0; c < numLocClasses; ++c) { int label = shareLocation ? -1 : c; - if (labelBBox.find(label) == labelBBox.end()) - { - labelBBox[label].resize(numPredsPerClass); - } util::NormalizedBBox& bbox = labelBBox[label][p]; if (locPredTransposed) {