cloud-annotations / object-detection-react

⚛️ Real-Time Custom Object Detection with TensorFlow.js
MIT License
255 stars 108 forks source link

Run TensorFlow Node JS #35

Closed wilkensgomes closed 3 years ago

wilkensgomes commented 3 years ago

How do I run the converted model with the js tensorflow for node?

Any example to receive only boxes and scores?

bourdakos1 commented 3 years ago

You can use the javascript sdk: https://github.com/cloud-annotations/javascript-sdk

Just make sure you install @cloud-annotations/models-node not @cloud-annotations/models

wilkensgomes commented 3 years ago

`const models = require('@cloud-annotations/models-node') const fs = require('fs');

async function detect() { const imageFile = fs.readFileSync('image.jpg') models.load('file://model_web').then(async (model) => { const predictions = await model.detect(imageFile); console.log(predictions); }) }`

I get this error when trying to run the above code: ENVIRONMENT: WINDOWS 10, NODE v15.7.0

internal/modules/cjs/loader.js:1122 return process.dlopen(module, path.toNamespacedPath(filename)); ^

Error: The specified module could not be found.

bourdakos1 commented 3 years ago

maybe try npm rebuild @cloud-annotations/models-node --build-from-source

wilkensgomes commented 3 years ago

The same error continues. ☹

Captura de tela 2021-01-26 142742

bourdakos1 commented 3 years ago

oh what is file://model_web try without file://

wilkensgomes commented 3 years ago

disregard file:// even removed does not work!

wilkensgomes commented 3 years ago

Error: The specified module could not be found. \\?\D:\TFJS\node_modules\@tensorflow\tfjs-node\lib\napi-v6\tfjs_binding.node

Solution: move D:\ProjectPath\node_modules\@tensorflow\tfjs-node\deps\lib\tensorflow.dll to D:\ProjectPath\node_modules\@tensorflow\tfjs-node\lib\napi-v6\

bourdakos1 commented 3 years ago

@johnwalicki is this the issue that you were having as well?