Commit 134094a4 authored by Dmitry Kurtaev's avatar Dmitry Kurtaev

Backport fix for autodetection of input shapes

parent c790779a
...@@ -2772,17 +2772,25 @@ struct Net::Impl ...@@ -2772,17 +2772,25 @@ 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())
{ {
ShapesVec shapes; if (!layers[0].outputBlobs.empty())
for (int i = 0; i < layers[0].outputBlobs.size(); i++)
{ {
Mat& inp = layers[0].outputBlobs[i]; ShapesVec shapes;
CV_Assert(inp.total()); for (int i = 0; i < layers[0].outputBlobs.size(); i++)
shapes.push_back(shape(inp)); {
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()) if (inOutShapes[id].in.empty())
{ {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment