Neural network - Internal Node or Watson


Hi Walter,

No reason to convince you. I did last year some experiments with OpenCv.js, which is a Javascript transpiled version of OpenCv (C++). And it was indeed terrible slow.

But you can compile the Javascript to asm or even better to wasm, see a short explanation here. Summarized you create some kind of Javascript bytecode that will run much faster. Check out this nice demo you can see the enormous speed differences between - running OpenCv.js in - Javascript, asm en wasm!!

But I will not argument that C++ is much better in performance! It just a pain in the ass to get the application installed, and I think much of our users won't even survive the installation procedures and the errors during compilation phase ... Therefore it would be nice to have something in Node-RED that can be installed automatically as a dependency.

Based on your question I have been searching in the tfjs-node repository, but it seems to be that Tensorflow.js is a handwritten Javascript library (i.e. not compiled starting from their C++ version). So no asm or wasm!!

In the faq there is a section about performance:

In our experience, for inference, TensorFlow.js with WebGL is 1.5-2x slower than TensorFlow Python with AVX. For training, we have seen small models train faster in the browser and large models train up to 10-15x slower in the browser, compared to TensorFlow Python with AVX.


1 Like

Very interesting, thank you Bart!
Have a great weekend

1 Like

BTW, if somebody ever wants to experiment with Tensorflow.js (and hopefully share his experiences with us!), here is an article of somebody who has used it in NodeJs. And does anybody have a clue whether it could be accelerated e.g. with a Movidius USB stick? I assume that the webGL acceleration used by Google, is not available on NodeJs?


While not nodejs. PlaidML looks like another interesting diversion. Python based but claims to work accelerated across many cpu rather than gpu.


And now on an esp32