Method GetLayerShapes
- Namespace
- OpenCvSharp.Dnn
- Assembly
- OpenCvSharp.dll
GetLayerShapes(IEnumerable<MatShape>, IEnumerable<MatType>, int, out MatShape[], out MatShape[])
Returns input and output shapes for the layer with the specified id; preliminary inferencing isn't necessary (OpenCV 5).
public void GetLayerShapes(IEnumerable<MatShape> netInputShapes, IEnumerable<MatType> netInputTypes, int layerId, out MatShape[] inLayerShapes, out MatShape[] outLayerShapes)
Parameters
netInputShapesIEnumerable<MatShape>shapes for all net inputs.
netInputTypesIEnumerable<MatType>element types for all net inputs (parallel to
netInputShapes).layerIdintid of the layer.
inLayerShapesMatShape[]output: input shapes of the layer.
outLayerShapesMatShape[]output: output shapes of the layer.
Remarks
When the model is backed by OpenCV 5's new dnn engine, only layerId 0
is supported (it infers the whole graph); other ids throw. Use GetLayersShapes(IEnumerable<MatShape>, IEnumerable<MatType>, out int[], out MatShape[][], out MatShape[][]) to
enumerate every layer, or pass one of the ids it reports.