diff --git a/modules/dnn/src/dnn.cpp b/modules/dnn/src/dnn.cpp index 9a04fffa7f..480cf96fe7 100644 --- a/modules/dnn/src/dnn.cpp +++ b/modules/dnn/src/dnn.cpp @@ -2506,17 +2506,25 @@ struct Net::Impl { std::vector& inputLayerIds = layers[id].inputBlobsId; - if (inOutShapes[0].in[0].empty() && !layers[0].outputBlobs.empty()) + if (id == 0 && inOutShapes[id].in[0].empty()) { - ShapesVec shapes; - for (int i = 0; i < layers[0].outputBlobs.size(); i++) + if (!layers[0].outputBlobs.empty()) { - Mat& inp = layers[0].outputBlobs[i]; - CV_Assert(inp.total()); - shapes.push_back(shape(inp)); + ShapesVec shapes; + for (int i = 0; i < layers[0].outputBlobs.size(); i++) + { + Mat& inp = layers[0].outputBlobs[i]; + CV_Assert(inp.total()); + shapes.push_back(shape(inp)); + } + inOutShapes[0].in = shapes; } - inOutShapes[0].in = shapes; - } + else + { + inOutShapes[0].out.clear(); + return; + } + } if (inOutShapes[id].in.empty()) { diff --git a/modules/dnn/test/test_model.cpp b/modules/dnn/test/test_model.cpp index b62f1ac82f..5bc5bd31fe 100644 --- a/modules/dnn/test/test_model.cpp +++ b/modules/dnn/test/test_model.cpp @@ -105,8 +105,7 @@ TEST_P(Test_Model, Classify) } -// disabled: https://github.com/opencv/opencv/pull/15593 -TEST_P(Test_Model, DISABLED_DetectRegion) +TEST_P(Test_Model, DetectRegion) { applyTestTag(CV_TEST_TAG_LONG, CV_TEST_TAG_MEMORY_1GB);