Community
cancel
Showing results for 
Search instead for 
Did you mean: 
Adam_44
Novice
552 Views

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

Jump to solution

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

Accepted Solutions
Adli
Moderator
526 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

6 Replies
Adli
Moderator
527 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

Adam_44
Novice
501 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

Adli
Moderator
490 Views

Hi Adam_44,

 

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


Regards,

Adli


Adli
Moderator
488 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


Benjamin1
Novice
454 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

Adam_44
Novice
439 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.