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

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

BUILT IN - ARTICLE INTRO SECOND COMPONENT
Summary

Method to read model's layer when using OpenVINO™ 2022.2

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 1 products