openvino.inference_engine.IENetwork

class openvino.inference_engine.IENetwork

Bases: object

__init__()

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__()

__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__

IENetwork.__reduce_cython__(self)

__reduce_ex__(protocol, /)

Helper for pickle.

__repr__()

Return repr(self).

__setattr__(name, value, /)

Implement setattr(self, name, value).

__setstate__

IENetwork.__setstate_cython__(self, __pyx_state)

__sizeof__()

Size of object in memory, in bytes.

__str__()

Return str(self).

__subclasshook__

Abstract classes can override this to customize issubclass().

_get_function_capsule(self)

add_outputs(self, outputs)

Marks any intermediate layer as output layer to retrieve the inference results from the specified layers.

get_ov_name_for_tensor(self, unicode orig_name)

reshape(self, dict input_shapes)

Reshapes the network to change spatial dimensions, batch size, or any dimension.

serialize(self, path_to_xml, unicode path_to_bin)

Serializes the network and stores it in files.

Attributes

batch_size

Batch size of the network.

input_info

A dictionary that maps input layer names to InputInfoPtr objects.

name

Name of the loaded network

outputs

A dictionary that maps output layer names to DataPtr objects

__class__

alias of 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__()
__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__()

IENetwork.__reduce_cython__(self)

__reduce_ex__(protocol, /)

Helper for pickle.

__repr__()

Return repr(self).

__setattr__(name, value, /)

Implement setattr(self, name, value).

__setstate__()

IENetwork.__setstate_cython__(self, __pyx_state)

__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).

_get_function_capsule(self)
add_outputs(self, outputs)

Marks any intermediate layer as output layer to retrieve the inference results from the specified layers.

Parameters

outputs – List of layers to be set as model outputs. The list can contain strings with layer names to be set as outputs or tuples with layer name as first element and output port id as second element. In case of setting one layer as output, string or tuple with one layer can be provided.

Returns

None

Usage example:

ie = IECore()
net = ie.read_network(model=path_to_xml_file, weights=path_to_bin_file)
net.add_outputs(["conv5_1', conv2_1', (split_2, 1)])]
batch_size

Batch size of the network. Provides getter and setter interfaces to get and modify the network batch size. For example:

ie = IECore()
net = ie.read_network(model=path_to_xml_file, weights=path_to_bin_file)
print(net.batch_size)
net.batch_size = 4
print(net.batch_size)
print(net.input_info['data'].input_data.shape)
get_ov_name_for_tensor(self, unicode orig_name: str)
input_info

A dictionary that maps input layer names to InputInfoPtr objects.

name

Name of the loaded network

outputs

A dictionary that maps output layer names to DataPtr objects

reshape(self, dict input_shapes: dict)

Reshapes the network to change spatial dimensions, batch size, or any dimension.

Parameters

input_shapes – A dictionary that maps input layer names to tuples with the target shape

Returns

None

Note

Before using this method, make sure that the target shape is applicable for the network. Changing the network shape to an arbitrary value may lead to unpredictable behaviour.

Usage example:

ie = IECore()
net = ie.read_network(model=path_to_xml_file, weights=path_to_bin_file)
input_layer = next(iter(net.input_info))
n, c, h, w = net.input_info[input_layer].input_data.shape
net.reshape({input_layer: (n, c, h*2, w*2)})
serialize(self, path_to_xml, unicode path_to_bin: str = u'')

Serializes the network and stores it in files.

Parameters
  • path_to_xml – Path to a file, where a serialized model will be stored

  • path_to_bin – Path to a file, where serialized weights will be stored

Returns

None

Usage example:

ie = IECore()
net = ie.read_network(model=path_to_xml, weights=path_to_bin)
net.serialize(path_to_xml, path_to_bin)