Intel® Distribution of OpenVINO™ Toolkit
Community assistance about the Intel® Distribution of OpenVINO™ toolkit, OpenCV, and all aspects of computer vision-related on Intel® platforms.
6392 Discussions

'openvino.inference_engine.ie_api.IENetwork' object has no attribute 'layers'

Adam_44
Novice
8,910 Views

Hi,

ubuntu 18.04
Python 3.7.3

I updated my OpenVINO from v2020.2.12 to v2021.2.185.

I faced 2 issues I couldn't solve:

1. I cannot visualize my yolo detection (cannot get layer params):
layer_params = YoloParams(self.network.layers[layer_name].params, out_blob.shape[2])
AttributeError: 'openvino.inference_engine.ie_api.IENetwork' object has no attribute 'layers'

2. And for the same reason I cannot check my model for unsupported layers:
unsupported_layers = [l for l in self.network.layers.keys() if l not in supported_layers]
AttributeError: 'openvino.inference_engine.ie_api.IENetwork' object has no attribute 'layers'

Could you point me alternative solutions for these?
Thanks in advance!

0 Kudos
1 Solution
Adli
Moderator
8,884 Views

Hi Adam_44,

 

Thank you for reaching out to us. 'ie_api.IENetwork.layers' is deprecated. The property has been removed in the 2021.2 release. Please refer to the following link: https://docs.openvinotoolkit.org/2021.1/ie_python_api/classie__api_1_1IENetwork.html

 

We suggest you use get_ops()/get_ordered_ops() methods from nGraph Python API for 2021.2 release. nGraph is the OpenVINO™ graph manipulation library, used to represent neural network models in the form of a computational graph. With nGraph Python APIs, you can create, inspect, and modify computational graphs. 

 

You can use the nGraph function's get_ordered_ops method to get a topologically sorted list of its graph Nodes. Please refer to the following page for the examples.

 

Regards,

Adli

 

View solution in original post

7 Replies
Adli
Moderator
8,885 Views

Hi Adam_44,

 

Thank you for reaching out to us. 'ie_api.IENetwork.layers' is deprecated. The property has been removed in the 2021.2 release. Please refer to the following link: https://docs.openvinotoolkit.org/2021.1/ie_python_api/classie__api_1_1IENetwork.html

 

We suggest you use get_ops()/get_ordered_ops() methods from nGraph Python API for 2021.2 release. nGraph is the OpenVINO™ graph manipulation library, used to represent neural network models in the form of a computational graph. With nGraph Python APIs, you can create, inspect, and modify computational graphs. 

 

You can use the nGraph function's get_ordered_ops method to get a topologically sorted list of its graph Nodes. Please refer to the following page for the examples.

 

Regards,

Adli

 

Adam_44
Novice
8,859 Views

Hi Adli,

Thank you for your answer! I managed to sort it out with the sources provided.

If anyone wants to run the object_detection_demo_yolov3_async from the earlier release, adding/changing the following lines worked for me:

import ngraph as ng

function = ng.function_from_cnn(self.network)

self.anchors = param['anchors']
mask = param['mask']

out_blob = out_blob.reshape(net.outputs[layer_name].shape)
params = [x._get_attributes() for x in function.get_ordered_ops() if x.get_friendly_name() == layer_name][0]
layer_params = YoloParams(params, out_blob.shape[2])

Regards,
Adam_44

Benjamin1
Novice
8,812 Views

Hi Adam , can you share me code of the object_detection_demo_yolov3_async.py  ? 

It would help me a lot, I'm with the new version of OpenVIno and I can't solve the problem, thanks

0 Kudos
Adam_44
Novice
8,799 Views

Hi @Benjamin1,
Sure thing!

I created a gist:
https://gist.github.com/AdamGerzsai/d2b596729e127e449cbf2e6613411dd0

It is working for me, however I'd recommend you to study the object_detection_demo from the latest version for more sophisticated solution.
It has implementations for various different model architectures including yolo.
Precisely they are in 'python_demos/common/models' folder, which I couldn't find earlier.

Adli
Moderator
8,850 Views

Hi Adam_44,

 

Thank you for sharing your workaround. We highly value your contribution to this community.


Regards,

Adli


0 Kudos
Adli
Moderator
8,848 Views

Hi Adam_44,

 

This thread will no longer be monitored since this issue has been resolved. If you need any additional information from Intel, please submit a new question.


Regards,

Adli


0 Kudos
venkatanil
Beginner
7,575 Views

hey did you find the solution for the 2nd question?

 

 

2. And for the same reason I cannot check my model for unsupported layers:
unsupported_layers = [l for l in self.network.layers.keys() if l not in supported_layers]
AttributeError: 'openvino.inference_engine.ie_api.IENetwork' object has no attribute 'layers'

0 Kudos
Reply