Crate openvino_sys[][src]

This crate provides low-level, unsafe, Rust bindings to OpenVINO™ using its C API. If you are looking to use OpenVINO™ from Rust, you likely should look at the ergonomic, safe bindings in openvino, which depends on this crate. See the repository README for more information, including build instructions.

An example interaction with raw openvino-sys:

openvino_sys::library::load().expect("to have an OpenVINO library available");
let version = unsafe { CStr::from_ptr(openvino_sys::ie_c_api_version().api_version) };
assert!(version.to_string_lossy().starts_with("2.1"));

Modules

library

Contains extra utilities for finding and loading the OpenVINO shared libraries.

Structs

dimensions

@struct dimensions @brief Represents dimensions for input or output data

ie_available_devices

@struct ie_available_devices @brief Represent all available devices.

ie_blob
ie_blob_buffer

@struct ie_blob_buffer @brief Represents copied data from the given blob.

ie_complete_call_back

@struct ie_complete_call_back @brief Completion callback definition about the function and args

ie_config

@struct ie_config @brief Represents configuration information that describes devices

ie_core
ie_core_version

@struct ie_core_version @brief Represents version information that describes devices and the inference engine runtime library

ie_core_versions

@struct ie_core_versions @brief Represents all versions information that describes all devices and the inference engine runtime library

ie_executable
ie_infer_request
ie_network
ie_param

@struct ie_param @brief metric and config parameters.

ie_param_config

@struct ie_param_config @brief Represents configuration parameter information

ie_version

@struct ie_version @brief Represents an API version information that reflects the set of supported features

input_shape

@struct input_shape @brief Represents shape for input data

input_shapes

@struct input_shapes @brief Represents shapes for all input data

roi

@struct roi_t @brief This structure describes roi data.

tensor_desc

@struct tensor_desc @brief Represents detailed information for a tensor

Enums

colorformat_e

@enum colorformat_e @brief Extra information about input color format for preprocessing

layout_e

@enum layout_e @brief Layouts that the inference engine supports

precision_e

@enum precision_e @brief Precisions that the inference engine supports

resize_alg_e

@enum resize_alg_e @brief Represents the list of supported resize algorithms.

Constants

IEStatusCode_GENERAL_ERROR
IEStatusCode_INFER_NOT_STARTED
IEStatusCode_NETWORK_NOT_LOADED
IEStatusCode_NETWORK_NOT_READ
IEStatusCode_NOT_ALLOCATED
IEStatusCode_NOT_FOUND
IEStatusCode_NOT_IMPLEMENTED
IEStatusCode_OK
IEStatusCode_OUT_OF_BOUNDS
IEStatusCode_PARAMETER_MISMATCH
IEStatusCode_REQUEST_BUSY
IEStatusCode_RESULT_NOT_READY
IEStatusCode_UNEXPECTED

Functions

ie_blob_byte_size

@brief Gets the size of the current Blob in bytes. @ingroup Blob @param blob A pointer to the blob. @param bsize_result The size of the current blob in bytes. @return Status code of the operation: OK(0) for success.

ie_blob_deallocate

@brief Releases previously allocated data @ingroup Blob @param blob A pointer to the blob to free memory.

ie_blob_free

@Releases the memory occupied by the ie_blob_t pointer. @ingroup Blob @param blob A pointer to the blob pointer to release memory.

ie_blob_get_buffer

@brief Gets access to the allocated memory . @ingroup Blob @param blob A pointer to the blob. @param blob_buffer A pointer to the copied data from the given blob. @return Status code of the operation: OK(0) for success.

ie_blob_get_cbuffer

@brief Gets read-only access to the allocated memory. @ingroup Blob @param blob A pointer to the blob. @param blob_cbuffer A pointer to the coped data from the given pointer to the blob and the data is read-only. @return Status code of the operation: OK(0) for success

ie_blob_get_dims

@brief Gets dimensions of blob’s tensor. @ingroup Blob @param blob A pointer to the blob. @param dims_result A pointer to the dimensions of blob’s tensor. @return Status code of the operation: OK(0) for success.

ie_blob_get_layout

@brief Gets layout of blob’s tensor. @ingroup Blob @param blob A pointer to the blob. @param layout_result A pointer to the layout of blob’s tensor. @return Status code of the operation: OK(0) for success.

ie_blob_get_precision

@brief Gets precision of blob’s tensor. @ingroup Blob @param blob A pointer to the blob. @param prec_result A pointer to the precision of blob’s tensor. @return Status code of the operation: OK(0) for success.

ie_blob_make_memory

@brief Creates a blob with the specified dimensions, layout and to allocate memory. @ingroup Blob @param tensorDesc Tensor descriptor for Blob creation. @param blob A pointer to the newly created blob. @return Status code of the operation: OK(0) for success.

ie_blob_make_memory_from_preallocated

@brief Creates a blob with the given tensor descriptor from the pointer to the pre-allocated memory. @ingroup Blob @param tensorDesc Tensor descriptor for Blob creation. @param ptr Pointer to the pre-allocated memory. @param size Length of the pre-allocated array. @param blob A pointer to the newly created blob. @return Status code of the operation: OK(0) for success.

ie_blob_make_memory_i420

@brief Creates I420 blob from three planes Y, U and V. @ingroup Blob @param y A pointer to the ie_blob_t instance that represents Y plane in I420 color format. @param u A pointer to the ie_blob_t instance that represents U plane in I420 color format. @param v A pointer to the ie_blob_t instance that represents V plane in I420 color format. @param i420Blob A pointer to the newly created blob. @return Status code of the operation: OK(0) for success.

ie_blob_make_memory_nv12

@brief Creates a NV12 blob from two planes Y and UV. @ingroup Blob @param y A pointer to the ie_blob_t instance that represents Y plane in NV12 color format. @param uv A pointer to the ie_blob_t instance that represents UV plane in NV12 color format. @param nv12Blob A pointer to the newly created blob. @return Status code of the operation: OK(0) for success.

ie_blob_make_memory_with_roi

@brief Creates a blob describing given roi_t instance based on the given blob with pre-allocated memory. @ingroup Blob @param inputBlob original blob with pre-allocated memory. @param roi A roi_tinstance inside of the original blob. @param blob A pointer to the newly created blob. @return Status code of the operation: OK(0) for success.

ie_blob_size

@brief Gets the total number of elements, which is a product of all the dimensions. @ingroup Blob @param blob A pointer to the blob. @param size_result The total number of elements. @return Status code of the operation: OK(0) for success.

ie_c_api_version

@brief Returns number of version that is exported. Use the ie_version_free() to free memory. @return Version number of the API.

ie_core_add_extension

@brief Loads extension library to the device with a specified device name. @ingroup Core @param core A pointer to ie_core_t instance. @param extension_path Path to the extensions library file to load to a device. @param device_name A device name of a device to load the extensions to. @return Status code of the operation: OK(0) for success.

ie_core_available_devices_free

@brief Releases memory occpuied by ie_available_devices_t @ingroup Core @param avai_devices A pointer to the ie_available_devices_t to free memory.

ie_core_create

@brief Constructs Inference Engine Core instance using XML configuration file with devices description. See RegisterPlugins for more details. Use the ie_core_free() method to free memory. @ingroup Core @param xml_config_file A path to .xml file with devices to load from. If XML configuration file is not specified, then default Inference Engine devices are loaded from the default plugin.xml file. @param core A pointer to the newly created ie_core_t. @return Status code of the operation: OK(0) for success.

ie_core_free

@brief Releases memory occupied by core. @ingroup Core @param core A pointer to the core to free memory.

ie_core_get_available_devices

@brief Gets available devices for neural network inference. @ingroup Core @param core A pointer to ie_core_t instance. @param avai_devices The devices are returned as { CPU, FPGA.0, FPGA.1, MYRIAD } If there more than one device of specific type, they are enumerated with .# suffix @return Status code of the operation: OK(0) for success.

ie_core_get_config

@brief Gets configuration dedicated to device behaviour. The method is targeted to extract information which can be set via SetConfig method. @ingroup Core @param core A pointer to ie_core_t instance. @param device_name A name of a device to get a configuration value. @param config_name Name of a configuration. @param param_result A configuration value corresponding to the config_name. @return Status code of the operation: OK(0) for success.

ie_core_get_metric

@brief Gets general runtime metric for dedicated hardware. The method is needed to request common device properties which are executable network agnostic. It can be device name, temperature, other devices-specific values. @ingroup Core @param core A pointer to ie_core_t instance. @param device_name A name of a device to get a metric value. @param metric_name A metric name to request. @param param_result A metric value corresponding to the metric_name. @return Status code of the operation: OK(0) for success.

ie_core_get_versions

@brief Gets version information of the device specified. Use the ie_core_versions_free() method to free memory. @ingroup Core @param core A pointer to ie_core_t instance. @param device_name Name to indentify device. @param versions A pointer to versions corresponding to device_name. @return Status code of the operation: OK(0) for success.

ie_core_load_network

@brief Creates an executable network from a network object. Users can create as many networks as they need and use them simultaneously (up to the limitation of the hardware resources). Use the ie_exec_network_free() method to free memory. @ingroup Core @param core A pointer to ie_core_t instance. @param network A pointer to ie_network instance. @param device_name Name of device to load network to. @param config Device configuration. @param exe_network A pointer to the newly created executable network. @return Status code of the operation: OK(0) for success.

ie_core_read_network

@brief Reads the model from the .xml and .bin files of the IR. Use the ie_network_free() method to free memory. @ingroup Core @param core A pointer to ie_core_t instance. @param xml .xml file’s path of the IR. @param weights_file .bin file’s path of the IR, if path is empty, will try to read bin file with the same name as xml and if bin file with the same name was not found, will load IR without weights. @param network A pointer to the newly created network. @return Status code of the operation: OK(0) for success.

ie_core_read_network_from_memory

@brief Reads the model from an xml string and a blob of the bin part of the IR. Use the ie_network_free() method to free memory. @ingroup Core @param core A pointer to ie_core_t instance. @param xml_content Xml content of the IR. @param xml_content_size Number of bytes in the xml content of the IR. @param weight_blob Blob containing the bin part of the IR. @param network A pointer to the newly created network. @return Status code of the operation: OK(0) for success.

ie_core_register_plugin

@brief Registers a new device and a plugin which implement this device inside Inference Engine. @ingroup Core @param core A pointer to ie_core_t instance. @param plugin_name A name of a plugin. Depending on a platform, plugin_name is wrapped with a shared library suffix and a prefix to identify a full name of the library. @param device_name A device name to register plugin for. If not specified, the method registers a plugin with the default name. @return Status code of the operation: OK(0) for success.

ie_core_register_plugins

@brief Registers plugins specified in an “.xml” configuration file. @ingroup Core @param core A pointer to ie_core_t instance. @param xml_config_file A full path to “.xml” file containing plugins configuration. @return Status code of the operation: OK(0) for success.

ie_core_set_config

@brief Sets configuration for device. @ingroup Core @param core A pointer to ie_core_t instance. @param ie_core_config Device configuration. @param device_name An optinal name of a device. If device name is not specified, the config is set for all the registered devices. @return Status code of the operation: OK(0) for success.

ie_core_unregister_plugin

@brief Unregisters a plugin with a specified device name. @ingroup Core @param core A pointer to ie_core_t instance. @param device_name A device name of the device to unregister. @return Status code of the operation: OK(0) for success.

ie_core_versions_free

@brief Releases memory occupied by ie_core_versions. @ingroup Core @param vers A pointer to the ie_core_versions to free memory.

ie_exec_network_create_infer_request

@brief Creates an inference request instance used to infer the network. The created request has allocated input and output blobs (that can be changed later). Use the ie_infer_request_free() method to free memory. @ingroup ExecutableNetwork @param ie_exec_network A pointer to ie_executable_network_t instance. @param request A pointer to the newly created ie_infer_request_t instance @return Status code of the operation: OK(0) for success.

ie_exec_network_free

@brief Releases memory occupied by ExecutableNetwork. @ingroup ExecutableNetwork @param ie_exec_network A pointer to the ExecutableNetwork to free memory.

ie_exec_network_get_config

@brief Gets configuration for current executable network. The method is responsible to extract information which affects executable network execution. @ingroup ExecutableNetwork @param ie_exec_network A pointer to ie_executable_network_t instance. @param metric_config A configuration parameter name to request. @param param_result A configuration value corresponding to a configuration paramter name. @return Status code of the operation: OK(0) for success.

ie_exec_network_get_metric

@brief Gets general runtime metric for an executable network. It can be network name, actual device ID on which executable network is running or all other properties which cannot be changed dynamically. @ingroup ExecutableNetwork @param ie_exec_network A pointer to ie_executable_network_t instance. @param metric_name A metric name to request. @param param_result A metric value corresponding to the metric_name. @return Status code of the operation: OK(0) for success.

ie_exec_network_set_config

@brief Sets configuration for current executable network. Currently, the method can be used when the network run on the Multi device and the configuration paramter is only can be “MULTI_DEVICE_PRIORITIES” @ingroup ExecutableNetwork @param ie_exec_network A pointer to ie_executable_network_t instance. @param param_config A pointer to device configuration.. @return Status code of the operation: OK(0) for success.

ie_infer_request_free

@brief Releases memory occupied by ie_infer_request_t instance. @ingroup InferRequest @param infer_request A pointer to the ie_infer_request_t to free memory.

ie_infer_request_get_blob

@brief Gets input/output data for inference @ingroup InferRequest @param infer_request A pointer to ie_infer_request_t instance. @param name Name of input or output blob. @param blob A pointer to input or output blob. The type of Blob must match the network input precision and size. @return Status code of the operation: OK(0) for success.

ie_infer_request_infer

@brief Starts synchronous inference of the infer request and fill outputs. @ingroup InferRequest @param infer_request A pointer to ie_infer_request_t instance. @return Status code of the operation: OK(0) for success.

ie_infer_request_infer_async

@brief Starts asynchronous inference of the infer request and fill outputs. @ingroup InferRequest @param infer_request A pointer to ie_infer_request_t instance. @return Status code of the operation: OK(0) for success.

ie_infer_request_set_batch

@brief Sets new batch size for certain infer request when dynamic batching is enabled in executable network that created this request. @ingroup InferRequest @param infer_request A pointer to ie_infer_request_t instance. @param size New batch size to be used by all the following inference calls for this request. @return Status code of the operation: OK(0) for success.

ie_infer_request_set_blob

@brief Sets input/output data to inference. @ingroup InferRequest @param infer_request A pointer to ie_infer_request_t instance. @param name Name of input or output blob. @param blob Reference to input or output blob. The type of a blob must match the network input precision and size. @return Status code of the operation: OK(0) for success.

ie_infer_request_wait

@brief Waits for the result to become available. Blocks until specified timeout elapses or the result becomes available, whichever comes first. @ingroup InferRequest @param infer_request A pointer to ie_infer_request_t instance. @param timeout Maximum duration in milliseconds to block for @note There are special cases when timeout is equal some value of the WaitMode enum:

ie_infer_set_completion_callback

@brief Sets a callback function that will be called on success or failure of asynchronous request @ingroup InferRequest @param infer_request A pointer to ie_infer_request_t instance. @param callback A function to be called. @return Status code of the operation: OK(0) for success.

ie_network_free

@brief When netowrk is loaded into the Infernece Engine, it is not required anymore and should be released @ingroup Network @param network The pointer to the instance of the ie_network_t to free.

ie_network_get_color_format

@brief Gets color format of the input data. @ingroup Network @param network A pointer to ie_network_t instance. @param input_name Name of input data. @param colformat_result The pointer to the color format used for input blob creation. @reutrn Status code of the operation: OK(0) for success.

ie_network_get_input_dims

@Gets dimensions/shape of the input data with reversed order. @ingroup Network @param network A pointer to ie_network_t instance. @param input_name Name of input data. @param dims_result A pointer to the dimensions used for input blob creation. @return Status code of the operation: OK(0) for success.

ie_network_get_input_layout

@brief Gets a layout of the input data. @ingroup Network @param network A pointer to ie_network_t instance. @param input_name Name of input data. @param layout_result A pointer to the layout used for input blob creation. @return Status code of the operation: OK(0) for success.

ie_network_get_input_name

@brief Gets name corresponding to the “number”. Use the ie_network_name_free() method to free memory. @ingroup Network @param network A pointer to theinstance of the ie_network_t to get input information. @param number An id of input information . @param name Input name corresponding to the number. @return status Status code of the operation: OK(0) for success.

ie_network_get_input_precision

@brief Gets a precision of the input data provided by user. @ingroup Network @param network A pointer to ie_network_t instance. @param input_name Name of input data. @param prec_result A pointer to the precision used for input blob creation. @return Status code of the operation: OK(0) for success.

ie_network_get_input_resize_algorithm

@brief Gets pre-configured resize algorithm. @ingroup Network @param network A pointer to ie_network_t instance. @param input_name Name of input data. @parm resize_alg_result The pointer to the resize algorithm used for input blob creation. @return Status code of the operation: OK(0) for success.

ie_network_get_input_shapes

@brief Helper method collect all input shapes with input names of corresponding input data. Use the ie_network_input_shapes_free() method to free memory. @ingroup Network @param network A pointer to the instance of the ie_network_t to get input shapes. @param shapes A pointer to the input_shapes. @return Status code of the operation: OK(0) for success.

ie_network_get_inputs_number

@brief Gets number of inputs for the network. @ingroup Network @param network A pointer to the instance of the ie_network_t to get number of input information. @param size_result A number of the instance’s input information. @return Status code of the operation: OK(0) for success.

ie_network_get_name

@brief Get name of network. @ingroup Network @param name Name of the network. @return Status code of the operation: OK(0) for success.

ie_network_get_output_dims

@brief Gets dimensions/shape of the output data with reversed order. @ingroup Network @param network A pointer to ie_network_t instance. @param output_name Name of output data. @param dims_result A pointer to the dimensions used for output blob creation. @return Status code of the operation: OK(0) for success.

ie_network_get_output_layout

@brief Gets a layout of the output data. @ingroup Network @param network A pointer to ie_network_t instance. @param output_name Name of output data. @param layout_result A pointer to the layout used for output blob creation. @return Status code of the operation: OK(0) for success.

ie_network_get_output_name

@brief Gets name corresponding to the “number”. Use the ie_network_name_free() method to free memory. @ingroup Network @param network A pointer to theinstance of the ie_network_t to get output information. @param number An id of output information . @param name Output name corresponding to the number. @return Status code of the operation: OK(0) for success.

ie_network_get_output_precision

@brief Gets a precision of the output data named “output_name”. @ingroup Network @param network A pointer to ie_network_t instance. @param output_name Name of output data. @param prec_result A pointer to the precision used for output blob creation. @return Status code of the operation: OK(0) for success.

ie_network_get_outputs_number

@brief Gets number of output for the network. @ingroup Network @param network A pointer to the instance of the ie_network_t to get number of ouput information. @param size_result A number of the network’s output information. @return Status code of the operation: OK(0) for success.

ie_network_input_shapes_free

@brief Releases memory occupied by input_shapes. @ingroup Network @param inputShapes A pointer to the input_shapes to free memory.

ie_network_name_free

@brief Releases momory occupied by input_name or output_name. @ingroup Network @param name A pointer to the input_name or output_name to free memory.

ie_network_reshape

@brief Run shape inference with new input shapes for the network. @ingroup Network @param network A pointer to the instance of the ie_network_t to reshape. @param shapes A new input shapes to set for the network. @return Status code of the operation: OK(0) for success.

ie_network_set_color_format

@brief Changes the color format of the input data. @ingroup Network @param network A pointer to ie_network_t instance. @param input_name Name of input data. @param color_format Color format of the input data. @reutrn Status code of the operation: OK(0) for success.

ie_network_set_input_layout

@brief Changes the layout of the input data named “input_name”. This function should be called before loading the network to the device. @ingroup Network @param network A pointer to ie_network_t instance. @param input_name Name of input data. @param l A new layout of the input data to set. @return Status code of the operation: OK(0) for success.

ie_network_set_input_precision

@brief Changes the precision of the input data provided by the user. This function should be called before loading the network to the device. @ingroup Network @param network A pointer to ie_network_t instance. @param input_name Name of input data. @param p A new precision of the input data to set (eg. precision_e.FP16). @return Status code of the operation: OK(0) for success.

ie_network_set_input_resize_algorithm

@brief Sets resize algorithm to be used during pre-processing @ingroup Network @param network A pointer to ie_network_t instance. @param input_name Name of input data. @param resize_algo Resize algorithm. @return Status code of the operation: OK(0) for success.

ie_network_set_output_layout

@brief Changes the layout of the output data named “output_name”. @ingroup Network @param network A pointer to ie_network_t instance. @param output_name Name of output data. @param l A new layout of the output data to set. @return Status code of the operation: OK(0) for success.

ie_network_set_output_precision

@brief Changes the precision of the output data named “output_name”. @ingroup Network @param network A pointer to ie_network_t instance. @param output_name Name of output data. @param p A new precision of the output data to set (eg. precision_e.FP16). @return Status code of the operation: OK(0) for success.

ie_param_free

@brief Release the memory allocated by ie_param_t. @param version A pointer to the ie_param_t to free memory.

ie_version_free

@brief Release the memory allocated by ie_c_api_version. @param version A pointer to the ie_version_t to free memory.

load

Load all of the function definitions from a shared library.

Type Definitions

IEStatusCode

@enum IEStatusCode @brief This enum contains codes for all possible return values of the interface functions

dimensions_t
ie_available_devices_t
ie_blob_buffer_t
ie_blob_t
ie_complete_call_back_t
ie_config_t
ie_core_t
ie_core_version_t
ie_core_versions_t
ie_executable_network_t
ie_infer_request_t
ie_network_t
ie_param_config_t
ie_param_t
ie_version_t
input_shape_t
input_shapes_t
roi_t
tensor_desc_t

Unions

ie_blob_buffer__bindgen_ty_1
ie_param__bindgen_ty_1