diff --git a/modules/dnn/src/layers/proposal_layer.cpp b/modules/dnn/src/layers/proposal_layer.cpp index 990cfeda30..403ec826d3 100644 --- a/modules/dnn/src/layers/proposal_layer.cpp +++ b/modules/dnn/src/layers/proposal_layer.cpp @@ -54,11 +54,11 @@ public: for (int i = 0; i < ratios.size(); ++i) { float ratio = ratios.get(i); + float width = std::floor(baseSize / sqrt(ratio) + 0.5f); + float height = std::floor(width * ratio + 0.5f); for (int j = 0; j < scales.size(); ++j) { float scale = scales.get(j); - float width = std::floor(baseSize / sqrt(ratio) + 0.5f); - float height = std::floor(width * ratio + 0.5f); widths.push_back(scale * width); heights.push_back(scale * height); }