mirror of
https://github.com/opencv/opencv.git
synced 2025-01-18 22:44:02 +08:00
Fix dnn::getLayerInputs
This commit is contained in:
parent
c546a27de7
commit
7c4158d8c2
@ -3189,14 +3189,11 @@ Ptr<Layer> Net::getLayer(LayerId layerId)
|
||||
std::vector<Ptr<Layer> > Net::getLayerInputs(LayerId layerId)
|
||||
{
|
||||
LayerData &ld = impl->getLayerData(layerId);
|
||||
if (!ld.layerInstance)
|
||||
CV_Error(Error::StsNullPtr, format("Requested layer \"%s\" was not initialized", ld.name.c_str()));
|
||||
|
||||
std::vector<Ptr<Layer> > inputLayers;
|
||||
inputLayers.reserve(ld.inputLayersId.size());
|
||||
std::set<int>::iterator it;
|
||||
for (it = ld.inputLayersId.begin(); it != ld.inputLayersId.end(); ++it) {
|
||||
inputLayers.push_back(getLayer(*it));
|
||||
inputLayers.reserve(ld.inputBlobsId.size());
|
||||
for (int i = 0; i < ld.inputBlobsId.size(); ++i) {
|
||||
inputLayers.push_back(getLayer(ld.inputBlobsId[i].lid));
|
||||
}
|
||||
return inputLayers;
|
||||
}
|
||||
|
@ -86,6 +86,8 @@ TEST_P(dump, Regression)
|
||||
Net net = readNet(findDataFile("dnn/squeezenet_v1.1.prototxt"),
|
||||
findDataFile("dnn/squeezenet_v1.1.caffemodel", false));
|
||||
|
||||
ASSERT_EQ(net.getLayerInputs(net.getLayerId("fire2/concat")).size(), 2);
|
||||
|
||||
int size[] = {1, 3, 227, 227};
|
||||
Mat input = cv::Mat::ones(4, size, CV_32F);
|
||||
net.setInput(input);
|
||||
|
Loading…
Reference in New Issue
Block a user