dceejay / tfjs-coco-ssd

Node-RED node for tensorflowjs coco ssd
Apache License 2.0
14 stars 9 forks source link

Installing it using Docker Node-RED doesn't work #2

Closed bonastreyair closed 6 months ago

bonastreyair commented 4 years ago

I'm using Node-RED v1.0.4 on Docker on the latest MacBook Pro 13'' hardware in MacOS Catalina.

Whenever I put the node in any flow, an error appears like this:

Screenshot 2020-04-02 at 13 25 24

Error: Error loading shared library ld-linux-x86-64.so.2: No such file or directory (needed by /data/node_modules/@tensorflow/tfjs-node/lib/napi-v5/../../deps/lib/libtensorflow.so.1)

How can I handle this issue to make it work? It is like tensorflow.js has not been installed, right? Or is it because the Node-RED Docker Image is based on an unsupported Linux for tensorflow.js?

Thanks,

dceejay commented 4 years ago

Correct - the Alpine linux support has an issue open against it https://github.com/tensorflow/tfjs/issues/1425

bonastreyair commented 4 years ago

While we wait until tensorflow or Alpine Linux fixes this issue, I wanted to share with you the new node I created, inspired and learnt a lot from your repo, it would mean a lot to me if you could check it out.

It is functional but it lacks of good documentation I will keep posting updates to make it more clear in the README file.

I have another node of an additional node for standard pretrained Mobilenets Classification, I'm on testing now and it works great. If you want I could make a PR, I would just need to integrate the node in your package, so that this package would contain detection and classification nodes. What do you think?

Thanks! You inspired me!

dceejay commented 4 years ago

Hi - I also have this repo I did share (sort of) https://github.com/dceejay/tfjs-nodes which has nodes for predict and posenet. Is your other node like the predict one ? or another variant ? I decided to release them separately as things like the model in this are somewhat large for users who don't want to use it - so I thought keeping them separate may be a good idea.

So what does you new node do ? how does it fit in (sorry for asking dumb questions)

Also do you have any links to the teachable machine models etc (I presume you will add to the README at some point) :-)

dceejay commented 4 years ago

Aha - just install your teachable node - and found the link to https://teachablemachine.withgoogle.com/ - awesome stuff...

bonastreyair commented 4 years ago

Oh I see, you made a standard tf.model() to later do model.predict(). I made a new node using the specific implementation of tfjs-model/mobilenets, it is more similar to the coco ssd you made, where the model has its own model implementation made by tensorflow. My node just wanted to be used for this model pretrained.

My idea was just a node that drags and drops and gives you the basic mobilenets (just like ssd coco).

I was writing this down when you posted the link to teachable machine. Yeah! The thing is that you can train on the web browser your model, uploaded directly and use that URL and paste into the new node-red-contrib-teachable-machine node and you have the results all made in local without HTML.

dceejay commented 4 years ago

Hi

I'm fine with you doing a mobilenet version standalone if you wish ? If you copy the naming style they may look "joined up" :-) - even better if the msg.payload output etc was the same properties so people could just use one or the other interchangeably.

Re Thinking machine - yes - really neat - am on the right page now I found the link... of course now I need to sort out my pi camera and see if it can run the model I trained on the mac :-)

bonastreyair commented 4 years ago

Yeah maybe I could pack everything together within the tfjs-node repo, that's what you mean right?

I will make a PR and you can check it out.

jschaeke commented 3 years ago

Any update regarding this issue as https://github.com/tensorflow/tfjs/issues/1425 has been closed without solution?

dceejay commented 3 years ago

Our docker project does have an option for you to build custom build based on debian instead that may work as it uses the more standard libraries. But otherwise no - it's for tfjs to fix under alpine or not.

tve commented 3 years ago

UPDATE: whoops, this is not a docker issue. I just installed NR using npm and I see exactly the same problem. Virtually identical log. Only difference is that this install uses Node v14.17.0 'cause that's what my Ubuntu 20.04 has (I may have upgraded that). Update 2: I created a debian docker image using node v10 and that fails the same way, so it's not a recent node version issue...

I just tried using the debian docker image (built with node v12 and NR 1.3.5) and I get an Illegal Instruction (core dumped). STR:

1 Jul 02:52:20 - [info]

Welcome to Node-RED

1 Jul 02:52:20 - [info] Node-RED version: v1.3.5 1 Jul 02:52:20 - [info] Node.js version: v12.22.1 1 Jul 02:52:20 - [info] Linux 5.4.0-77-generic x64 LE 1 Jul 02:52:21 - [info] Loading palette nodes 1 Jul 02:52:21 - [info] Settings file : /data/settings.js 1 Jul 02:52:21 - [info] Context store : 'default' [module=memory] 1 Jul 02:52:21 - [info] User directory : /data 1 Jul 02:52:21 - [warn] Projects disabled : editorTheme.projects.enabled=false 1 Jul 02:52:21 - [info] Flows file : /data/flows.json 1 Jul 02:52:21 - [warn]


Your flow credentials file is encrypted using a system-generated key. [...]

1 Jul 02:52:21 - [info] Server now running at http://127.0.0.1:1880/ 1 Jul 02:52:21 - [info] Starting flows 1 Jul 02:52:21 - [info] Started flows 1 Jul 02:53:16 - [info] Installing module: node-red-contrib-tfjs-coco-ssd, version: 0.5.6 1 Jul 02:53:43 - [info] Installed module: node-red-contrib-tfjs-coco-ssd 1 Jul 02:53:43 - [info] Added node types: 1 Jul 02:53:43 - [info] - node-red-contrib-tfjs-coco-ssd:tensorflowCoco 1 Jul 02:54:01 - [info] Stopping flows 1 Jul 02:54:01 - [info] Stopped flows 1 Jul 02:54:01 - [info] Starting flows Illegal instruction (core dumped) npm ERR! code ELIFECYCLE npm ERR! errno 132 npm ERR! node-red-docker@1.3.5 start: node $NODE_OPTIONS node_modules/node-red/red.js $FLOWS "--userDir" "/data" npm ERR! Exit status 132



If someone has managed to run this puppy under docker I'd love to hear!
regystro commented 2 years ago

Our docker project does have an option for you to build custom build based on debian instead that may work as it uses the more standard libraries. But otherwise no - it's for tfjs to fix under alpine or not.

Sorry but where can we find that docker project? Thank you.

Edit: Nevermind, found it → https://github.com/node-red/node-red-docker/tree/master/docker-custom

twocolors commented 2 years ago

build docker based debian for support tensorflow

MeycemMariem commented 8 months ago

Exactly the "problem" is that the Tensorflow.js is dependent of the system library glibc, and the official node-red image uses the Alpine Linux distribution which uses the musl library which causes the error reported by the node. To be able to resolve this you have to create your own node-red container (do not use the official image).

The best way I have found to do so is to build it on top of a Node.js image (eventually using Debian) below you can find the Dockerfile. (Note that the Node .js version should be equal or greater than the version 14 as node-red requires so)

FROM node:14
# Set the timezone (replace with your timezone)
ENV TZ=Your/Timezone
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone

RUN npm install -g --unsafe-perm node-red
EXPOSE 1880
CMD ["node-red"]
bonastreyair commented 8 months ago

you can also use a debian version of node-red they offer official ones, no need to create your own :)