[Announce] node-red-contrib-facial-recognition

From the documentation:
If you change the value of this path you mush use a full path. Example: /home/myuser/name/TheFolderIPutAllTheLabledFaceFolderIn.

I'm making a change to that now so the entry no longer shows /example/labeled_face and will now show FullPathToLabeledFaces as your the second user with this issue.

as for image types. you can use *.png *.gif *.jpg *.bmp but the advanced example flow needs a jpg to work. also jpg are low in file size compared to others.

hope this helps

1 Like

using @zenofmud example flow for persistent storage as a base I've updated the documentation to a new version of the example for persistent storage.

updated all flows to use the new path of FullPathToLabeledFaces as the place holder value for KnownFacesPath

Also fixed README.md not loading all the way for some sites.

Click Me For FaceRecognition_Persistant_labeledFaceDescriptors example

no need to update to the new version of 0.28.102 as it does not update js code

Updated documentation to now use @BartButenaers node-red-contrib-msg-router.
Because nice documentation, not outdated and does not have a issue.

Now I don't know why Bart but as the first person to comment on this thread I would think that you would recommend the use of your msg-router as I searched for a msg balance and got the other one that did the job just not as well. Every one could have been using yours.

Well its fixed now in the example flow and image.

Click Me For Heavy_image_processing_or_mjpeg_video_stream example

no need to update to the new version of 0.28.103 as it does not update js code

@zenofmud

I've also documented the msg.settings with some comments you may find helpful when pre-loading the Descriptors.


//pre-loading the labeledFaceDescriptors

msg.settings = {
  FaceDetector :
  {
    SsdMobilenetv1 :
    {
      // set to 1 as we don't need to detect all the faces in the input
      maxResults : 1,
      // set the low when pre-loading the labeledFaceDescriptors
      // you dont want it to miss a face in your KnownFacesPath
      minConfidence : 0.4 
    }
  },
  Tasks :
  {
    // you sould only have one face from input image  
    detectSingleFace : 
    //detectAllFaces :
    {
      withFaceLandmarks : true,
      //withFaceExpressions : true, //dont need for pre-loading the labeledFaceDescriptors
      //withAgeAndGender : true,    //dont need for pre-loading the labeledFaceDescriptors
      withFaceDescriptors : true
    }
  },
  FaceRecognition :
  {
    enabled :
    {
      KnownFacesPath : "FullPathToLabeledFaces",
      //distanceThreshold : 0.6,
      //true - we want to load the labeledFaceDescriptors for all the images in your folders
      ReInitializeFaceMatcher : true //we want to load the labeledFaceDescriptors for all the images in your folders
    }
  }            
};

return msg;

Hi @meeki007,
Since I developed the msg-router node, a series of other similar nodes have been published. While my node supports a series of different routing mechanisms, the other nodes mostly support 1 routing mechanism. But that is a matter of taste I assume. I'm not the kind of person that is going to convince people that they should use my node instead :wink:

Apologies that I have followed the discussion meanwhile further. Saturday evening I had tried to install your node on Windows, but it failed. Afterwards you have shared your troubleshooting guide, but then my time was up... Will try again as soon as possible, and join this discussion again!
Bart

To me the whole point of open source is that someone could take this node of mine and make it better if they wanted. Or they could make something totally better not using this node. I'd not only use their node over mine id be happy to use something that may get the job done better. So ya is the other node better or worse......depends on the person and use case but I like to be made aware of other options. Don't be shy to shill your work. A simple hey have you tried my node? is enough :stuck_out_tongue:

Windows10

Quote I made "...when windows 2003 came out I went "NOPE" and have never looked back."

I would love for it to work in win10 but I have no clue how to use it. I have coworkers that see me fumble around on their win10 work station sometimes and they say out loud "YOUR THE COMPUTER AUTOMATION GUY and you can't use a computer!"

Docker - an option for windows 10 users

I did get this node working in Docker + node-red-docker but not their Alpine version. It is not libc6 compatible with tensorflow. To solve this I made my own docker amd64 using the directions from the node-red-docker custom official site https://github.com/node-red/node-red-docker/blob/master/docker-custom/README.md

If you wish to skip the steps in building it you can use my repository https://hub.docker.com/repository/docker/meeki/node-red-debian

SECURITY NOTE: I see people just willy nilly downloading dockers all over the place from all sorts of sources. You don't know me I don't have a community of checkers making sure I'm not bitcoin mining.

Before you download or do the below ask yourself if you really should trust the source. If you feel fine then great but do question before downloading any repository that is not official.

change the youruserdirhere or the whole directory to the empty one you make. this is where you persistant node-red-docker files will live.

docker run -it --restart always --log-opt max-size=5m --log-opt max-file=10 -v /home/youruserdirhere/docker/node-red:/data --name node-red -p 1881:1880 -d meeki/node-red-debian:1.2.6-10-amd64

you can now access it on http://youriphere:1881/

1 Like

I have just installed this node, and get the following error when I delpoy:
"Error: undefined - Unable to use @tensorflow/tfjs-node; CPU binding. See this node's documentation and Make sure that module @tensorflow/tfjs-node is properly working & installed under your Node-RED user directory, typically ~/.node-red"

I've looked under /node_modules and can see the following folders:
(@) tensorflow
(@) vladmandic

I didnt see anywhere in the docs to say how the module @tensorflow/tfjs-node should be installed.
Thought it would install as part of this package

What pltform are you using? Computer type, op system

1 Like

Check the event log when you install it.

I just tried to install facial recognition on a node-red version that has node 0.23.0

2020-12-19T14:56:38.152Z [err]  WARN notsup Unsupported engine for @vladmandic/face-api@0.9.4: wanted: {"node":">=12.0.0"} (current: {"node":"10.23.0","npm":"6.14.8"})

It still showed the install folders (@) tensorflow ,(@) vladmandic . This install that should have failed.

I need to add more checks for people. Can you show your install log for me so I can add checks for this kind of stuff.

Hi @meeki007,
That would indeed be very useful. I tried lots of things, but I didn't manage to get it up and running :slightly_frowning_face:
I have the same error as @sneakynuts on my Windows 10 portable.
Would be very nice if you could add some checks that give us a clue what we are doing wrong. Especially since lots of us are not familiar with this kind of stuff, it is very difficult to figure out what is going wrong.
Although I assume it won't be that easy for you to implement this, it would be a huge help!
Thanks again!!

I would love too put some more checks in.

I check for the tensorflow package. If it fails I have a err msg saying.
Error: undefined - Unable to use @tensorflow/tfjs-node; CPU binding. See this node's documentation and Make sure that module @tensorflow/tfjs-node is properly working & installed under your Node-RED user directory, typically ~/.node-red"

As I don't own a copy of windows, or have a want to learn windows its going to be up to this community to help figure out how to get @tensorflow/tfjs-node working properly.

I will have some new checks out Sunday night for:
node version too low
and if vladmandic package is working.

also stop the install if some dependency's are not met.

But again windows ........ I need help

1 Like

I'm running node red in docker on an unraid machine.

I will get you the logs shortly.

@sneakynuts I need to add a Docker to the documentation

from a post I made above......

Docker - an option for windows 10 users

I did get this node working in Docker + node-red-docker but not their Alpine version. It is not libc6 compatible with tensorflow. To solve this I made my own docker amd64 using the directions from the node-red-docker custom official site https://github.com/node-red/node-red-docker/blob/master/docker-custom/README.md

If you wish to skip the steps in building it you can use my repository https://hub.docker.com/repository/docker/meeki/node-red-debian

SECURITY NOTE: I see people just willy nilly downloading dockers all over the place from all sorts of sources. You don't know me I don't have a community of checkers making sure I'm not bitcoin mining.

Before you download or do the below ask yourself if you really should trust the source. If you feel fine then great but do question before downloading any repository that is not official.

change the youruserdirhere or the whole directory to the empty one you make. this is where you persistant node-red-docker files will live.

docker run -it --restart always --log-opt max-size=5m --log-opt max-file=10 -v /home/youruserdirhere/docker/node-red:/data --name node-red -p 1881:1880 -d meeki/node-red-debian:1.2.6-10-amd64

you can now access it on http://youriphere:1881/

Hi @meeki007,
To avoid having to start with Docker containers, I have installed your node on one of my Raspberry Pi 3 devices (running Raspian Buster 10). Installation seems ok:

image

P.S. this is the only command I have run. So I have added nothing else (python ...).

But here the same error:

20 Dec 07:45:30 - [warn] [facial-recognition:8f0bc1e9.ecb65] Error: undefined - Unable to use @tensorflow/tfjs-node; CPU binding. See this node's documentation and Make sure that module @tensorflow/tfjs-node is properly working & installed under your Node-RED user directory, typically ~/.node-red
20 Dec 07:45:30 - [error] [facial-recognition:8f0bc1e9.ecb65] TypeError: Cannot read property 'tf' of undefined

This is what is available:

image

By looking at the last modified dates of the folders, I can see that the "@ vladmandic" folder has been installed automatically now by installing your node. However the "@ tensoflow" folder was already there, since I have installed the "node-red-contrib-tfjs-coco-ssd" node in the past. Don't know if that has anything to do with it, due to conflicting versions or so...

Is there anything else I can check?

The python version on my Raspberry seems ok:

pi@raspberrypi:~/.node-red $ python --version
Python 2.7.16

P.S. The python version is perhaps something you could automatically check in your node, e.g. when we inject a message with topic "check_installation"??

Thank you for the install log .... this helps

what is your node version? in linux I just type node -v

looks like your missing the TensorFlow.js Core API

You can try installing the version its asking for.
Run the following command in your Node-RED user directory - typically ~/.node-red :

npm install @tensorflow/tfjs-core@2.7.0

Its hard to figure this stuff out when it installs just all happy for me. Would love to get your install to look more like this :stuck_out_tongue:

1 Like

New version 0.29.104 released.
No need to update if you already have a working install.
However now tested and working with @tensorflow/tfjs-node 2.8.1 an update will install this version

This is a release for those having issues with the install.

Added checks for module install of @vladmandic/face-api

Added dependecy check for node version 12.x or greater to the package.json and a .npmrc file to enforce it.

Updated documentation - added docker section and a requirements section

See changes to JS file here ---> https://github.com/meeki007/node-red-contrib-facial-recognition/pull/17/files


Thank for working with me on this. and giving me all of Saturday off from code :stuck_out_tongue: I woke up this Sunday morning and knocked out the changes.

1 Like

I'm apprehensive of writing checks in my node for other node dependency / req.
I now check on both my dependencys

// check if module @vladmandic/face-api/dist/face-api.node.js is installed and working;
  let vladmandic_faceapi_node_module_check = module_check('@vladmandic/face-api/dist/face-api.node.js');
  // check if module @vladmandic/face-api/dist/face-api.node-gpu.js is installed and working;
  let vladmandic_faceapi_node_gpu_module_check = module_check('@vladmandic/face-api/dist/face-api.node-gpu.js');
  // check if module @tensorflow/tfjs-node [GPU] is installed and working;
  let tfjs_node_gpu_module_check = module_check('@tensorflow/tfjs-node-gpu');
  // check if module @tensorflow/tfjs-node [CPU] is installed and working;
  let tfjs_node_cpu_module_check = module_check('@tensorflow/tfjs-node');

if they are installed and fail loading somehow they will spit back an error I can use and pass on to the user. If they don't load or fail to send back an error then its undefined value.

undefined tells me we need a install log and I can try my best to work with user here. I'm sure you all have noticed the longest you will have to wait for me is 48hrs to get back to you. I can't just go writing checks for every possible issue a user may find themselves in. It would take up more space than the core code.

You are the first one in this community that offers a free SLA of maximum 48 hours :rofl:
Hopefully people don't expect the same from me ...

Thanks!!!
I have installed your new version and here are the results:

  • On Windows 10 it seems to be working now! I only get this in my Node-RED startup log:

    Welcome to Node-RED
    ===================
    20 Dec 20:32:17 - [info] Node-RED version: v1.2.1
    20 Dec 20:32:17 - [info] Node.js  version: v12.19.0
    20 Dec 20:32:17 - [info] Windows_NT 10.0.19041 x64 LE
    20 Dec 20:32:18 - [info] Loading palette nodes
    2020-12-20 20:32:19.664922: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2
    20 Dec 20:32:19 - [info] Dashboard version 2.23.4 started at /ui
    20 Dec 20:32:19 - [info] Settings file  : C:\Users\Gebruiker\.node-red\settings.js
    

    Don't know whether that will be a problem ...

  • On my Raspberry:

    • After installing your new version, I still had the same error.
    • Then I have uninstalled your node and reinstalled it again, but still the same error.
    • Since I had already installed tensorflow in the past (as a dependency of the coco-ssd node), I thought it might perhaps help somehow to execute this command:
      pi@raspberrypi:~/.node-red $ npm install @tensorflow/tfjs-node
    • When starting Node-RED afterwards, I got a large series of this kind of log lines:
      node-pre-gyp info This Node instance does not support builds for N-API version 6
      node-pre-gyp info This Node instance does not support builds for N-API version 7
      node-pre-gyp info This Node instance does not support builds for N-API version 6
      node-pre-gyp info This Node instance does not support builds for N-API version 7
      Platform node has already been set. Overwriting the platform with [object Object].
      The kernel 'FFT' for backend 'tensorflow' is already registered
      The kernel 'IFFT' for backend 'tensorflow' is already registered
      The kernel 'LRN' for backend 'tensorflow' is already registered
      The kernel 'LRNGrad' for backend 'tensorflow' is already registered
      The kernel '_FusedMatMul' for backend 'tensorflow' is already registered
      
      P.S. the above list of errors is displayed every time that Node-RED is started.
    • But it seems to be working now!

I assume the issues on the RPI are caused by tensorlfow already installed in advance (for the coco-ssd) nodes ...

I see those same msgs on my Mac but NOT on my Pi 3

This will be my issue then, i'm running the official node red docker which is alpine based..