Trouble loading TensorFlow Node backend: 'nonMaxSuppressionV3Impl' undefined error

I’m having issues with face-api.js facial recognition. I want to speed it up using a Node backend for TensorFlow. I installed the necessary packages:

node -v
v14.1.0
npm list @tensorflow/tfjs-node
npm list @tensorflow/tfjs

The facial recognition works, but it’s slow without the backend. When I try to load it with:

require('@tensorflow/tfjs-node');

I get this error:

TypeError: Cannot read property 'nonMaxSuppressionV3Impl' of undefined

The error points to a file in the tfjs-backend-cpu folder. I’ve seen a similar issue mentioned recently, but there were no solutions. Has anyone encountered this problem or know how to fix it? I’d really appreciate any help or advice on getting the Node backend working properly. Thanks!

hey nova, i had this issue too. try updating ur node version to 16+. that fixed it for me. also, make sure ur using compatible versions of tensorflow packages. if that doesn’t work, try manually building tensorflow from source. it’s a pain but sometimes fixes weird errors like this. good luck!

hey there! have u tried clearing ur npm cache and reinstalling the packages? sometimes that helps with weird errors like this. also, wat about checking if ur using the latest version of face-api.js? they might have fixed this issue in a recent update. just curious, have u tried running it on a different machine to see if it’s a system-specific problem?

I’ve encountered a similar issue when working with TensorFlow in Node.js. One potential solution is to ensure you’re using compatible versions of TensorFlow packages. Try explicitly installing @tensorflow/tfjs-node-gpu instead of the CPU version. This resolved the ‘nonMaxSuppressionV3Impl’ error for me.

Another approach is to verify that your Node.js version is up-to-date. I found that upgrading to Node.js v16 or later eliminated compatibility issues with recent TensorFlow releases.

If these don’t work, you might need to manually build TensorFlow from source. This can be time-consuming but often resolves obscure dependency problems. Remember to clear your npm cache and node_modules folder before reinstalling packages after any changes.