Merge pull request #15611 from dkurt:fix_dnn_inp_size_autodetect

pull/15625/head
Alexander Alekhin 5 years ago
commit 6aa689f87c
  1. 10
      modules/dnn/src/dnn.cpp
  2. 3
      modules/dnn/test/test_model.cpp

@ -2506,7 +2506,9 @@ struct Net::Impl
{ {
std::vector<LayerPin>& inputLayerIds = layers[id].inputBlobsId; std::vector<LayerPin>& inputLayerIds = layers[id].inputBlobsId;
if (inOutShapes[0].in[0].empty() && !layers[0].outputBlobs.empty()) if (id == 0 && inOutShapes[id].in[0].empty())
{
if (!layers[0].outputBlobs.empty())
{ {
ShapesVec shapes; ShapesVec shapes;
for (int i = 0; i < layers[0].outputBlobs.size(); i++) for (int i = 0; i < layers[0].outputBlobs.size(); i++)
@ -2517,6 +2519,12 @@ struct Net::Impl
} }
inOutShapes[0].in = shapes; inOutShapes[0].in = shapes;
} }
else
{
inOutShapes[0].out.clear();
return;
}
}
if (inOutShapes[id].in.empty()) if (inOutShapes[id].in.empty())
{ {

@ -105,8 +105,7 @@ TEST_P(Test_Model, Classify)
} }
// disabled: https://github.com/opencv/opencv/pull/15593 TEST_P(Test_Model, DetectRegion)
TEST_P(Test_Model, DISABLED_DetectRegion)
{ {
applyTestTag(CV_TEST_TAG_LONG, CV_TEST_TAG_MEMORY_1GB); applyTestTag(CV_TEST_TAG_LONG, CV_TEST_TAG_MEMORY_1GB);

Loading…
Cancel
Save