# Neural network - Internal Node or Watson

**URL:** <https://discourse.nodered.org/t/neural-network-internal-node-or-watson/3949>\
**Category:** General\
**Created:** [13 October 2018 03:50 UTC](https://discourse.nodered.org/t/neural-network-internal-node-or-watson/3949 "2018-10-13T03:50:37Z")\
**Posts on this page:** 5\
**Page:** 2

<div class="post-metadata">

**Author:** ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)\
**Post date:** [27 October 2018 07:00 UTC](https://discourse.nodered.org/t/neural-network-internal-node-or-watson/3949/21 "2018-10-27T07:00:30Z")

</div>

Hi Walter,

> [@krambriw](#):
>
> Until I'm convinced having wrong.....

No reason to convince you. I did last year some [experiments](https://groups.google.com/d/msg/node-red/GQeDS-CuK00/hvEXDn9BBwAJ) 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](https://www.scriptol.com/programming/wasm.php) here. Summarized you create some kind of Javascript bytecode that will run much faster. Check out this [nice demo](https://hacks.mozilla.org/2017/09/bootcamps-webassembly-and-computer-vision/) 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](https://github.com/tensorflow/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](https://js.tensorflow.org/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.

Bart

---

<div class="post-metadata">

**Author:** ![krambriw](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/krambriw/32/5429_2.png) [@krambriw](https://discourse.nodered.org/u/krambriw)\
**Post date:** [27 October 2018 08:52 UTC](https://discourse.nodered.org/t/neural-network-internal-node-or-watson/3949/22 "2018-10-27T08:52:56Z")

</div>

Very interesting, thank you Bart!  
Have a great weekend

---

<div class="post-metadata">

**Author:** ![BartButenaers](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bartbutenaers/32/10476_2.png) [@BartButenaers](https://discourse.nodered.org/u/BartButenaers)\
**Post date:** [27 October 2018 09:59 UTC](https://discourse.nodered.org/t/neural-network-internal-node-or-watson/3949/23 "2018-10-27T09:59:44Z")

</div>

BTW, if somebody ever wants to experiment with Tensorflow.js (and hopefully share his experiences with us!), here is an [article](http://jamesthom.as/blog/2018/08/07/machine-learning-in-node-dot-js-with-tensorflow-dot-js/) 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?

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [27 October 2018 15:50 UTC](https://discourse.nodered.org/t/neural-network-internal-node-or-watson/3949/24 "2018-10-27T15:50:49Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dceejay](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/dceejay/32/38_2.png) [@dceejay](https://discourse.nodered.org/u/dceejay)\
**Post date:** [28 October 2018 07:54 UTC](https://discourse.nodered.org/t/neural-network-internal-node-or-watson/3949/25 "2018-10-28T07:54:29Z")

</div>

And now on an esp32 [https://github.com/espressif/esp-who](https://github.com/espressif/esp-who)

[Previous page](https://discourse.nodered.org/t/neural-network-internal-node-or-watson/3949.md?page=1)
