[DOCS][OV JS] Update JS API readme (#23138)

### Details:
 - Actualize JS API readme file for npm
 - Fix link to node directory
 - Fix .npmignore to do not include extra files into npm package

---------

Co-authored-by: Sebastian Golebiewski <sebastianx.golebiewski@intel.com>
This commit is contained in:
Vishniakov Nikolai 2024-02-29 17:36:52 +01:00 committed by GitHub
parent 8b792927fa
commit 3d0ea5b4a9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
10 changed files with 145 additions and 67 deletions

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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

View File

@ -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)

View File

@ -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

View File

@ -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)

View File

@ -3,6 +3,7 @@ include
lib
src
tests
thirdparty
.eslintrc.js
CMakeLists.txt

View File

@ -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

View File

@ -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": [