Table of Contents

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

netInputShapes IEnumerable<MatShape>

shapes for all net inputs.

netInputTypes IEnumerable<MatType>

element types for all net inputs (parallel to netInputShapes).

layerId int

id of the layer.

inLayerShapes MatShape[]

output: input shapes of the layer.

outLayerShapes MatShape[]

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.