Please use. NET 5,. NET 6, NET 7,. NET 8, NET Framework 4.6, NET Framework 4.61, NET Framework 4.7, NET Framework 4.72, NET Framework 4.8, NET Framework 4.81, and. NET Core 3.1 versions

PreProcessStepsconvert_layout Method

Add 'convert layout' operation to specified layout.

Definition

Namespace: OpenVinoSharp.preprocess
Assembly: OpenVINO_CSharp_API (in OpenVINO_CSharp_API.dll) Version: 2024.3.0.2+a9617c0f8f80882646d0eba11b88ae6cb17b3fb8
C#
public PreProcessSteps convert_layout(
	Layout layout
)

Parameters

layout  Layout
New layout after conversion. If not specified - destination layout is obtained from appropriate model input properties.

Return Value

PreProcessSteps
Reference to 'this' to allow chaining with other calls in a builder-like manner.

Remarks

Adds appropriate 'transpose' operation between user layout and target layout. Current implementation requires source and destination layout to have same number of dimensions

Example

when user data has 'NHWC' layout (example is RGB image, [1, 224, 224, 3]) but model expects planar input image ('NCHW', [1, 3, 224, 224]). Preprocessing may look like this:
C#
var proc = PrePostProcessor(model);
proc.input().tensor().set_layout("NHWC"); // User data is NHWC
proc.input().preprocess().convert_layout("NCHW")) // model expects input as NCHW

See Also