Method to read model's layer when using OpenVINO™ 2022.2
- Read model's layer with net.layers and layers.blob when using OpenVINO™ 2020.3.
- 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.
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