Tf coco ssd don't work

Since yesterday I had a simple car detection based on coco ssd node (image)
This morning I update the node to the last version and now coco don't work.

I have this error ..

[error] [tensorflowCoco:9fa12ff99f8da570] Error: /home/utente/.node-red/node_modules/@tensorflow/tfjs-node/lib/napi-v8/tfjs_binding.node: wrong ELF class: ELFCLASS64

and and immediately after this error (I think due to the first)

(node:1539) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 flows:started listeners added to [EventEmitter]. 
Use emitter.setMaxListeners() to increase limit
(Use `node --trace-warnings ...` to show where the warning was created)

In image you can see that coco node don't load model.

coco

How can I fix this issue?

NR 2.2.2
Node js 14.19.3

Seems to be a common problem... the latest version uses a later tfjs engine so the binary needs also to be updated/reinstalled. You have two options - either completely uninstall the node so and then reinstall it - so the binary gets re-installed and rebuilt - or to drop back a level to the previous version.

Ok, thank you ...
Can you tell me how can back to the previous version?

manual install

cd ~/.node-red
npm i node-red-contrib-tfjs-coco-ssd@1.0.2

or whatever version you want/need
then restart node-red

Thank you ....

Did not work for me when I tried that option. Reverting back to 1.0.2 works fine but drawback could be if the newer tjfs engine brings some improvements

EDIT: RPi 4, Node-RED version 3.0.0 beta 2

I think the old one has some potential vulnerabilities .

The same for me.
I came back to the previous version (1.0.2) and now the node works fine ...

After installing 1.0.3 - can someone try

cd ~/.node-red
npm rebuild @tensorflow/tfjs-node --build-from-source

then restart node-red ( node-red-reload )
and report back... thanks

2 Likes

Hello, it did not help, see errors from log below. So now NR just keeps on restarting. But I see that the node at least tries to load the model, that did not happen before. Don't know if this helps

Best regards, Walter

2022-06-06 07:24:18.315788: W tensorflow/core/framework/cpu_allocator_impl.cc:80] Allocation of 1080000 exceeds 10% of free system memory.
2022-06-06 07:24:18.366906: W tensorflow/core/framework/cpu_allocator_impl.cc:80] Allocation of 1080000 exceeds 10% of free system memory.
6 Jun 07:24:18 - [red] Uncaught Exception:
6 Jun 07:24:18 - [error] TypeError: tf.engine(...).makeTensorFromTensorInfo is not a function
    at NodeJSKernelBackend.createOutputTensor (/home/pi/.node-red/node_modules/@tensorflow/tfjs-node/dist/nodejs_kernel_backend.js:153:28)
    at NodeJSKernelBackend.executeSingleOutput (/home/pi/.node-red/node_modules/@tensorflow/tfjs-node/dist/nodejs_kernel_backend.js:215:21)
    at Object.kernelFunc (/home/pi/.node-red/node_modules/@tensorflow/tfjs-node/dist/kernels/Cast.js:33:24)
    at kernelFunc (/home/pi/.node-red/node_modules/@tensorflow/tfjs-core/dist/tf-core.node.js:4541:32)
    at /home/pi/.node-red/node_modules/@tensorflow/tfjs-core/dist/tf-core.node.js:4602:27
    at Engine.scopedRun (/home/pi/.node-red/node_modules/@tensorflow/tfjs-core/dist/tf-core.node.js:4406:23)
    at Engine.runKernelFunc (/home/pi/.node-red/node_modules/@tensorflow/tfjs-core/dist/tf-core.node.js:4598:14)
    at Engine.runKernel (/home/pi/.node-red/node_modules/@tensorflow/tfjs-core/dist/tf-core.node.js:4470:21)
    at cast_ (/home/pi/.node-red/node_modules/@tensorflow/tfjs-converter/dist/tf-converter.node.js:12204:19)
    at cast__op (/home/pi/.node-red/node_modules/@tensorflow/tfjs-converter/dist/tf-converter.node.js:11577:29)
    at executeOp$1 (/home/pi/.node-red/node_modules/@tensorflow/tfjs-converter/dist/tf-converter.node.js:28129:21)
    at /home/pi/.node-red/node_modules/@tensorflow/tfjs-converter/dist/tf-converter.node.js:28236:65
    at /home/pi/.node-red/node_modules/@tensorflow/tfjs-core/dist/tf-core.node.js:4396:22
    at Engine.scopedRun (/home/pi/.node-red/node_modules/@tensorflow/tfjs-core/dist/tf-core.node.js:4406:23)
    at Engine.tidy (/home/pi/.node-red/node_modules/@tensorflow/tfjs-core/dist/tf-core.node.js:4395:21)
    at Object.tidy (/home/pi/.node-red/node_modules/@tensorflow/tfjs-core/dist/tf-core.node.js:10327:19)
    at /home/pi/.node-red/node_modules/@tensorflow/tfjs-converter/dist/tf-converter.node.js:28236:39
    at executeOp (/home/pi/.node-red/node_modules/@tensorflow/tfjs-converter/dist/tf-converter.node.js:28252:7)
    at _loop_1 (/home/pi/.node-red/node_modules/@tensorflow/tfjs-converter/dist/tf-converter.node.js:28978:31)
    at GraphExecutor.processStack (/home/pi/.node-red/node_modules/@tensorflow/tfjs-converter/dist/tf-converter.node.js:29004:13)
    at GraphExecutor.<anonymous> (/home/pi/.node-red/node_modules/@tensorflow/tfjs-converter/dist/tf-converter.node.js:28930:41)
    at step (/home/pi/.node-red/node_modules/@tensorflow/tfjs-converter/dist/tf-converter.node.js:147:27)
    at Object.next (/home/pi/.node-red/node_modules/@tensorflow/tfjs-converter/dist/tf-converter.node.js:96:53)
    at /home/pi/.node-red/node_modules/@tensorflow/tfjs-converter/dist/tf-converter.node.js:89:71
    at new Promise (<anonymous>)
    at __awaiter (/home/pi/.node-red/node_modules/@tensorflow/tfjs-converter/dist/tf-converter.node.js:75:12)
    at GraphExecutor.executeWithControlFlow (/home/pi/.node-red/node_modules/@tensorflow/tfjs-converter/dist/tf-converter.node.js:28899:16)
    at GraphExecutor.<anonymous> (/home/pi/.node-red/node_modules/@tensorflow/tfjs-converter/dist/tf-converter.node.js:28849:51)
nodered.service: Main process exited, code=exited, status=1/FAILURE
nodered.service: Failed with result 'exit-code'.

@krambriw - are you running 32bit or 64bit version of the OS ?
(sadly I don't have a Pi4 - but the rebuild fixes it for me on a 32bit Pi3... will try 64bit later)

Oh yes, that could be the reason, I'm running 64bit on this RPi4 (just tell me if I can help in testing)

Just tried installing 1.0.3 on RPi-4B (I assume I'm running a 32-bit OS) as it runs fine.

My Pi 4 with os Raspbian OS - 32bit ....

@Giamma - have you tried the rebuild as suggested above ?

Ehm, no .....
I wanted to try but when I read about the problems (@krambriw), I let it go.
My raspberry manages all my home automation, light, alarm, conditioning, irrigation system, if raspberry stopping, my wife may kill me ....

two suggestions, (1) get a another Pi for development (2) make a backup copy of your SD card.

Looks like it is an as yet unresolved issue with the underlying TFJS support for arm64 - [tjfs-node] Unsupported system: cpu-linux-arm64 in raspberry pi 4 · Issue #5937 · tensorflow/tfjs · GitHub
so stick to 32 bit on Pi for now :slight_smile:

1 Like

Yes, and I have to correct myself, I also had a problem on another RPi4 running 32 bit OS. In this case I suspected a conflict with another contribution, the "node-red-contrib-tensorflow", I had that installed as well. Once I uninstalled it, I could rebuild and now 1.0.3 works fine in my RPi4 (running 32 bit OS)

I tried and ........................
works fine !

Thank you .......