Skip to content

Commit d4d1216

Browse files
author
WeiChungChang
authored
Merge pull request opencv#19529 from WeiChungChang:3.4
* improve map allocation check * fix accoring to CR
1 parent 34d5746 commit d4d1216

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

modules/dnn/src/layers/detection_output_layer.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -852,16 +852,16 @@ class DetectionOutputLayerImpl CV_FINAL : public DetectionOutputLayer
852852
for (int i = 0; i < num; ++i, locData += numPredsPerClass * numLocClasses * 4)
853853
{
854854
LabelBBox& labelBBox = locPreds[i];
855+
int start = shareLocation ? -1 : 0;
856+
for (int c = 0; c < numLocClasses; ++c) {
857+
labelBBox[start++].resize(numPredsPerClass);
858+
}
855859
for (int p = 0; p < numPredsPerClass; ++p)
856860
{
857861
int startIdx = p * numLocClasses * 4;
858862
for (int c = 0; c < numLocClasses; ++c)
859863
{
860864
int label = shareLocation ? -1 : c;
861-
if (labelBBox.find(label) == labelBBox.end())
862-
{
863-
labelBBox[label].resize(numPredsPerClass);
864-
}
865865
util::NormalizedBBox& bbox = labelBBox[label][p];
866866
if (locPredTransposed)
867867
{

0 commit comments

Comments
 (0)