File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change @@ -182,6 +182,9 @@ namespace dnn //! This namespace is used for dnn module functionlaity.
182
182
/* * @brief Returns pointer to layer with specified name which the network use. */
183
183
CV_WRAP Ptr<Layer> getLayer (LayerId layerId);
184
184
185
+ /* * @brief Returns pointers to input layers of specific layer. */
186
+ CV_WRAP std::vector<Ptr<Layer> > getLayerInputs (LayerId layerId);
187
+
185
188
/* * @brief Delete layer for the network (not implemented yet) */
186
189
CV_WRAP void deleteLayer (LayerId layer);
187
190
Original file line number Diff line number Diff line change @@ -568,10 +568,25 @@ Ptr<Layer> Net::getLayer(LayerId layerId)
568
568
{
569
569
LayerData &ld = impl->getLayerData (layerId);
570
570
if (!ld.layerInstance )
571
- CV_Error (Error::StsNullPtr, format (" Requseted layer \" %s\" was not initialized" , ld.name .c_str ()));
571
+ CV_Error (Error::StsNullPtr, format (" Requested layer \" %s\" was not initialized" , ld.name .c_str ()));
572
572
return ld.layerInstance ;
573
573
}
574
574
575
+ std::vector<Ptr<Layer> > Net::getLayerInputs (LayerId layerId)
576
+ {
577
+ LayerData &ld = impl->getLayerData (layerId);
578
+ if (!ld.layerInstance )
579
+ CV_Error (Error::StsNullPtr, format (" Requested layer \" %s\" was not initialized" , ld.name .c_str ()));
580
+
581
+ std::vector<Ptr<Layer> > inputLayers;
582
+ inputLayers.reserve (ld.inputLayersId .size ());
583
+ std::set<int >::iterator it;
584
+ for (it = ld.inputLayersId .begin (); it != ld.inputLayersId .end (); ++it) {
585
+ inputLayers.push_back (getLayer (*it));
586
+ }
587
+ return inputLayers;
588
+ }
589
+
575
590
std::vector<String> Net::getLayerNames () const
576
591
{
577
592
std::vector<String> res;
You can’t perform that action at this time.
0 commit comments