openvinotoolkit / openvino_notebooks

📚 Jupyter notebook tutorials for OpenVINO™
Apache License 2.0
2.3k stars 791 forks source link

Unstable Neural Computer Stick 2? #95

Closed raymondlo84 closed 3 years ago

raymondlo84 commented 3 years ago

Somehow the NCS2 will automatically reset and after I ran the IE. I'm running this on Mac OSX. :\

---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-40-b5adb56a80e7> in <module>
----> 1 result = exec_net.infer(inputs={input_key: input_image})[output_key]
      2 result_index = np.argmax(result)

ie_api.pyx in openvino.inference_engine.ie_api.ExecutableNetwork.infer()

ie_api.pyx in openvino.inference_engine.ie_api.InferRequest.infer()

ie_api.pyx in openvino.inference_engine.ie_api.InferRequest.infer()

RuntimeError: Failed to queue inference: NC_ERROR
[I 2021-05-28 10:57:56.912 ServerApp] Saving file at /001-hello-world/001-hello-world.ipynb
E: [ncAPI] [    740904] [] checkGraphMonitorResponse:1937   Graph monitor request returned error -1
E: [ncAPI] [    740905] [] checkGraphMonitorResponse:1937   Graph monitor request returned error -1
E: [ncAPI] [    740905] [] checkGraphMonitorResponse:1937   Graph monitor request returned error -1
E: [global] [    741404] [WatchdogThread] getLinkByStreamId:290 Condition failed: *out_link == NULL
E: [global] [    741404] [WatchdogThread] XLinkWriteData:126    Condition failed: (getLinkByStreamId(streamId, &link))
E: [watchdog] [    741404] [WatchdogThread] sendPingMessage:128 Failed send ping message: X_LINK_ERROR
E: [global] [    741853] [] getLinkByStreamId:290   Condition failed: *out_link == NULL
E: [global] [    741853] [] XLinkWriteData:126  Condition failed: (getLinkByStreamId(streamId, &link))
E: [global] [    742405] [WatchdogThread] getLinkByStreamId:290 Condition failed: *out_link == NULL
E: [global] [    742405] [WatchdogThread] XLinkWriteData:126    Condition failed: (getLinkByStreamId(streamId, &link))
E: [watchdog] [    742405] [WatchdogThread] sendPingMessage:128 Failed send ping message: X_LINK_ERROR
E: [global] [    743408] [WatchdogThread] getLinkByStreamId:290 Condition failed: *out_link == NULL
E: [global] [    743408] [WatchdogThread] XLinkWriteData:126    Condition failed: (getLinkByStreamId(streamId, &link))
E: [watchdog] [    743408] [WatchdogThread] sendPingMessage:128 Failed send ping message: X_LINK_ERROR
E: [global] [    744410] [WatchdogThread] getLinkByStreamId:290 Condition failed: *out_link == NULL
E: [global] [    744410] [WatchdogThread] XLinkWriteData:126    Condition failed: (getLinkByStreamId(streamId, &link))
E: [watchdog] [    744410] [WatchdogThread] sendPingMessage:128 Failed send ping message: X_LINK_ERROR
E: [global] [    745412] [WatchdogThread] getLinkByStreamId:290 Condition failed: *out_link == NULL
E: [global] [    745412] [WatchdogThread] XLinkWriteData:126    Condition failed: (getLinkByStreamId(streamId, &link))
E: [watchdog] [    745412] [WatchdogThread] sendPingMessage:128 Failed send ping message: X_LINK_ERROR
E: [global] [    746411] [WatchdogThread] getLinkByStreamId:290 Condition failed: *out_link == NULL
E: [global] [    746411] [WatchdogThread] XLinkWriteData:126    Condition failed: (getLinkByStreamId(streamId, &link))
E: [watchdog] [    746411] [WatchdogThread] sendPingMessage:128 Failed send ping message: X_LINK_ERROR
E: [global] [    747413] [WatchdogThread] getLinkByStreamId:290 Condition failed: *out_link == NULL
E: [global] [    747413] [WatchdogThread] XLinkWriteData:126    Condition failed: (getLinkByStreamId(streamId, &link))
E: [watchdog] [    747413] [WatchdogThread] sendPingMessage:128 Failed send ping message: X_LINK_ERROR
E: [global] [    748415] [WatchdogThread] getLinkByStreamId:290 Condition failed: *out_link == NULL
E: [global] [    748415] [WatchdogThread] XLinkWriteData:126    Condition failed: (getLinkByStreamId(streamId, &link))
E: [watchdog] [    748415] [WatchdogThread] sendPingMessage:128 Failed send ping message: X_LINK_ERROR
E: [global] [    749418] [WatchdogThread] getLinkByStreamId:290 Condition failed: *out_link == NULL
E: [global] [    749418] [WatchdogThread] XLinkWriteData:126    Condition failed: (getLinkByStreamId(streamId, &link))
E: [watchdog] [    749418] [WatchdogThread] sendPingMessage:128 Failed send ping message: X_LINK_ERROR
E: [global] [    750422] [WatchdogThread] getLinkByStreamId:290 Condition failed: *out_link == NULL
E: [global] [    750422] [WatchdogThread] XLinkWriteData:126    Condition failed: (getLinkByStreamId(streamId, &link))
E: [watchdog] [    750422] [WatchdogThread] sendPingMessage:128 Failed send ping message: X_LINK_ERROR
E: [global] [    751425] [WatchdogThread] getLinkByStreamId:290 Condition failed: *out_link == NULL
E: [global] [    751425] [WatchdogThread] XLinkWriteData:126    Condition failed: (getLinkByStreamId(streamId, &link))
E: [watchdog] [    751425] [WatchdogThread] sendPingMessage:128 Failed send ping message: X_LINK_ERROR
E: [global] [    752428] [WatchdogThread] getLinkByStreamId:290 Condition failed: *out_link == NULL
E: [global] [    752428] [WatchdogThread] XLinkWriteData:126    Condition failed: (getLinkByStreamId(streamId, &link))
E: [watchdog] [    752428] [WatchdogThread] sendPingMessage:128 Failed send ping message: X_LINK_ERROR
E: [watchdog] [    752428] [WatchdogThread] watchdogRoutine:278 [0x7fc552b98f50] device, not respond, removing from watchdog
raymondlo84 commented 3 years ago

@helena-intel - also confirmed that this will also happen on Windows! scrnli_5_28_2021_2-49-55 PM

The neural stick will somehow got stuck. My initial guess is we did not release the resource properly after the execution... So if you restart the kernel it will work again (and by restarting the kernel you will hear the neural stick got connect and disconnected!).

raymondlo84 commented 3 years ago

https://movidius.github.io/ncsdk/ncapi/ncapi2/py_api/readme.html and I think we have to somehow setup this if people would like to try the neural stick with the notebooks...

  1. Clean up Before closing communication with the device, use Graph.destroy() and Fifo.destroy() to destroy the Graph and Fifo objects and clean up associated memory. The Fifos must be empty before being destroyed. Then use Device.close() to close the device and Device.destroy() to destroy the Device object and clean up associated memory.

Clean up

input_fifo.destroy() output_fifo.destroy() graph.destroy() device.close() device.destroy()

raymondlo84 commented 3 years ago

del exec_net

Found it. This is the way to free up the neural stick - basically remove the exec_net once you are done with it, and it will free up the stick automatically!

So for the hello world tutorial, you can put the "del exec_net" after you are done with all the results.

raymondlo84 commented 3 years ago

The workaround is stated above, and we will make a separate notebook to capture the 'special use cases' next.