Group Pre Post Process#

group ov_prepostprocess_c_api

The definitions & operations about prepostprocess.

Enums

enum ov_color_format_e#

This enum contains enumerations for color format.

Values:

enumerator UNDEFINE#

Undefine color format.

enumerator NV12_SINGLE_PLANE#

Image in NV12 format as single tensor.

enumerator NV12_TWO_PLANES#

Image in NV12 format represented as separate tensors for Y and UV planes.

enumerator I420_SINGLE_PLANE#

Image in I420 (YUV) format as single tensor.

enumerator I420_THREE_PLANES#

Image in I420 format represented as separate tensors for Y, U and V planes.

enumerator RGB#

Image in RGB interleaved format (3 channels)

enumerator BGR#

Image in BGR interleaved format (3 channels)

enumerator GRAY#

Image in GRAY format (1 channel)

enumerator RGBX#

Image in RGBX interleaved format (4 channels)

enumerator BGRX#

Image in BGRX interleaved format (4 channels)

enum ov_preprocess_resize_algorithm_e#

This enum contains codes for all preprocess resize algorithm.

Values:

enumerator RESIZE_LINEAR#

linear algorithm

enumerator RESIZE_CUBIC#

cubic algorithm

enumerator RESIZE_NEAREST#

nearest algorithm

Functions

ov_preprocess_prepostprocessor_create(const ov_model_t *model, ov_preprocess_prepostprocessor_t **preprocess)#

Create a ov_preprocess_prepostprocessor_t instance.

Parameters:
Returns:

Status code of the operation: OK(0) for success.

ov_preprocess_prepostprocessor_free(ov_preprocess_prepostprocessor_t *preprocess)#

Release the memory allocated by ov_preprocess_prepostprocessor_t.

Parameters:

preprocess – A pointer to the ov_preprocess_prepostprocessor_t to free memory.

ov_preprocess_prepostprocessor_get_input_info(const ov_preprocess_prepostprocessor_t *preprocess, ov_preprocess_input_info_t **preprocess_input_info)#

Get the input info of ov_preprocess_prepostprocessor_t instance.

Parameters:
Returns:

Status code of the operation: OK(0) for success.

ov_preprocess_prepostprocessor_get_input_info_by_name(const ov_preprocess_prepostprocessor_t *preprocess, const char *tensor_name, ov_preprocess_input_info_t **preprocess_input_info)#

Get the input info of ov_preprocess_prepostprocessor_t instance by tensor name.

Parameters:
Returns:

Status code of the operation: OK(0) for success.

ov_preprocess_prepostprocessor_get_input_info_by_index(const ov_preprocess_prepostprocessor_t *preprocess, const size_t tensor_index, ov_preprocess_input_info_t **preprocess_input_info)#

Get the input info of ov_preprocess_prepostprocessor_t instance by tensor order.

Parameters:
Returns:

Status code of the operation: OK(0) for success.

ov_preprocess_input_info_free(ov_preprocess_input_info_t *preprocess_input_info)#

Release the memory allocated by ov_preprocess_input_info_t.

Parameters:

preprocess_input_info – A pointer to the ov_preprocess_input_info_t to free memory.

ov_preprocess_input_info_get_tensor_info(const ov_preprocess_input_info_t *preprocess_input_info, ov_preprocess_input_tensor_info_t **preprocess_input_tensor_info)#

Get a ov_preprocess_input_tensor_info_t.

Parameters:
Returns:

Status code of the operation: OK(0) for success.

ov_preprocess_input_tensor_info_free(ov_preprocess_input_tensor_info_t *preprocess_input_tensor_info)#

Release the memory allocated by ov_preprocess_input_tensor_info_t.

Parameters:

preprocess_input_tensor_info – A pointer to the ov_preprocess_input_tensor_info_t to free memory.

ov_preprocess_input_info_get_preprocess_steps(const ov_preprocess_input_info_t *preprocess_input_info, ov_preprocess_preprocess_steps_t **preprocess_input_steps)#

Get a ov_preprocess_preprocess_steps_t.

Parameters:
Returns:

Status code of the operation: OK(0) for success.

ov_preprocess_preprocess_steps_free(ov_preprocess_preprocess_steps_t *preprocess_input_process_steps)#

Release the memory allocated by ov_preprocess_preprocess_steps_t.

Parameters:

preprocess_input_steps – A pointer to the ov_preprocess_preprocess_steps_t to free memory.

ov_preprocess_preprocess_steps_resize(ov_preprocess_preprocess_steps_t *preprocess_input_process_steps, const ov_preprocess_resize_algorithm_e resize_algorithm)#

Add resize operation to model’s dimensions.

Parameters:
Returns:

Status code of the operation: OK(0) for success.

ov_preprocess_preprocess_steps_scale(ov_preprocess_preprocess_steps_t *preprocess_input_process_steps, float value)#

Add scale preprocess operation. Divide each element of input by specified value.

Parameters:
Returns:

Status code of the operation: OK(0) for success.

ov_preprocess_preprocess_steps_scale_multi_channels(ov_preprocess_preprocess_steps_t *preprocess_input_process_steps, const float *values, const int32_t value_size)#

Add scale preprocess operation. Divide each channel element of input by different specified value.

Parameters:
  • preprocess_input_process_steps – A pointer to ov_preprocess_preprocess_steps_t.

  • values – Scaling values array for each channels

  • value_size – Scaling value size

Returns:

Status code of the operation: OK(0) for success.

ov_preprocess_preprocess_steps_mean(ov_preprocess_preprocess_steps_t *preprocess_input_process_steps, float value)#

Add mean preprocess operation. Subtract specified value from each element of input.

Parameters:
Returns:

Status code of the operation: OK(0) for success.

ov_preprocess_preprocess_steps_mean_multi_channels(ov_preprocess_preprocess_steps_t *preprocess_input_process_steps, const float *values, const int32_t value_size)#

Add mean preprocess operation. Subtract each channel element of input by different specified value.

Parameters:
  • preprocess_input_process_steps – A pointer to ov_preprocess_preprocess_steps_t.

  • values – Value array to subtract from each element.

  • value_size – Mean value size

Returns:

Status code of the operation: OK(0) for success.

ov_preprocess_preprocess_steps_crop(ov_preprocess_preprocess_steps_t *preprocess_input_process_steps, int32_t *begin, int32_t begin_size, int32_t *end, int32_t end_size)#

Crop input tensor between begin and end coordinates.

Parameters:
  • preprocess_input_process_steps – A pointer to ov_preprocess_preprocess_steps_t.

  • begin – Pointer to begin indexes for input tensor cropping. Negative values represent counting elements from the end of input tensor

  • begin_size – The size of begin array

  • end – Pointer to end indexes for input tensor cropping. End indexes are exclusive, which means values including end edge are not included in the output slice. Negative values represent counting elements from the end of input tensor

  • end_size – The size of end array

Returns:

Status code of the operation: OK(0) for success.

ov_preprocess_preprocess_steps_convert_layout(ov_preprocess_preprocess_steps_t *preprocess_input_process_steps, ov_layout_t *layout)#

Add ‘convert layout’ operation to specified layout.

Parameters:
Returns:

Status code of the operation: OK(0) for success.

ov_preprocess_preprocess_steps_reverse_channels(ov_preprocess_preprocess_steps_t *preprocess_input_process_steps)#

Reverse channels operation.

Parameters:

preprocess_input_process_steps – A pointer to ov_preprocess_preprocess_steps_t.

Returns:

Status code of the operation: OK(0) for success.

ov_preprocess_input_tensor_info_set_element_type(ov_preprocess_input_tensor_info_t *preprocess_input_tensor_info, const ov_element_type_e element_type)#

Set ov_preprocess_input_tensor_info_t precesion.

Parameters:
Returns:

Status code of the operation: OK(0) for success.

ov_preprocess_input_tensor_info_set_color_format(ov_preprocess_input_tensor_info_t *preprocess_input_tensor_info, const ov_color_format_e colorFormat)#

Set ov_preprocess_input_tensor_info_t color format.

Parameters:
Returns:

Status code of the operation: OK(0) for success.

ov_preprocess_input_tensor_info_set_color_format_with_subname(ov_preprocess_input_tensor_info_t *preprocess_input_tensor_info, const ov_color_format_e colorFormat, const size_t sub_names_size, ...)#

Set ov_preprocess_input_tensor_info_t color format with subname.

Parameters:
  • preprocess_input_tensor_info – A pointer to the ov_preprocess_input_tensor_info_t.

  • colorFormat – The enumerate of colorFormat

  • sub_names_size – The size of sub_names

  • ... – variadic params sub_names Optional list of sub-names assigned for each plane (e.g. “Y”, “UV”).

Returns:

Status code of the operation: OK(0) for success.

ov_preprocess_input_tensor_info_set_spatial_static_shape(ov_preprocess_input_tensor_info_t *preprocess_input_tensor_info, const size_t input_height, const size_t input_width)#

Set ov_preprocess_input_tensor_info_t spatial_static_shape.

Parameters:
Returns:

Status code of the operation: OK(0) for success.

ov_preprocess_preprocess_steps_convert_element_type(ov_preprocess_preprocess_steps_t *preprocess_input_process_steps, const ov_element_type_e element_type)#

Convert ov_preprocess_preprocess_steps_t element type.

Parameters:
Returns:

Status code of the operation: OK(0) for success.

ov_preprocess_preprocess_steps_convert_color(ov_preprocess_preprocess_steps_t *preprocess_input_process_steps, const ov_color_format_e colorFormat)#

Convert ov_preprocess_preprocess_steps_t color.

Parameters:
Returns:

Status code of the operation: OK(0) for success.

ov_preprocess_input_tensor_info_set_from(ov_preprocess_input_tensor_info_t *preprocess_input_tensor_info, const ov_tensor_t *tensor)#

Helper function to reuse element type and shape from user’s created tensor.

Parameters:
Returns:

Status code of the operation: OK(0) for success.

ov_preprocess_input_tensor_info_set_layout(ov_preprocess_input_tensor_info_t *preprocess_input_tensor_info, ov_layout_t *layout)#

Set ov_preprocess_input_tensor_info_t layout.

Parameters:
Returns:

Status code of the operation: OK(0) for success.

ov_preprocess_prepostprocessor_get_output_info(const ov_preprocess_prepostprocessor_t *preprocess, ov_preprocess_output_info_t **preprocess_output_info)#

Get the output info of ov_preprocess_output_info_t instance.

Parameters:
Returns:

Status code of the operation: OK(0) for success.

ov_preprocess_prepostprocessor_get_output_info_by_index(const ov_preprocess_prepostprocessor_t *preprocess, const size_t tensor_index, ov_preprocess_output_info_t **preprocess_output_info)#

Get the output info of ov_preprocess_output_info_t instance.

Parameters:
Returns:

Status code of the operation: OK(0) for success.

ov_preprocess_prepostprocessor_get_output_info_by_name(const ov_preprocess_prepostprocessor_t *preprocess, const char *tensor_name, ov_preprocess_output_info_t **preprocess_output_info)#

Get the output info of ov_preprocess_output_info_t instance.

Parameters:
Returns:

Status code of the operation: OK(0) for success.

ov_preprocess_output_info_free(ov_preprocess_output_info_t *preprocess_output_info)#

Release the memory allocated by ov_preprocess_output_info_t.

Parameters:

preprocess_output_info – A pointer to the ov_preprocess_output_info_t to free memory.

ov_preprocess_output_info_get_tensor_info(const ov_preprocess_output_info_t *preprocess_output_info, ov_preprocess_output_tensor_info_t **preprocess_output_tensor_info)#

Get a ov_preprocess_input_tensor_info_t.

Parameters:
Returns:

Status code of the operation: OK(0) for success.

ov_preprocess_output_tensor_info_free(ov_preprocess_output_tensor_info_t *preprocess_output_tensor_info)#

Release the memory allocated by ov_preprocess_output_tensor_info_t.

Parameters:

preprocess_output_tensor_info – A pointer to the ov_preprocess_output_tensor_info_t to free memory.

ov_preprocess_output_set_element_type(ov_preprocess_output_tensor_info_t *preprocess_output_tensor_info, const ov_element_type_e element_type)#

Set ov_preprocess_input_tensor_info_t precesion.

Parameters:
Returns:

Status code of the operation: OK(0) for success.

ov_preprocess_input_info_get_model_info(const ov_preprocess_input_info_t *preprocess_input_info, ov_preprocess_input_model_info_t **preprocess_input_model_info)#

Get current input model information.

Parameters:
Returns:

Status code of the operation: OK(0) for success.

ov_preprocess_input_model_info_free(ov_preprocess_input_model_info_t *preprocess_input_model_info)#

Release the memory allocated by ov_preprocess_input_model_info_t.

Parameters:

preprocess_input_model_info – A pointer to the ov_preprocess_input_model_info_t to free memory.

ov_preprocess_input_model_info_set_layout(ov_preprocess_input_model_info_t *preprocess_input_model_info, ov_layout_t *layout)#

Set layout for model’s input tensor.

Parameters:
Returns:

Status code of the operation: OK(0) for success.

ov_preprocess_prepostprocessor_build(const ov_preprocess_prepostprocessor_t *preprocess, ov_model_t **model)#

Adds pre/post-processing operations to function passed in constructor.

Parameters:
Returns:

Status code of the operation: OK(0) for success.

struct ov_preprocess_prepostprocessor_t#
#include <ov_prepostprocess.h>

type define ov_preprocess_prepostprocessor_t from ov_preprocess_prepostprocessor

struct ov_preprocess_input_info_t#
#include <ov_prepostprocess.h>

type define ov_preprocess_input_info_t from ov_preprocess_input_info

struct ov_preprocess_input_tensor_info_t#
#include <ov_prepostprocess.h>

type define ov_preprocess_input_tensor_info_t from ov_preprocess_input_tensor_info

struct ov_preprocess_output_info_t#
#include <ov_prepostprocess.h>

type define ov_preprocess_output_info_t from ov_preprocess_output_info

struct ov_preprocess_output_tensor_info_t#
#include <ov_prepostprocess.h>

type define ov_preprocess_output_tensor_info_t from ov_preprocess_output_tensor_info

struct ov_preprocess_input_model_info_t#
#include <ov_prepostprocess.h>

type define ov_preprocess_input_model_info_t from ov_preprocess_input_model_info

struct ov_preprocess_preprocess_steps_t#
#include <ov_prepostprocess.h>

type define ov_preprocess_preprocess_steps_t from ov_preprocess_preprocess_steps