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

Loading and Unloading model in NCS2 mode

Scorpion1
Beginner
555 Views

Is there some kind of function that can be used to unload a model when using a myriad in NCS2 mode? 

Currently I use the following code to load a model

img = "path to img"
model_xml = "path"
model_bin = "path"
ie = IECore()
net = ie.read_network(model=model_xml, weights=model_bin)
input_blob = next(iter(net.input_info))
device = 'MYRIAD'
exec_net = ie.load_network(network=net, device_name=device)

 And this to use it

(exec_net.infer(inputs={input_blob: img})

But if I try to load a model after this the myriad is no longer available for use, I'm presuming this is because there's some kind of wait before the previous network is unloaded. Which leads me to my question, is there a way to have it unload myself so its always available when I need it? 

 

To be clear I get an error trying to use the myriad directly after another network finishes, and it doesn't show up when I try to print available devices with this

print("Available devices:", ie.available_devices)

If my idea of "flushing" the myriad isn't the proper one is there any other way to accomplish what I need? Or do I need to just make a while loop waiting for it to be available again. 

Labels (2)
0 Kudos
2 Replies
Iffa_Intel
Moderator
532 Views

Greetings,


The NCS2 does require some time to load and unload which the time taken depends on the model you are using and its optimization.

Maybe you could try to put on some delay instead of immediately running new inference.



Sincerely,

Iffa


0 Kudos
Iffa_Intel
Moderator
515 Views

Greetings,


Intel will no longer monitor this thread since we have provided a solution. If you need any additional information from Intel, please submit a new question



Sincerely,

Iffa


0 Kudos
Reply