Skip To Main Content
Support Knowledge Base

Is It Possible to Read Model’s Layer When Using OpenVINO™ 2022.2?

Content Type: Troubleshooting   |   Article ID: 000092984   |   Last Reviewed: 11/20/2023

Description

  1. Read model's layer with net.layers and layers.blob when using OpenVINO™ 2020.3. 
  2. Unable to read a model's layer when using OpenVINO™ 2022.2 as the net.layers and layers.blob have been deprecated since OpenVINO™ 2021.2.

Resolution

For OpenVINO™ 2022.2, the model layer's weights are located in the Constant operations of the network.

Use get_data() method to retrieve the weights value from Constant node in OpenVINO™ 2022.2:
from openvino.inference_engine import IECore
import ngraph as ng

ie = IECore()
path_xml="<model_name>.xml"
path_bin="<model_name>.bin"

net = ie.read_network(model=path_xml, weights=path_bin)

func = ng.function_from_cnn(net)

ops = func.get_ops()
print(ops[14]) #Print the node attributes for the specific node index
print(ops[14].get_data()) #Specific Constant operations layer, all weights are located in the Constant operations

Related Products

This article applies to 3 products.
Intel® Xeon Phi™ Processor Software OpenVINO™ toolkit Performance Libraries