Skip to content
This repository has been archived by the owner on Apr 18, 2023. It is now read-only.

Add the OpenVINO.js framework #1383

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

lionkunonly
Copy link

The OpenVINO.js framework exists in the example for image classification, semantic_segmentation, speech_commands, and speech_recognition. It works when the Electron Application with integrated node.js.

semantic_segmentation, speech_commands, and speech_recognition. It only
works when the Electron Application with integrated node.js.
package.json Outdated
"webpack-dev-server": "^3.1.10",
"@webgpu/glslang": "0.0.12",
"@webgpu/types": "0.0.24",
"@tensorflow/tfjs-backend-webgpu": "0.0.1-alpha.4",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@BruceDai Does it mean @lionkunonly has added WebGPU backend support successfully?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lionkunonly We've already added WebGPU backend support on Line#30, Line#32, Line#33, please remove these duplicated devDependencies, thanks.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

Copy link
Contributor

@BruceDai BruceDai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lionkunonly I have left some coding style suggestions, please update them.

package.json Outdated
"webpack-dev-server": "^3.1.10",
"@webgpu/glslang": "0.0.12",
"@webgpu/types": "0.0.24",
"@tensorflow/tfjs-backend-webgpu": "0.0.1-alpha.4",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lionkunonly We've already added WebGPU backend support on Line#30, Line#32, Line#33, please remove these duplicated devDependencies, thanks.

@@ -20,6 +20,8 @@ class ImageClassificationExample extends BaseCameraExample {
case 'OpenCV.js':
runner = new ImageClassificationOpenCVRunner();
break;
case 'OpenVINO.js':
runner = new ImageClassificationOpenVINORunner();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lionkunonly Here missed a 'break'.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -36,6 +39,8 @@ class ImageClassificationExample extends BaseCameraExample {
case 'OpenCV.js':
labelClasses = getTopClasses(output.tensor, output.labels, 3);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lionkunonly The case 'OpenVINO.js' uses the same code as case 'OpenCV.js', you could code as

      case 'OpenCV.js':
      case 'OpenVINO.js':

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

runner = new WebNNRunner();
break;
case 'OpenVINO.js':
runner = new OpenVINORunner();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lionkunonly Here missed a 'break'

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

runner = new SpeechRecognitionRunner();
break;
case 'OpenVINO.js':
runner = new SpeechRecognitionOpenVINORunner();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lionkunonly ditto.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@@ -28,6 +30,7 @@ class ImageClassificationExample extends BaseCameraExample {
/** @override */
_processExtra = (output) => {
let labelClasses;
console.log(output);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lionkunonly Please remove this console.log line, thanks.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done

@lionkunonly
Copy link
Author

@BruceDai @ibelem Here is the result of the comparison between the WebNN on the Chrome and OpenVINO.js on Electron

Environment: Environment: Electron v11.01 Chrome: 86.0.4209.0 OpenVINO 2020.3.194 Windows 10 TGL i7-1165G7

  • Image Classification Example
Model WebNN Perf(FAST_SINGLE_ANSWER)(ms) OpenVINO.js Perf(ms)
SqueezeNet 3.14 3.68
MobileNet v1 4.58 4.62
MobileNet v2 3.89 4.10
ResNet50 v1 19.6 20.7
DenseNet 121 15.58 15.43
Inception v2 10.68 12.87
Inception v4 57.54 57.51
  • Semantic Segmentation Example
Model WebNN Perf(FAST_SINGLE_ANSWER)(ms) OpenVINO.js Perf(ms)
Deeplab_224_Atrous 12.58 13
Deeplab_224_Quant 7.27 7.55
Deeplab_257_Atrous 15.13 16.7
Deeplab_257_Quant 8.07 8.37
Deeplab_321_Atrous 22.47 23.82
Deeplab_321_Quant 10.84 11.93
Deeplab_513_Atrous 59.99 61.27
Deeplab_513_Quant 25.72 28.38
  • Speech Commands Example
Model WebNN Perf(FAST_SINGLE_ANSWER)(ms) OpenVINO.js Perf(ms)
KWS DNN (Yes Example) 0.43 0.28
  • Speech Recognition Example
Model WebNN Perf(FAST_SINGLE_ANSWER)(ms) OpenVINO.js Perf(ms)
wsj_dnn5b 2.48 2.37

 
 
 

this._setBackend(null);
};

// _configureBackend = ()=> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lionkunonly Please remove these commented lines, thanks.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants