Crate openvino_sys

source ·
Expand description

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"));

Modules

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

Structs

  • @struct dimensions @brief Represents dimensions for input or output data
  • @struct ie_available_devices @brief Represent all available devices.
  • @struct ie_blob_buffer @brief Represents copied data from the given blob.
  • @struct ie_complete_call_back @brief Completion callback definition about the function and args
  • @struct ie_config @brief Represents configuration information that describes devices
  • @struct ie_core_version @brief Represents version information that describes devices and the inference engine runtime library
  • @struct ie_core_versions @brief Represents all versions information that describes all devices and the inference engine runtime library
  • @struct ie_param @brief metric and config parameters.
  • @struct ie_param_config @brief Represents configuration parameter information
  • @struct ie_version @brief Represents an API version information that reflects the set of supported features
  • @struct input_shape @brief Represents shape for input data
  • @struct input_shapes @brief Represents shapes for all input data
  • @struct roi_t @brief This structure describes roi data.
  • @struct tensor_desc @brief Represents detailed information for a tensor

Enums

  • @enum colorformat_e @brief Extra information about input color format for preprocessing
  • @enum layout_e @brief Layouts that the inference engine supports
  • @enum precision_e @brief Precisions that the inference engine supports
  • @enum resize_alg_e @brief Represents the list of supported resize algorithms.

Constants

Functions

  • @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.
  • @brief Releases previously allocated data @ingroup Blob @param blob A pointer to the blob to free memory.
  • @brief Releases the memory occupied by the ie_blob_t pointer. @ingroup Blob @param blob A pointer to the blob pointer to release memory.
  • @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.
  • @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
  • @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.
  • @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.
  • @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.
  • @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.
  • @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.
  • @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.
  • @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.
  • @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.
  • @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.
  • @brief Returns number of version that is exported. Use the ie_version_free() to free memory. @return Version number of the API.
  • @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.
  • @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.
  • @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.
  • @brief Exports an executable network to a .bin file. @ingroup Core @param exe_network A pointer to the newly created executable network. @param file_name Path to the file to export the network to. @return Status code of the operation: OK(0) for success.
  • @brief Releases memory occupied by core. @ingroup Core @param core A pointer to the core to free memory.
  • @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, GPU.0, GPU.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.
  • @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.
  • @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.
  • @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 identify device. @param versions A pointer to versions corresponding to device_name. @return Status code of the operation: OK(0) for success.
  • @brief Creates an executable network from a network previously exported to a file. 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 the ie_core_t instance. @param file_name A path to the location of the exported file. @param device_name A name of the device to load the 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.
  • @brief Creates an executable network from a network previously exported to memory. 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 the ie_core_t instance. @param content A pointer to content of the exported network. @param content_size Number of bytes in the exported network. @param device_name A name of the device to load the 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.
  • @brief Creates an executable network from a given 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 the ie_core_t instance. @param network A pointer to the input ie_network instance to create the executable network from. @param device_name Name of the device to load the 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.
  • @brief Reads model and creates an executable network from IR or ONNX file. 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 the ie_core_t instance. @param xml .xml file’s path of the IR. Weights file name will be calculated automatically @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.
  • @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 the 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.
  • @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 the 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.
  • @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.
  • @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.
  • @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 optional 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.
  • @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.
  • @brief Releases memory occupied by ie_core_versions. @ingroup Core @param vers A pointer to the ie_core_versions to free memory.
  • @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.
  • @brief Releases memory occupied by ExecutableNetwork. @ingroup ExecutableNetwork @param ie_exec_network A pointer to the ExecutableNetwork to free memory.
  • @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 parameter name. @return Status code of the operation: OK(0) for success.
  • @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.
  • @brief Sets configuration for current executable network. Currently, the method can be used when the network run on the Multi device and the configuration parameter 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.
  • @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.
  • @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.
  • @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.
  • @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.
  • @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.
  • @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.
  • @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:
  • @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.
  • @brief When network 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.
  • @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. @return Status code of the operation: OK(0) for success.
  • @brief 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.
  • @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.
  • @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.
  • @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.
  • @brief Gets pre-configured resize algorithm. @ingroup Network @param network A pointer to ie_network_t instance. @param input_name Name of input data. @param resize_alg_result The pointer to the resize algorithm used for input blob creation. @return Status code of the operation: OK(0) for success.
  • @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.
  • @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.
  • @brief Get name of network. @ingroup Network @param network A pointer to the instance of the ie_network_t to get a name from. @param name Name of the network. @return Status code of the operation: OK(0) for success.
  • @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.
  • @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.
  • @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.
  • @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.
  • @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 output information. @param size_result A number of the network’s output information. @return Status code of the operation: OK(0) for success.
  • @brief Releases memory occupied by input_shapes. @ingroup Network @param inputShapes A pointer to the input_shapes to free memory.
  • @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.
  • @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.
  • @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. @return Status code of the operation: OK(0) for success.
  • @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.
  • @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.
  • @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.
  • @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.
  • @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.
  • @brief Release the memory allocated by ie_param_t. @param param A pointer to the ie_param_t to free memory.
  • @brief Release the memory allocated by ie_c_api_version. @param version A pointer to the ie_version_t to free memory.
  • Load all of the function definitions from a shared library.

Type Aliases

  • @enum IEStatusCode @brief This enum contains codes for all possible return values of the interface functions
  • @struct dimensions @brief Represents dimensions for input or output data
  • @struct ie_available_devices @brief Represent all available devices.
  • @struct ie_blob_buffer @brief Represents copied data from the given blob.
  • @struct ie_complete_call_back @brief Completion callback definition about the function and args
  • @struct ie_config @brief Represents configuration information that describes devices
  • @struct ie_core_version @brief Represents version information that describes devices and the inference engine runtime library
  • @struct ie_core_versions @brief Represents all versions information that describes all devices and the inference engine runtime library
  • @struct ie_param_config @brief Represents configuration parameter information
  • @struct ie_param @brief metric and config parameters.
  • @struct ie_version @brief Represents an API version information that reflects the set of supported features
  • @struct input_shape @brief Represents shape for input data
  • @struct input_shapes @brief Represents shapes for all input data
  • @struct roi_t @brief This structure describes roi data.
  • @struct tensor_desc @brief Represents detailed information for a tensor

Unions