openvino.runtime.Core

class openvino.runtime.Core

Bases: openvino.pyopenvino.Core

Core class represents OpenVINO runtime Core entity.

User applications can create several Core class instances, but in this case, the underlying plugins are created multiple times and not shared between several Core instances. The recommended way is to have a single Core instance per application.

__init__(self: openvino.pyopenvino.Core, xml_config_file: str = '') None

Methods

__delattr__(name, /)

Implement delattr(self, name).

__dir__()

Default dir() implementation.

__eq__(value, /)

Return self==value.

__format__(format_spec, /)

Default object formatter.

__ge__(value, /)

Return self>=value.

__getattribute__(name, /)

Return getattr(self, name).

__gt__(value, /)

Return self>value.

__hash__()

Return hash(self).

__init__(self[, xml_config_file])

__init_subclass__

This method is called when a class is subclassed.

__le__(value, /)

Return self<=value.

__lt__(value, /)

Return self<value.

__ne__(value, /)

Return self!=value.

__new__(**kwargs)

__reduce__()

Helper for pickle.

__reduce_ex__(protocol, /)

Helper for pickle.

__repr__()

Return repr(self).

__setattr__(name, value, /)

Implement setattr(self, name, value).

__sizeof__()

Size of object in memory, in bytes.

__str__()

Return str(self).

__subclasshook__

Abstract classes can override this to customize issubclass().

add_extension(*args, **kwargs)

Overloaded function.

compile_model(model[, device_name, config])

Compile a model from given Model.

get_property(self, device_name, name)

Gets properties dedicated to device behaviour.

get_versions(self, device_name)

Returns device plugins version information.

import_model(model_stream, device_name[, config])

Compile a model from given model file path.

query_model(self, model, device_name[, ...])

Query device if it supports specified model with specified properties.

read_model(*args, **kwargs)

Overloaded function.

register_plugin(self, plugin_name, device_name)

Register a new device and plugin which enable this device inside OpenVINO Runtime.

register_plugins(self, xml_config_file)

Registers a device plugin to OpenVINO Runtime Core instance using XML configuration file with plugins description.

set_property(*args, **kwargs)

Overloaded function.

unload_plugin(self, device_name)

Unloads the previously loaded plugin identified by device_name from OpenVINO Runtime.

Attributes

available_devices

Returns devices available for inference Core objects goes over all registered plugins.

__class__

alias of pybind11_builtins.pybind11_type

__delattr__(name, /)

Implement delattr(self, name).

__dir__()

Default dir() implementation.

__eq__(value, /)

Return self==value.

__format__(format_spec, /)

Default object formatter.

__ge__(value, /)

Return self>=value.

__getattribute__(name, /)

Return getattr(self, name).

__gt__(value, /)

Return self>value.

__hash__()

Return hash(self).

__init__(self: openvino.pyopenvino.Core, xml_config_file: str = '') None
__init_subclass__()

This method is called when a class is subclassed.

The default implementation does nothing. It may be overridden to extend subclasses.

__le__(value, /)

Return self<=value.

__lt__(value, /)

Return self<value.

__ne__(value, /)

Return self!=value.

__new__(**kwargs)
__reduce__()

Helper for pickle.

__reduce_ex__(protocol, /)

Helper for pickle.

__repr__()

Return repr(self).

__setattr__(name, value, /)

Implement setattr(self, name, value).

__sizeof__()

Size of object in memory, in bytes.

__str__()

Return str(self).

__subclasshook__()

Abstract classes can override this to customize issubclass().

This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached).

add_extension(*args, **kwargs)

Overloaded function.

  1. add_extension(self: openvino.pyopenvino.Core, library_path: str) -> None

    Registers an extension to a Core object.

    param library_path

    Path to library with ov::Extension

    type library_path

    str

  2. add_extension(self: openvino.pyopenvino.Core, extension: ov::Extension) -> None

    Registers an extension to a Core object.

    param extension

    Extension object.

    type extension

    openvino.runtime.Extension

  3. add_extension(self: openvino.pyopenvino.Core, extensions: List[ov::Extension]) -> None

    Registers extensions to a Core object.

    param extensions

    List of Extension objects.

    type extensions

    list[openvino.runtime.Extension]

property available_devices

Returns devices available for inference Core objects goes over all registered plugins.

Returns

A list of 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. Such enumerated device can later be used as a device name in all Core methods like: compile_model, query_model, set_property and so on.

Return type

list

compile_model(model: Union[openvino.pyopenvino.Model, str], device_name: Optional[str] = None, config: Optional[dict] = None) openvino.runtime.ie_api.CompiledModel

Compile a model from given Model.

get_property(self: openvino.pyopenvino.Core, device_name: str, name: str) object

Gets properties dedicated to device behaviour.

Parameters
  • device_name (str) – A name of a device to get a properties value.

  • name (str) – Property name.

Returns

Extracted information from property.

Return type

object

get_versions(self: openvino.pyopenvino.Core, device_name: str) Dict[str, ov::Version]

Returns device plugins version information.

Parameters

device_name (str) – Device name to identify a plugin.

Returns

Plugin version information.

Return type

Dict[str, openvino.runtime.Version]

import_model(model_stream: str, device_name: str, config: Optional[dict] = None) openvino.runtime.ie_api.CompiledModel

Compile a model from given model file path.

query_model(self: openvino.pyopenvino.Core, model: openvino.pyopenvino.Model, device_name: str, properties: Dict[str, str] = {}) Dict[str, str]

Query device if it supports specified model with specified properties.

Parameters
  • model (openvino.runtime.Model) – Model object to query.

  • device_name (str) – A name of a device to query.

  • properties (dict) – Optional dict of pairs: (property name, property value)

Returns

Pairs a operation name -> a device name supporting this operation.

Return type

dict

read_model(*args, **kwargs)

Overloaded function.

  1. read_model(self: openvino.pyopenvino.Core, model: bytes, weights: bytes = b’’) -> openvino.pyopenvino.Model

    Reads models from IR / ONNX / PDPD formats.

    param model

    Bytes with model in IR / ONNX / PDPD format.

    type model

    bytes

    param weights

    Bytes with tensor’s data.

    type weights

    bytes

    return

    A model.

    rtype

    openvino.runtime.Model

  2. read_model(self: openvino.pyopenvino.Core, model: str, weights: str = ‘’) -> openvino.pyopenvino.Model

    Reads models from IR / ONNX / PDPD formats.

    param model

    A path to a model in IR / ONNX / PDPD format.

    type model

    str

    param weights

    A path to a data file For IR format (.bin): if path is empty, it tries to read a bin file with the same name as xml and if the bin file with the same name was not found, loads IR without weights. For ONNX format (.onnx): weights parameter is not used. For PDPD format (*.pdmodel) weights parameter is not used.

    type weights

    str

    return

    A model.

    rtype

    openvino.runtime.Model

  3. read_model(self: openvino.pyopenvino.Core, model: str, weights: ov::Tensor) -> openvino.pyopenvino.Model

    Reads models from IR / ONNX / PDPD formats.

    param model

    A string with model in IR / ONNX / PDPD format.

    type model

    str

    param weights

    Tensor with weights. Reading ONNX / PDPD models doesn’t support loading weights from weights tensors.

    type weights

    openvino.runtime.Tensor

    return

    A model.

    rtype

    openvino.runtime.Model

  4. read_model(self: openvino.pyopenvino.Core, model: object, weights: object = ‘’) -> openvino.pyopenvino.Model

    Reads models from IR / ONNX / PDPD formats.

    param model

    A string with model in IR / ONNX / PDPD format.

    type model

    str

    param weights

    A path to a data file For IR format (.bin): if path is empty, it tries to read a bin file with the same name as xml and if the bin file with the same name was not found, loads IR without weights. For ONNX format (.onnx): weights parameter is not used. For PDPD format (*.pdmodel) weights parameter is not used.

    type weights

    str

    return

    A model.

    rtype

    openvino.runtime.Model

register_plugin(self: openvino.pyopenvino.Core, plugin_name: str, device_name: str) None

Register a new device and plugin which enable this device inside OpenVINO Runtime.

Parameters
  • plugin_name (str) – A name of plugin. Depending on platform plugin_name is wrapped with shared library suffix and prefix to identify library full name E.g. on Linux platform plugin name specified as plugin_name will be wrapped as libplugin_name.so.

  • device_name (str) – A device name to register plugin for.

register_plugins(self: openvino.pyopenvino.Core, xml_config_file: str) None

Registers a device plugin to OpenVINO Runtime Core instance using XML configuration file with plugins description.

Parameters

xml_config_file (str) – A path to .xml file with plugins to register.

set_property(*args, **kwargs)

Overloaded function.

  1. set_property(self: openvino.pyopenvino.Core, properties: Dict[str, object]) -> None

    Sets properties.

    param properties

    Optional dict of pairs: (property name, property value).

    type properties

    dict

  2. set_property(self: openvino.pyopenvino.Core, device_name: str, properties: Dict[str, object]) -> None

    Sets properties for the device.

    param device_name

    Name of the device.

    type device_name

    str

    param properties

    Optional dict of pairs: (property name, property value).

    type properties

    dict

unload_plugin(self: openvino.pyopenvino.Core, device_name: str) None

Unloads the previously loaded plugin identified by device_name from OpenVINO Runtime. The method is needed to remove loaded plugin instance and free its resources. If plugin for a specified device has not been created before, the method throws an exception.

Parameters

device_name (str) – A device name identifying plugin to remove from OpenVINO.