Reputation: 11
I'm trying to use face-api.js facial recognition functions, which would run a lot faster with an installed Node backend. I've installed the backends with npm as below:
$ node -v
v14.1.0
$ npm list @tensorflow/tfjs-node
[email protected] /Users/akoi/Dev/bwr
└── @tensorflow/[email protected]
$ npm list @tensorflow/tfjs
[email protected] /Users/akoi/Dev/bwr
├── @tensorflow/[email protected]
├─┬ @tensorflow/[email protected]
│ └── @tensorflow/[email protected] deduped
└─┬ @tensorflow/[email protected]
└── @tensorflow/[email protected] deduped
The face-api.js functions all work fine, just slow since the backend is not loading.
When I do attempt to load the backend according to the instructions, using:
require('@tensorflow/tfjs-node');
Here is the error I get when run:
TypeError: Cannot read property 'nonMaxSuppressionV3Impl' of undefined
at Object.<anonymous> (/Users/akoi/Dev/bwr/node_modules/@tensorflow/tfjs-backend-cpu/dist/tf-backend-cpu.node.js:268:47)
at Module._compile (internal/modules/cjs/loader.js:1176:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1196:10)
at Module.load (internal/modules/cjs/loader.js:1040:32)
at Function.Module._load (internal/modules/cjs/loader.js:929:14)
at Module.require (internal/modules/cjs/loader.js:1080:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object.<anonymous> (/Users/akoi/Dev/bwr/node_modules/@tensorflow/tfjs/dist/tf.node.js:25:22)
at Module._compile (internal/modules/cjs/loader.js:1176:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1196:10)
Any ideas? I've seen a similar issue raised last week, but no responses. All help and advice appreciated. Many thanks.
Upvotes: 1
Views: 2021
Reputation: 135
I have the same error with fresh installs. There were 2 issues happened to me.
First, Native Modules installation failed.
I noticed my installation of @tensorflow/tfjs-node
didn't installed successfully, even though NPM returns 0 exit code.
node-pre-gyp install failed with error: Error: Command failed: node-pre-gyp install --fallback-to-build
Since I'm using MacOS on installation, so I end up have to reinstall my XCode tools in order to fix the native modules binding.
sudo rm -rf $(xcode-select -print-path)
xcode-select --install
Second, Peer dependencies are not installed together with @tensorflow/tfjs-node
.
npm WARN @tensorflow/[email protected] requires a peer of @tensorflow/[email protected] but none is installed. You must install peer dependencies yourself.
npm WARN @tensorflow/[email protected] requires a peer of @tensorflow/[email protected] but none is installed. You must install peer dependencies yourself.
npm WARN @tensorflow/[email protected] requires a peer of @tensorflow/[email protected] but none is installed. You must install peer dependencies yourself.
npm WARN @tensorflow/[email protected] requires a peer of @tensorflow/[email protected] but none is installed. You must install peer dependencies yourself.
npm WARN @tensorflow/[email protected] requires a peer of @tensorflow/[email protected] but none is installed. You must install peer dependencies yourself.
After installing the peer dependencies @tensorflow/[email protected]
, I'm able to get rid of the error.
Hope my experience helps! Cheers
Upvotes: 1