Slow in nodejs project
See original GitHub issueHello!
I am trying to setup simple face detection in nodejs env. Out of the box everything run fine with the exception of speed. It takes 12+ seconds for a single face detection.
require('@tensorflow/tfjs-node')
is included!
On execution i see:
cpu backend was already registered. Reusing existing backend
then
Hi there 👋. Looks like you are running TensorFlow.js in Node.js. To speed things up dramatically, install our node backend, which binds to TensorFlow C++, by running npm i @tensorflow/tfjs-node, or npm i @tensorflow/tfjs-node-gpu if you have CUDA. Then call require(‘@tensorflow/tfjs-node’); (-gpu suffix for CUDA) at the start of your program. Visit https://github.com/tensorflow/tfjs-node for more details.
When i install older versions of the two packages:
npm install @tensorflow/tfjs-node@0.3.0 face-api.js@0.14.3
there is significant speed improvement, BUT i need age and gender detection , which is not present below face-api.js < 0.20.0
I also tryed: @tensorflow/tfjs-node version 1.0.2
but then i get:
(node:29723) UnhandledPromiseRejectionWarning: TypeError: tfc.ENV.findBackend is not a function at nodeBackend (/home/pi/testproject/node_modules/@tensorflow/tfjs- node/dist/ops/op_utils.js:25:28)
How can i use age and gender recognition and get faster speed under nodejs?
Environment Raspberry Pi Node: v8.10.0 face-api.js: 0.20.0 / 0.14.3 @tensorflow/tfjs-node: 1.1.2 / 1.0.2 / 0.3.0
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:8 (2 by maintainers)
Top GitHub Comments
@tensorflow/tfjs-node 1.0.2 + @tensorflow/tfjs-core 1.0.3 should work with face-api.js 0.20.0. This is the setup that the nodejs examples use. The error message you posted might indicate, that you are not using tfjs-core 1.0.3.
Same issue here. Impossible to include @tensorflow. It installs without errors. Tried many versions. Still not able to include.