diff --git a/samples/js/node/README.md b/samples/js/node/README.md index e334f8ee918..f0b18b15dd4 100644 --- a/samples/js/node/README.md +++ b/samples/js/node/README.md @@ -1,13 +1,16 @@ -# OpenVINO™ JavaScript API examples of usage +# OpenVINO™ Node.js Bindings Examples of Usage -## Installation of openvino-node package -From *openvino/src/bindings/js/node* run `npm i` to download OpenVINO™ runtime, install requirements, build bindings and compile TypeScript code to JavaScript +## Install -On the *.nix systems run `source openvino/src/bindings/js/node/scripts/setupvars.sh` to add path to OpenVINO™ runtime libraries in `LD_LIBRARY_PATH` variable +To run samples, install dependencies first. In current directory run: +```bash +npm install +``` Note: Perform these steps also before running notebooks. ## Samples + - hello_classification - hello_reshape_ssd - classification_sample_async @@ -17,10 +20,13 @@ Note: Perform these steps also before running notebooks. Use [Node.js Notebooks (REPL)](https://marketplace.visualstudio.com/items?itemName=donjayamanne.typescript-notebook) VSCode extension to run these notebook samples -Make sure that `LD_LIBRARY_PATH` variable contains path to OpenVINO runtime folder - - ./notebooks - - 001-hello-world.nnb - - 003-hello-segmentation.nnb - - 004-hello-detection.nnb - - 213-question-answering.nnb + - 001-hello-world.nnb + - 003-hello-segmentation.nnb + - 004-hello-detection.nnb + - 213-question-answering.nnb + +## See Also + +* [OpenVINO™ JavaScript API Developer Documentation](../../../src/bindings/js/docs/README.md#openvino-node-package-developer-documentation) +* [OpenVINO™ README](../../../README.md) diff --git a/samples/js/node/classification_sample_async/README.md b/samples/js/node/classification_sample_async/README.md index 209eeaa5828..0b19e908587 100644 --- a/samples/js/node/classification_sample_async/README.md +++ b/samples/js/node/classification_sample_async/README.md @@ -1,8 +1,10 @@ -# Image Classification Async NodeJS Sample +# Image Classification Async Node.js Sample Models with only 1 input and output are supported. Run: -`node classification_sample_async.js -m *path_to_model_file* -i *path_to_img1* -i *path_to_img2* -d AUTO` +```bash +node classification_sample_async.js -m *path_to_model_file* -i *path_to_img1* -i *path_to_img2* -d AUTO +``` -Other details see in /samples/python/classification_sample_async/README.md +Other details see in [../../../python/classification_sample_async/README.md](../../../python/classification_sample_async/README.md) diff --git a/samples/js/node/hello_classification/README.md b/samples/js/node/hello_classification/README.md index f300d848e87..2de983af583 100644 --- a/samples/js/node/hello_classification/README.md +++ b/samples/js/node/hello_classification/README.md @@ -1,8 +1,10 @@ -# Hello Classification NodeJS Sample +# Hello Classification Node.js Sample Models with only 1 input and output are supported. Run: -`node hello_classification.js *path_to_model_file* *path_to_img* AUTO` +```bash +node hello_classification.js *path_to_model_file* *path_to_img* AUTO +``` -Other details see in /samples/python/hello_classification/README.md +Other details see in [../../../python/hello_classification/README.md](../../../python/hello_classification/README.md) diff --git a/samples/js/node/hello_reshape_ssd/README.md b/samples/js/node/hello_reshape_ssd/README.md index 41bef928bf4..21d8be8ec4b 100644 --- a/samples/js/node/hello_reshape_ssd/README.md +++ b/samples/js/node/hello_reshape_ssd/README.md @@ -1,8 +1,11 @@ -# Hello Reshape SSD NodeJS Sample +# Hello Reshape SSD Node.js Sample Models with only 1 input and output are supported. Run: -`node hello_reshape_ssd.js *path_to_model_file* *path_to_img* AUTO` +```bash +node hello_reshape_ssd.js *path_to_model_file* *path_to_img* AUTO +``` + +Other details see in [../../../python/hello_reshape_ssd/README.md](../../../python/hello_reshape_ssd/README.md) -Other details see in /samples/python/hello_reshape_ssd/README.md diff --git a/src/bindings/README.md b/src/bindings/README.md index 51868fd1a3e..f8436986383 100644 --- a/src/bindings/README.md +++ b/src/bindings/README.md @@ -5,7 +5,7 @@ OpenVINO provides bindings for several languages: * [c](./c) * [python](./python) * [javascript](./js) - * [nodejs](./js/nodejs) + * [node.js](./js/node) ## See also * [OpenVINO™ README](../../README.md) diff --git a/src/bindings/js/README.md b/src/bindings/js/README.md index 2e754aa32d9..d2f24d9273b 100644 --- a/src/bindings/js/README.md +++ b/src/bindings/js/README.md @@ -1,3 +1,3 @@ # OpenVINO™ JavaScript API -- `./node` - openvino-node NPM package with Node.js bindings +- [./node](./node) - **openvino-node** npm package with OpenVINO Node.js bindings diff --git a/src/bindings/js/docs/README.md b/src/bindings/js/docs/README.md index edff31df19e..ed2e5f5775a 100644 --- a/src/bindings/js/docs/README.md +++ b/src/bindings/js/docs/README.md @@ -1,4 +1,83 @@ -# Javascript bindings +# OpenVINO™ JavaScript Bindings + +## Folders - `./docs` - documentation -- `./node` - openvino-node NPM package with Node.js bindings +- `./node` - openvino-node npm package + +## openvino-node Package Developer Documentation + +### Components + +- [include](../node/include/) - header files for current API. +- [lib](../node/lib/) - TypeScript sources for current API. +- [src](../node/src/) - C++ sources for current API. +- [tests](../node/tests/) - tests directory for current API. + +### Build + +- Make sure that all submodules are updated: + ```bash + git submodule update --init --recursive + ``` +- Create the *build* directory: + ```bash + mkdir build && cd build + ``` +- Configure building of the binaries: + ```bash + cmake \ + -DCMAKE_BUILD_TYPE=Release \ + -DENABLE_FASTER_BUILD=ON \ + -DCPACK_GENERATOR=NPM \ + -DENABLE_SYSTEM_TBB=OFF -UTBB* \ + -DENABLE_TESTS=OFF \ + -DENABLE_SAMPLES=OFF \ + -DENABLE_WHEEL=OFF \ + -DENABLE_PYTHON=OFF \ + -DENABLE_INTEL_GPU=OFF \ + -DCMAKE_INSTALL_PREFIX=../src/bindings/js/node/bin \ + .. + ``` +- Build the bindings: + ```bash + cmake --build . --config Release --verbose -j4 + ``` +- Install binaries for the *openvino-node* package: + ```bash + cmake --install . + ``` +- Navigate to the *npm* package folder: + ```bash + cd ../src/bindings/js/node + ``` +- Now, you can install dependencies packages and transpile ts to js code: + ```bash + npm install + ``` +- Run tests to make sure that **openvino-node** has been built successfully: + ```bash + npm run test + ``` + +## Usage + +- Add the **openvino-node** package to your project by specifying it in **package.json**: + ```json + "openvino-node": "file:*path-to-current-directory*" + ``` +- Make sure to require it: + ```js + const { addon: ov } = require('openvino-node'); + ``` + +## Samples + +[OpenVINO™ Node.js Bindings Examples of Usage](../../../../samples/js/node/README.md) + +## See Also + +* [OpenVINO™ README](../../../../README.md) +* [OpenVINO™ Core Components](../../../README.md) +* [OpenVINO™ JavaScript API](../README.md) +* [OpenVINO™ Node.js Bindings](../node/README.md) diff --git a/src/bindings/js/node/.npmignore b/src/bindings/js/node/.npmignore index a961be5e3aa..e4fe3743e7d 100644 --- a/src/bindings/js/node/.npmignore +++ b/src/bindings/js/node/.npmignore @@ -3,6 +3,7 @@ include lib src tests +thirdparty .eslintrc.js CMakeLists.txt diff --git a/src/bindings/js/node/README.md b/src/bindings/js/node/README.md index c9da79d593a..426bda13477 100644 --- a/src/bindings/js/node/README.md +++ b/src/bindings/js/node/README.md @@ -1,50 +1,35 @@ -# OpenVINO Node.js API +# OpenVINO™ Node.js Bindings -## Components - -- [include](./include/) - header files for current API. -- [lib](./lib/) - TypeScript sources for current API. -- [src](./src/) - C++ sources for current API. -- [tests](./tests/) - tests directory for current API. - -## Build - -- Make sure that all submodules are updated `git submodule update --init --recursive` -- Create build dir `mkdir build && cd build` -- Configure binaries building: - ```bash - cmake \ - -DCMAKE_BUILD_TYPE=Release \ - -DENABLE_FASTER_BUILD=ON \ - -DCPACK_GENERATOR=NPM \ - -DENABLE_SYSTEM_TBB=OFF -UTBB* \ - -DENABLE_TESTS=OFF \ - -DENABLE_SAMPLES=OFF \ - -DENABLE_WHEEL=OFF \ - -DENABLE_PYTHON=OFF \ - -DENABLE_INTEL_GPU=OFF \ - -DCMAKE_INSTALL_PREFIX=../src/bindings/js/node/bin \ - .. - ``` -- Build bindings: - `cmake --build . --config Release --verbose -j4` -- Install binaries for openvino-node package: - `cmake --install .` -- Go to npm package folder `cd ../src/bindings/js/node` -- Now you can install dependencies packages and transpile ts to js code. Run `npm install` -- Run tests `npm run test` to make sure that **openvino-node** built successfully +Use OpenVINO JavaScript API for your Node.js application. ## Usage -- Add `openvino-node` package in your project, specify in **package.json**: `"openvino-node": "file:*path-to-current-directory*"` -- Require by: `const ov = require('openvino-node');` +Install the **openvino-node** package: +```bash +npm install openvino-node +``` -## Samples +Use the **openvino-node** package: +```js +const { addon: ov } = require('openvino-node'); +``` -[Samples & notebooks of OpenVINO Node.js API](../../../../samples/js/node/README.md) +## Build From Sources -## See also +For more details, refer to the [OpenVINO™ JavaScript API Developer Documentation](https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/js/docs/README.md#openvino-node-package-developer-documentation) -* [OpenVINO™ README](../../../../README.md) -* [OpenVINO™ Core Components](../../../README.md) -* [OpenVINO™ JavaScript API](../README.md) +## Documentation & Samples + +- [OpenVINO™ Node.js API](https://docs.openvino.ai/2024/api/nodejs_api/nodejs_api.html) +- [OpenVINO™ Node.js Bindings Examples of Usage](https://github.com/openvinotoolkit/openvino/blob/master/samples/js/node/README.md) + +## See Also + +* [OpenVINO™ README](https://github.com/openvinotoolkit/openvino/blob/master/README.md) +* [OpenVINO™ Core Components](https://github.com/openvinotoolkit/openvino/blob/master/src/README.md) +* [OpenVINO™ Python API](https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/python/README.md) +* [OpenVINO™ Other Bindings](https://github.com/openvinotoolkit/openvino/blob/master/src/bindings/README.md) + +[License](https://github.com/openvinotoolkit/openvino/blob/master/LICENSE) + +Copyright © 2018-2024 Intel Corporation diff --git a/src/bindings/js/node/package-lock.json b/src/bindings/js/node/package-lock.json index 00eb7e71c7c..a8304774ffa 100644 --- a/src/bindings/js/node/package-lock.json +++ b/src/bindings/js/node/package-lock.json @@ -1,12 +1,12 @@ { "name": "openvino-node", - "version": "2024.0.0-14428.dev20240212", + "version": "2024.0.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "openvino-node", - "version": "2024.0.0-14428.dev20240212", + "version": "2024.0.0", "hasInstallScript": true, "license": "Apache-2.0", "os": [