Pre Post Process¶
Overview¶
The definitions & operations about prepostprocess. More…
// enums
enum ov_color_format_e;
enum ov_preprocess_resize_algorithm_e;
// structs
struct ov_preprocess_input_info_t;
struct ov_preprocess_input_model_info_t;
struct ov_preprocess_input_tensor_info_t;
struct ov_preprocess_output_info_t;
struct ov_preprocess_output_tensor_info_t;
struct ov_preprocess_prepostprocessor_t;
struct ov_preprocess_preprocess_steps_t;
// global functions
ov_preprocess_prepostprocessor_create(
const ov_model_t \* model,
ov_preprocess_prepostprocessor_t \*\* preprocess
);
ov_preprocess_prepostprocessor_free(ov_preprocess_prepostprocessor_t \* preprocess);
ov_preprocess_prepostprocessor_get_input_info(
const ov_preprocess_prepostprocessor_t \* preprocess,
ov_preprocess_input_info_t \*\* preprocess_input_info
);
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
);
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
);
ov_preprocess_input_info_free(ov_preprocess_input_info_t \* preprocess_input_info);
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
);
ov_preprocess_input_tensor_info_free(ov_preprocess_input_tensor_info_t \* preprocess_input_tensor_info);
ov_preprocess_input_info_get_preprocess_steps(
const ov_preprocess_input_info_t \* preprocess_input_info,
ov_preprocess_preprocess_steps_t \*\* preprocess_input_steps
);
ov_preprocess_preprocess_steps_free(ov_preprocess_preprocess_steps_t \* preprocess_input_process_steps);
ov_preprocess_preprocess_steps_resize(
ov_preprocess_preprocess_steps_t \* preprocess_input_process_steps,
const ov_preprocess_resize_algorithm_e resize_algorithm
);
ov_preprocess_preprocess_steps_scale(
ov_preprocess_preprocess_steps_t \* preprocess_input_process_steps,
float value
);
ov_preprocess_preprocess_steps_mean(
ov_preprocess_preprocess_steps_t \* preprocess_input_process_steps,
float value
);
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
);
ov_preprocess_preprocess_steps_convert_layout(
ov_preprocess_preprocess_steps_t \* preprocess_input_process_steps,
ov_layout_t \* layout
);
ov_preprocess_preprocess_steps_reverse_channels(ov_preprocess_preprocess_steps_t \* preprocess_input_process_steps);
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
);
ov_preprocess_input_tensor_info_set_color_format(
ov_preprocess_input_tensor_info_t \* preprocess_input_tensor_info,
const ov_color_format_e colorFormat
);
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
);
ov_preprocess_preprocess_steps_convert_element_type(
ov_preprocess_preprocess_steps_t \* preprocess_input_process_steps,
const ov_element_type_e element_type
);
ov_preprocess_preprocess_steps_convert_color(
ov_preprocess_preprocess_steps_t \* preprocess_input_process_steps,
const ov_color_format_e colorFormat
);
ov_preprocess_input_tensor_info_set_from(
ov_preprocess_input_tensor_info_t \* preprocess_input_tensor_info,
const ov_tensor_t \* tensor
);
ov_preprocess_input_tensor_info_set_layout(
ov_preprocess_input_tensor_info_t \* preprocess_input_tensor_info,
ov_layout_t \* layout
);
ov_preprocess_prepostprocessor_get_output_info(
const ov_preprocess_prepostprocessor_t \* preprocess,
ov_preprocess_output_info_t \*\* preprocess_output_info
);
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
);
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
);
ov_preprocess_output_info_free(ov_preprocess_output_info_t \* preprocess_output_info);
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
);
ov_preprocess_output_tensor_info_free(ov_preprocess_output_tensor_info_t \* preprocess_output_tensor_info);
ov_preprocess_output_set_element_type(
ov_preprocess_output_tensor_info_t \* preprocess_output_tensor_info,
const ov_element_type_e element_type
);
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
);
ov_preprocess_input_model_info_free(ov_preprocess_input_model_info_t \* preprocess_input_model_info);
ov_preprocess_input_model_info_set_layout(
ov_preprocess_input_model_info_t \* preprocess_input_model_info,
ov_layout_t \* layout
);
ov_preprocess_prepostprocessor_build(
const ov_preprocess_prepostprocessor_t \* preprocess,
ov_model_t \*\* model
);
Detailed Documentation¶
The definitions & operations about prepostprocess.
Global Functions¶
ov_preprocess_prepostprocessor_create(
const ov_model_t \* model,
ov_preprocess_prepostprocessor_t \*\* preprocess
)
Create a ov_preprocess_prepostprocessor_t instance.
Parameters:
model |
A pointer to the ov_model_t. |
preprocess |
A pointer to the ov_preprocess_prepostprocessor_t. |
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:
preprocess |
A pointer to the ov_preprocess_prepostprocessor_t. |
preprocess_input_info |
A pointer to the ov_preprocess_input_info_t. |
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:
preprocess |
A pointer to the ov_preprocess_prepostprocessor_t. |
tensor_name |
The name of input. |
preprocess_input_info |
A pointer to the ov_preprocess_input_info_t. |
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:
preprocess |
A pointer to the ov_preprocess_prepostprocessor_t. |
tensor_index |
The order of input. |
preprocess_input_info |
A pointer to the ov_preprocess_input_info_t. |
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:
preprocess_input_info |
A pointer to the ov_preprocess_input_info_t. |
preprocess_input_tensor_info |
A pointer to ov_preprocess_input_tensor_info_t. |
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:
A pointer to the ov_preprocess_input_info_t. |
|
preprocess_input_steps |
A pointer to ov_preprocess_preprocess_steps_t. |
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:
preprocess_input_process_steps |
A pointer to ov_preprocess_preprocess_steps_t. |
resize_algorithm |
A ov_preprocess_resizeAlgorithm instance |
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:
preprocess_input_process_steps |
A pointer to ov_preprocess_preprocess_steps_t. |
value |
Scaling value |
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:
preprocess_input_process_steps |
A pointer to ov_preprocess_preprocess_steps_t. |
value |
Value to subtract from each element. |
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:
preprocess_input_process_steps |
A pointer to ov_preprocess_preprocess_steps_t. |
layout |
A point to ov_layout_t |
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:
preprocess_input_tensor_info |
A pointer to the ov_preprocess_input_tensor_info_t. |
element_type |
A point to element_type |
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:
preprocess_input_tensor_info |
A pointer to the ov_preprocess_input_tensor_info_t. |
colorFormat |
The enumerate of colorFormat |
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:
preprocess_input_tensor_info |
A pointer to the ov_preprocess_input_tensor_info_t. |
input_height |
The height of input |
input_width |
The width of input |
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:
preprocess_input_steps |
A pointer to the ov_preprocess_preprocess_steps_t. |
element_type |
preprocess input element type. |
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:
preprocess_input_steps |
A pointer to the ov_preprocess_preprocess_steps_t. |
colorFormat |
The enumerate of colorFormat. |
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:
preprocess_input_tensor_info |
A pointer to the ov_preprocess_input_tensor_info_t. |
tensor |
A point to ov_tensor_t |
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:
preprocess_input_tensor_info |
A pointer to the ov_preprocess_input_tensor_info_t. |
layout |
A point to ov_layout_t |
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:
preprocess |
A pointer to the ov_preprocess_prepostprocessor_t. |
preprocess_output_info |
A pointer to the ov_preprocess_output_info_t. |
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:
preprocess |
A pointer to the ov_preprocess_prepostprocessor_t. |
tensor_index |
The tensor index |
preprocess_output_info |
A pointer to the ov_preprocess_output_info_t. |
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:
preprocess |
A pointer to the ov_preprocess_prepostprocessor_t. |
tensor_name |
The name of input. |
preprocess_output_info |
A pointer to the ov_preprocess_output_info_t. |
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:
preprocess_output_info |
A pointer to the ov_preprocess_output_info_t. |
preprocess_output_tensor_info |
A pointer to the ov_preprocess_output_tensor_info_t. |
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:
preprocess_output_tensor_info |
A pointer to the ov_preprocess_output_tensor_info_t. |
element_type |
A point to element_type |
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:
preprocess_input_info |
A pointer to the ov_preprocess_input_info_t. |
preprocess_input_model_info |
A pointer to the ov_preprocess_input_model_info_t |
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:
preprocess_input_model_info |
A pointer to the ov_preprocess_input_model_info_t |
layout |
A point to ov_layout_t |
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:
preprocess |
A pointer to the ov_preprocess_prepostprocessor_t. |
model |
A pointer to the ov_model_t. |
Returns:
Status code of the operation: OK(0) for success.