intel / inference-engine-node

Bringing the hardware accelerated deep learning inference to Node.js and Electron.js apps.
Apache License 2.0
33 stars 8 forks source link

Use native API `StartAsync` to complete the inference #59

Closed lionkunonly closed 3 years ago

lionkunonly commented 3 years ago

@artyomtugaryov Hi, I utilize your implementation for StartAsync with node-binding. It can run the inference successfully in my tests.

lionkunonly commented 3 years ago

However, It seems that it can not run the inference continuously. For example:

const infer_req = exec_net.createInferRequest();
infer_req.setCompletionCallback(() => {
           infer_req.nativeStartAsync();
        });
infer_req.nativeStartAsync();

In this code, we try to run the inference with infer_req.nativeStartAsync() again when the previous inference is over. This will cause an error in this code. I find the native IE can solve such an operation successfully. But I do not know why it meets failure in node binding.

artyomtugaryov commented 3 years ago

Hello, @lionkunonly I suggest using something like this code on the node side:

const infer_req = exec_net.createInferRequest();
infer_req.nativeStartAsync(() => {
           infer_req.nativeStartAsync();
        });

What do you think about it?