openvino.inference_engine.PreProcessInfo

class openvino.inference_engine.PreProcessInfo

Bases: object

This class stores pre-process information for the input

__init__()

Methods

__init__()

get_number_of_channels(self)

Returns a number of channels to preprocess

init(self, size_t number_of_channels)

Initializes with given number of channels

set_mean_image(self, Blob mean_image)

Sets mean image values if operation is applicable.

set_mean_image_for_channel(self, ...)

Sets mean image values if operation is applicable.

Attributes

color_format

Color format to be used in on-demand color conversions applied to input before inference

mean_variant

Mean Variant to be applied for input before inference if needed.

resize_algorithm

Resize Algorithm to be applied for input before inference if needed. .. note::.

color_format

Color format to be used in on-demand color conversions applied to input before inference

Usage example:

net = ie_core.read_network(model=path_to_xml_file, weights=path_to_bin_file)
net.input_info['data'].preprocess_info.color_format = ColorFormat.BGR
get_number_of_channels(self)

Returns a number of channels to preprocess

init(self, size_t number_of_channels)

Initializes with given number of channels

mean_variant

Mean Variant to be applied for input before inference if needed.

Usage example:

net = ie_core.read_network(model=path_to_xml_file, weights=path_to_bin_file)
net.input_info['data'].preprocess_info.mean_variant = MeanVariant.MEAN_IMAGE
resize_algorithm

Resize Algorithm to be applied for input before inference if needed. .. note:

It's need to set your input via the set_blob method.

Usage example:

net = ie_core.read_network(model=path_to_xml_file, weights=path_to_bin_file)
net.input_info['data'].preprocess_info.resize_algorithm = ResizeAlgorithm.RESIZE_BILINEAR
exec_net = ie_core.load_network(net, 'CPU')
tensor_desc = ie.TensorDesc("FP32", [1, 3, image.shape[2], image.shape[3]], "NCHW")
img_blob = ie.Blob(tensor_desc, image)
request = exec_net.requests[0]
request.set_blob('data', img_blob)
request.infer()
set_mean_image(self, Blob mean_image)

Sets mean image values if operation is applicable. Also sets the mean type to MEAN_IMAGE for all channels

set_mean_image_for_channel(self, Blob mean_image, size_t channel)

Sets mean image values if operation is applicable. Also sets the mean type to MEAN_IMAGE for a particular channel