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.
6403 Discussions

How can I use the export function of the ExecutableNetwork class?

B__Manu
Beginner
2,196 Views

Does someone know how to use the export function of the ExecutableNetwork class in Python?

 

Sample from Docu:

net = IENetwork(model=path_to_xml_file, weights=path_to_bin_file)

ie = IECore()

exec_net = plugin.load_network(network=net, device_name="MYRIAD", num_requsts=2)

exec_net.export(path_to_file_to_save)

 

which dataformat should I give it?

when I try to call the function I'm getting this error.:

Traceback (most recent call last):
  File "workspace/inference_engine/model_im_export_test.py", line 20, in <module>
    exec_net.export('path_to_file_to_save')
AttributeError: 'openvino.inference_engine.ie_api.ExecutableNetwork' object has no attribute 'export'

 

ps: I'm using the latest release (2019_R3.1)

0 Kudos
6 Replies
Luis_at_Intel
Moderator
2,196 Views

Hi B, Manu,

Thanks for reaching out. There are a couple examples you can take a look at, I believe this is how you would use it:

model_xml = "/home/user/Intel/models/face-detection-retail-0004.xml"
model_bin = "/home/user/Intel/models/face-detection-retail-0004.bin"
model_exp = "/home/user/Intel/models/face-detection-retail-0004-export"

net = IENetwork(model=model_xml , weights=model_bin) 
plugin = IEPlugin(device="CPU")
ie = IECore()
exec_net = plugin.load(network=net, num_requests=2)
exec_net.export(model_exp)

However, I am having issues as the Inference Engine comes back with an attribute error "AttributeError: 'openvino.inference_engine.ie_api.ExecutableNetwork' object has no attribute 'export'". I am not sure if this is a documentation issue, usage error on our part or a bug in the tool, I may need to check and get back to you.

 

Regards,

Luis

0 Kudos
B__Manu
Beginner
2,196 Views

Thank for your reply. Year I'm getting the same error. Its only included in the documentation of the 2019_R3.1 Release.

Maybe a knew function which isn't implemented yet?

0 Kudos
Luis_at_Intel
Moderator
2,196 Views

Yes, that is what it sounds like to me but I want to confirm that is indeed the case. I will get back to you shortly, thanks!

 

Regards,

Luis

0 Kudos
B__Manu
Beginner
2,196 Views

Hi Luis,

something new about the export function?

is it included in the new 2020 release? haven't changed yet.

regards manu

0 Kudos
Luis_at_Intel
Moderator
2,196 Views

Hi Manu,

Thank you for your patience, I have heard back from the team and the export function is only available for the MYRIAD/GNA plugins. This explains the error I was getting when using CPU plugin.

This seems to be working on 2020.1 but not in R3.1, I have tried it for Linux and I can see the export being created. Please take a look at the test code I used below:

import logging
import sys
from time import time

from openvino.inference_engine import IENetwork, IECore, IEPlugin

logging.basicConfig(format="[ %(levelname)s ] %(message)s", level=logging.INFO, stream=sys.stdout)
log = logging.getLogger()

model_xml = "/home/user/843461/frozen_darknet_yolov3_model.xml"
model_bin = "/home/user/843461/frozen_darknet_yolov3_model.bin"
model_exp = "/home/user/843461/darknet_yolov3_export"

log.info("Loading network files:\n\t{}\n\t{}".format(model_xml, model_bin))
net = IENetwork(model=model_xml , weights=model_bin) 
plugin = IEPlugin(device="MYRIAD")
ie = IECore()
exec_net = plugin.load(network=net, num_requests=2)
exec_net.export(model_exp)
log.info("Exporting executable network:\n\t{}".format(model_exp))
#OUTPUT
[ INFO ] Loading network files:
	/home/user/843461/frozen_darknet_yolov3_model.xml
	/home/user/843461/frozen_darknet_yolov3_model.bin
[ INFO ] Exporting executable network:
	/home/user/843461/darknet_yolov3_export

Regards.

Luis

 

0 Kudos
Luis_at_Intel
Moderator
1,562 Views

[UPDATE]

Models cache for CPU plugin (export() function of the ExecutableNetwork class for CPU) has been implemented by this PR #6403 in master branch, implementation should be part of the next software release. 

 

Best Regards,

Luis

0 Kudos
Reply