[{"id":"72d32586.864794","type":"tab","label":"persistant - face","disabled":false,"info":""},{"id":"49fd059e.1e61cc","type":"group","z":"72d32586.864794","style":{"stroke":"#999999","stroke-opacity":"1","fill":"none","fill-opacity":"1","label":true,"label-position":"nw","color":"#a4a4a4"},"nodes":["c8f33c6.fb6b3c","672ce3fb.230584","c742df3d.206a38","65cddeac.5285c","39980b5f.127474","12c94117.04ab5f","895c6c45.a6b2b8","75e63aa2.265574","1f368629.a2ac2a","d7c90709.6b3888","5324e72e.762bd","8ddcb9d7.d3289","e2a44271.51679","37562487.154a04","6ff5a8d4.4c58e","5c7dd093.e02ca8","b570165b.57e0d","43bcda26.b4cd84","c30366e0.0cb7e8","517596f5.999cc","44794a6e.efa4ec"],"x":54,"y":539,"w":932,"h":522},{"id":"6a305780.d3a53","type":"group","z":"72d32586.864794","style":{"stroke":"#999999","stroke-opacity":"1","fill":"none","fill-opacity":"1","label":true,"label-position":"nw","color":"#a4a4a4"},"nodes":["ec613413.569f8","1fca72af.fd7b1d","2aa2bda0.77afba","62cfa844.6fe8f","93e4dfd5.3d8af8","5214b307.87e02c","8652bebd.30013","aff4a6ba.6a416","c7940a40.e3d1f8","9349c1d8.52703","be8f9a2d.1d6138","458c540.1758c2c","7bcb334d.9938c4","2d1e4af0.c11f3e","e7877fc7.79ec7","4ee9f798.6ff47","afba1008.9a28b8"],"x":54,"y":59,"w":1052,"h":462},{"id":"ec613413.569f8","type":"comment","z":"72d32586.864794","g":"6a305780.d3a53","name":"in case of errors ","info":"","x":200,"y":440,"wires":[]},{"id":"1fca72af.fd7b1d","type":"catch","z":"72d32586.864794","g":"6a305780.d3a53","name":"","scope":null,"uncaught":false,"x":180,"y":480,"wires":[["2aa2bda0.77afba"]]},{"id":"2aa2bda0.77afba","type":"debug","z":"72d32586.864794","g":"6a305780.d3a53","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":330,"y":480,"wires":[]},{"id":"62cfa844.6fe8f","type":"file in","z":"72d32586.864794","g":"6a305780.d3a53","name":"Get the image file","filename":"","format":"","chunk":false,"sendError":false,"encoding":"none","x":210,"y":380,"wires":[["93e4dfd5.3d8af8"]]},{"id":"93e4dfd5.3d8af8","type":"facial-recognition","z":"72d32586.864794","g":"6a305780.d3a53","image":"payload","settings":"settings","name":"","bindings":"CPU","FaceDetector":"SsdMobilenetv1","FaceDetector_SsdMobilenetv1_maxResults":"4","FaceDetector_SsdMobilenetv1_minConfidence":"0.4","FaceDetector_tinyFaceDetector_inputSize":"416","FaceDetector_tinyFaceDetector_scoreThreshold":".4","Tasks":"detectSingleFace","FaceLandmarks":true,"FaceExpressions":true,"AgeAndGender":true,"FaceDescriptors":true,"Face_Recognition":"Face_Recognition_enabled","Face_Recognition_enabled_path":"FullPathToLabeledFaces","Face_Recognition_distanceThreshold":"0.7","x":410,"y":380,"wires":[["8652bebd.30013","aff4a6ba.6a416","9349c1d8.52703"]]},{"id":"5214b307.87e02c","type":"comment","z":"72d32586.864794","g":"6a305780.d3a53","name":"This is where the image is processed","info":"","x":260,"y":340,"wires":[]},{"id":"8652bebd.30013","type":"debug","z":"72d32586.864794","g":"6a305780.d3a53","name":"Full results of the processing","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":660,"y":440,"wires":[]},{"id":"aff4a6ba.6a416","type":"change","z":"72d32586.864794","g":"6a305780.d3a53","name":"copy msg.payload.labeledFaceDescriptors to context","rules":[{"t":"set","p":"labeledFaceDescriptors","pt":"flow","to":"payload.labeledFaceDescriptors","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":740,"y":480,"wires":[["c7940a40.e3d1f8"]]},{"id":"c7940a40.e3d1f8","type":"debug","z":"72d32586.864794","g":"6a305780.d3a53","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":1010,"y":480,"wires":[]},{"id":"9349c1d8.52703","type":"debug","z":"72d32586.864794","g":"6a305780.d3a53","name":"Matched name","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload.Result[0].match._label","targetType":"msg","statusVal":"","statusType":"auto","x":620,"y":380,"wires":[]},{"id":"be8f9a2d.1d6138","type":"inject","z":"72d32586.864794","g":"6a305780.d3a53","name":"img you send.jpg","props":[{"p":"filename","v":".node-red/node_modules/node-red-contrib-facial-recognition/example/unknown_face/sample (4).jpg","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":200,"y":280,"wires":[["458c540.1758c2c"]]},{"id":"458c540.1758c2c","type":"function","z":"72d32586.864794","g":"6a305780.d3a53","name":"msg.settings","func":"\n//loading the labeledFaceDescriptors from flow context\nvar labeledFaceDescriptors = flow.get(\"labeledFaceDescriptors\");\nmsg.settings = {\n //FaceDetector :\n //{\n // SsdMobilenetv1 :\n // {\n // maxResults : 4,\n // minConfidence : 0.6\n // }\n //},\n //Tasks :\n //{\n // detectAllFaces :\n // {\n // withFaceLandmarks : true,\n // withFaceExpressions : true,\n // withAgeAndGender : true,\n // withFaceDescriptors : true\n // }\n //},\n FaceRecognition :\n {\n enabled :\n {\n //KnownFacesPath : \"/example/labeled_face\",\n //distanceThreshold : 0.6,\n ReInitializeFaceMatcher : false,\n labeledFaceDescriptors : labeledFaceDescriptors\n }\n } \n};\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":370,"y":280,"wires":[["62cfa844.6fe8f"]]},{"id":"7bcb334d.9938c4","type":"comment","z":"72d32586.864794","g":"6a305780.d3a53","name":"This is where we pre-load the labeledFaceDescriptors","info":"","x":320,"y":140,"wires":[]},{"id":"2d1e4af0.c11f3e","type":"inject","z":"72d32586.864794","g":"6a305780.d3a53","name":"placeholder.jpg","props":[{"p":"filename","v":".node-red/node_modules/node-red-contrib-facial-recognition/example/unknown_face/sample (1).jpg","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":200,"y":180,"wires":[["e7877fc7.79ec7"]]},{"id":"e7877fc7.79ec7","type":"function","z":"72d32586.864794","g":"6a305780.d3a53","name":"msg.settings","func":"\n//pre-loading the labeledFaceDescriptors\n\nmsg.settings = {\n FaceDetector :\n {\n SsdMobilenetv1 :\n {\n // set to 1 as we don't need to detect all the faces in the input\n maxResults : 1,\n // set the low when pre-loading the labeledFaceDescriptors\n // you dont want it to miss a face in your KnownFacesPath\n minConfidence : 0.4 \n }\n },\n Tasks :\n {\n // you sould only have one face from input image \n detectSingleFace : \n //detectAllFaces :\n {\n withFaceLandmarks : true,\n //withFaceExpressions : true, //dont need for pre-loading the labeledFaceDescriptors\n //withAgeAndGender : true, //dont need for pre-loading the labeledFaceDescriptors\n withFaceDescriptors : true\n }\n },\n FaceRecognition :\n {\n enabled :\n {\n KnownFacesPath : \"FullPathToLabeledFaces\",\n //distanceThreshold : 0.6,\n //true - we want to load the labeledFaceDescriptors for all the images in your folders\n ReInitializeFaceMatcher : true //we want to load the labeledFaceDescriptors for all the images in your folders\n }\n } \n};\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":370,"y":180,"wires":[["62cfa844.6fe8f"]]},{"id":"4ee9f798.6ff47","type":"comment","z":"72d32586.864794","g":"6a305780.d3a53","name":"The flow context method","info":"","x":190,"y":100,"wires":[]},{"id":"afba1008.9a28b8","type":"comment","z":"72d32586.864794","g":"6a305780.d3a53","name":"This is where we match a face we send to the pre-labeledFaceDescriptors","info":"","x":380,"y":240,"wires":[]},{"id":"c8f33c6.fb6b3c","type":"comment","z":"72d32586.864794","g":"49fd059e.1e61cc","name":"in case of errors ","info":"","x":200,"y":920,"wires":[]},{"id":"672ce3fb.230584","type":"catch","z":"72d32586.864794","g":"49fd059e.1e61cc","name":"","scope":null,"uncaught":false,"x":180,"y":960,"wires":[["c742df3d.206a38"]]},{"id":"c742df3d.206a38","type":"debug","z":"72d32586.864794","g":"49fd059e.1e61cc","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":330,"y":960,"wires":[]},{"id":"65cddeac.5285c","type":"file in","z":"72d32586.864794","g":"49fd059e.1e61cc","name":"Get the image file","filename":"","format":"","chunk":false,"sendError":false,"encoding":"none","x":210,"y":860,"wires":[["39980b5f.127474"]]},{"id":"39980b5f.127474","type":"facial-recognition","z":"72d32586.864794","g":"49fd059e.1e61cc","image":"payload","settings":"settings","name":"","bindings":"CPU","FaceDetector":"SsdMobilenetv1","FaceDetector_SsdMobilenetv1_maxResults":"4","FaceDetector_SsdMobilenetv1_minConfidence":"0.4","FaceDetector_tinyFaceDetector_inputSize":"416","FaceDetector_tinyFaceDetector_scoreThreshold":".4","Tasks":"detectAllFaces","FaceLandmarks":true,"FaceExpressions":true,"AgeAndGender":true,"FaceDescriptors":true,"Face_Recognition":"Face_Recognition_enabled","Face_Recognition_enabled_path":"FullPathToLabeledFaces","Face_Recognition_distanceThreshold":"0.7","x":410,"y":860,"wires":[["895c6c45.a6b2b8","1f368629.a2ac2a","c30366e0.0cb7e8"]]},{"id":"12c94117.04ab5f","type":"comment","z":"72d32586.864794","g":"49fd059e.1e61cc","name":"This is where the image is processed","info":"","x":260,"y":820,"wires":[]},{"id":"895c6c45.a6b2b8","type":"debug","z":"72d32586.864794","g":"49fd059e.1e61cc","name":"Full results of the processing","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":660,"y":900,"wires":[]},{"id":"75e63aa2.265574","type":"debug","z":"72d32586.864794","g":"49fd059e.1e61cc","name":"","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":890,"y":1020,"wires":[]},{"id":"1f368629.a2ac2a","type":"debug","z":"72d32586.864794","g":"49fd059e.1e61cc","name":"Matched name","active":false,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload.Result[0].match._label","targetType":"msg","statusVal":"","statusType":"auto","x":620,"y":860,"wires":[]},{"id":"d7c90709.6b3888","type":"inject","z":"72d32586.864794","g":"49fd059e.1e61cc","name":"img you send.jpg","props":[{"p":"the_filename","v":".node-red/node_modules/node-red-contrib-facial-recognition/example/unknown_face/sample (3).jpg","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":200,"y":760,"wires":[["b570165b.57e0d"]]},{"id":"5324e72e.762bd","type":"function","z":"72d32586.864794","g":"49fd059e.1e61cc","name":"msg.settings","func":"\n//loading the labeledFaceDescriptors from flow context\nflow.set(\"save_to_file\", false);\n\nvar labeledFaceDescriptors = msg.payload;\nmsg.settings = {\n //FaceDetector :\n //{\n // SsdMobilenetv1 :\n // {\n // maxResults : 4,\n // minConfidence : 0.6\n // }\n //},\n //Tasks :\n //{\n // detectAllFaces :\n // {\n // withFaceLandmarks : true,\n // withFaceExpressions : true,\n // withAgeAndGender : true,\n // withFaceDescriptors : true\n // }\n //},\n FaceRecognition :\n {\n enabled :\n {\n //KnownFacesPath : \"/example/labeled_face\",\n //distanceThreshold : 0.6,\n ReInitializeFaceMatcher : false,\n labeledFaceDescriptors : labeledFaceDescriptors\n }\n } \n};\n\n//moving message\nmsg.filename = msg.the_filename;\ndelete msg.the_filename;\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":770,"y":760,"wires":[["65cddeac.5285c"]]},{"id":"8ddcb9d7.d3289","type":"comment","z":"72d32586.864794","g":"49fd059e.1e61cc","name":"This is where we pre-load the labeledFaceDescriptors","info":"","x":320,"y":620,"wires":[]},{"id":"e2a44271.51679","type":"inject","z":"72d32586.864794","g":"49fd059e.1e61cc","name":"placeholder.jpg","props":[{"p":"filename","v":".node-red/node_modules/node-red-contrib-facial-recognition/example/unknown_face/sample (1).jpg","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payloadType":"str","x":200,"y":660,"wires":[["5c7dd093.e02ca8"]]},{"id":"37562487.154a04","type":"comment","z":"72d32586.864794","g":"49fd059e.1e61cc","name":"This is where we match a face we send to the pre-labeledFaceDescriptors","info":"","x":380,"y":720,"wires":[]},{"id":"4305077a.092e78","type":"inject","z":"72d32586.864794","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":200,"y":2180,"wires":[["98fe930b.e36358"]]},{"id":"98fe930b.e36358","type":"file in","z":"72d32586.864794","name":"","filename":".node-red/node_modules/node-red-contrib-facial-recognition/example/unknown_face/sample (1).jpg","format":"","chunk":false,"sendError":false,"encoding":"none","x":480,"y":2220,"wires":[["7d37804.146cc"]]},{"id":"7d37804.146cc","type":"facial-recognition","z":"72d32586.864794","image":"payload","settings":"settings","name":"","bindings":"CPU","FaceDetector":"SsdMobilenetv1","FaceDetector_SsdMobilenetv1_maxResults":"4","FaceDetector_SsdMobilenetv1_minConfidence":"0.4","FaceDetector_tinyFaceDetector_inputSize":"416","FaceDetector_tinyFaceDetector_scoreThreshold":".4","Tasks":"detectAllFaces","FaceLandmarks":true,"FaceExpressions":true,"AgeAndGender":true,"FaceDescriptors":true,"Face_Recognition":"Face_Recognition_enabled","Face_Recognition_enabled_path":"/example/labeled_face","Face_Recognition_distanceThreshold":"0.7","x":590,"y":2260,"wires":[["f78a79f3.4ddfb8","9e97101d.554e38"]]},{"id":"ea8d7a04.3c2dd","type":"comment","z":"72d32586.864794","name":"Run me first to get the labeledFaceDescriptors you want to persist","info":"","x":530,"y":2180,"wires":[]},{"id":"e2ebd399.b8fdc8","type":"comment","z":"72d32586.864794","name":"Note: Setting to the FaceDetector affect the values of the labeledFaceDescriptors","info":"","x":420,"y":2140,"wires":[]},{"id":"f78a79f3.4ddfb8","type":"debug","z":"72d32586.864794","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":770,"y":2260,"wires":[]},{"id":"58776493.4f78ac","type":"inject","z":"72d32586.864794","name":"","props":[{"p":"payload"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":200,"y":2340,"wires":[["58008df2.beb85c"]]},{"id":"58008df2.beb85c","type":"file in","z":"72d32586.864794","name":"","filename":"facial-recognition-persist.JSON","format":"utf8","chunk":false,"sendError":false,"encoding":"none","x":270,"y":2300,"wires":[["a3fe7823.4917a8"]]},{"id":"c6bb7b44.95b31","type":"comment","z":"72d32586.864794","name":"Run me second ","info":"","x":380,"y":2340,"wires":[]},{"id":"63ad836.a52057c","type":"file","z":"72d32586.864794","name":"","filename":"facial-recognition-persist.JSON","appendNewline":false,"createDir":false,"overwriteFile":"true","encoding":"none","x":790,"y":2380,"wires":[[]]},{"id":"9e97101d.554e38","type":"change","z":"72d32586.864794","name":"set msg.payload to msg.payload.labeledFaceDescriptors","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.labeledFaceDescriptors","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":710,"y":2320,"wires":[["dbfa533.f2e9ab"]]},{"id":"bd8a72ca.e37108","type":"function","z":"72d32586.864794","name":"msg.settings","func":"var labeledFaceDescriptors = msg.payload;\nmsg.settings = {\n //FaceDetector :\n //{\n // SsdMobilenetv1 :\n // {\n // maxResults : 4,\n // minConfidence : 0.6\n // }\n //},\n //Tasks :\n //{\n // detectAllFaces :\n // {\n // withFaceLandmarks : true,\n // withFaceExpressions : true,\n // withAgeAndGender : true,\n // withFaceDescriptors : true\n // }\n //},\n FaceRecognition :\n {\n enabled :\n {\n //KnownFacesPath : \"/example/labeled_face\",\n //distanceThreshold : 0.6,\n ReInitializeFaceMatcher : false,\n labeledFaceDescriptors : labeledFaceDescriptors\n }\n } \n};\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":330,"y":2260,"wires":[["98fe930b.e36358"]]},{"id":"dbfa533.f2e9ab","type":"json","z":"72d32586.864794","name":"","property":"payload","action":"","pretty":false,"x":550,"y":2380,"wires":[["63ad836.a52057c"]]},{"id":"a3fe7823.4917a8","type":"json","z":"72d32586.864794","name":"","property":"payload","action":"","pretty":false,"x":190,"y":2260,"wires":[["bd8a72ca.e37108"]]},{"id":"6ff5a8d4.4c58e","type":"comment","z":"72d32586.864794","g":"49fd059e.1e61cc","name":"The file method","info":"","x":160,"y":580,"wires":[]},{"id":"9a80677a.35023","type":"comment","z":"72d32586.864794","name":"to skip loading of labeledFaceDescriptors","info":"","x":300,"y":2380,"wires":[]},{"id":"5c7dd093.e02ca8","type":"function","z":"72d32586.864794","g":"49fd059e.1e61cc","name":"msg.settings","func":"\n//pre-loading the labeledFaceDescriptors\nflow.set(\"save_to_file\", true);\n\nmsg.settings = {\n FaceDetector :\n {\n SsdMobilenetv1 :\n {\n // set to 1 as we don't need to detect all the faces in the input\n maxResults : 1,\n // set the low when pre-loading the labeledFaceDescriptors\n // you dont want it to miss a face in your KnownFacesPath\n minConfidence : 0.4 \n }\n },\n Tasks :\n {\n // you sould only have one face from input image \n detectSingleFace : \n {\n withFaceLandmarks : true,\n //withFaceExpressions : true, //dont need for pre-loading the labeledFaceDescriptors\n //withAgeAndGender : true, //dont need for pre-loading the labeledFaceDescriptors\n withFaceDescriptors : true\n }\n },\n FaceRecognition :\n {\n enabled :\n {\n KnownFacesPath : \"FullPathToLabeledFaces\",\n //distanceThreshold : 0.6,\n //true - we want to load the labeledFaceDescriptors for all the images in your folders\n ReInitializeFaceMatcher : true //we want to load the labeledFaceDescriptors for all the images in your folders\n }\n } \n};\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","x":370,"y":660,"wires":[["65cddeac.5285c"]]},{"id":"b570165b.57e0d","type":"file in","z":"72d32586.864794","g":"49fd059e.1e61cc","name":"","filename":"facial-recognition-persist.JSON","format":"utf8","chunk":false,"sendError":false,"encoding":"none","x":430,"y":760,"wires":[["43bcda26.b4cd84"]]},{"id":"43bcda26.b4cd84","type":"json","z":"72d32586.864794","g":"49fd059e.1e61cc","name":"","property":"payload","action":"","pretty":false,"x":630,"y":760,"wires":[["5324e72e.762bd"]]},{"id":"c30366e0.0cb7e8","type":"switch","z":"72d32586.864794","g":"49fd059e.1e61cc","name":"if flow.save_to_file = true","property":"save_to_file","propertyType":"flow","rules":[{"t":"true"}],"checkall":"true","repair":false,"outputs":1,"x":650,"y":940,"wires":[["517596f5.999cc"]]},{"id":"517596f5.999cc","type":"change","z":"72d32586.864794","g":"49fd059e.1e61cc","name":"set msg.payload to msg.payload.labeledFaceDescriptors","rules":[{"t":"set","p":"payload","pt":"msg","to":"payload.labeledFaceDescriptors","tot":"msg"}],"action":"","property":"","from":"","to":"","reg":false,"x":750,"y":980,"wires":[["44794a6e.efa4ec"]]},{"id":"44794a6e.efa4ec","type":"file","z":"72d32586.864794","g":"49fd059e.1e61cc","name":"","filename":"facial-recognition-persist.JSON","appendNewline":false,"createDir":false,"overwriteFile":"true","encoding":"none","x":670,"y":1020,"wires":[["75e63aa2.265574"]]}]