Facial Recognition - customize your mirror for every user!



  • Hello, have some Proplem with this Modul:

    0|mm  | > magicmirror@2.5.0 start /home/pi/MagicMirror
    0|mm  | > sh run-start.sh
    
    0|mm  | Starting MagicMirror: v2.5.0
    0|mm  | Loading config ...
    0|mm  | Loading module helpers ...
    0|mm  | No helper found for module: alert.
    0|mm  | Initializing new module helper ...
    0|mm  | Module helper loaded: updatenotification
    0|mm  | No helper found for module: clock.
    0|mm  | Initializing new module helper ...
    0|mm  | Module helper loaded: MMM-Facial-Recognition
    0|mm  | Initializing new module helper ...
    0|mm  | Module helper loaded: calendar
    0|mm  | Initializing new module helper ...
    0|mm  | Module helper loaded: MMM-EARTH
    0|mm  | No helper found for module: currentweather.
    0|mm  | No helper found for module: weatherforecast.
    0|mm  | Initializing new module helper ...
    0|mm  | Check MagicMirror version for node helper 'MMM-LocalTemperature' - Minimum version:  2.2.1 - Current version: 2.5.0
    0|mm  | Version is ok!
    0|mm  | Module helper loaded: MMM-LocalTemperature
    0|mm  | Initializing new module helper ...
    0|mm  | Module helper loaded: mmm-systemtemperature
    0|mm  | Initializing new module helper ...
    0|mm  | Module helper loaded: newsfeed
    0|mm  | All module helpers loaded.
    0|mm  | Starting server on port 8080 ...
    0|mm  | Server started ...
    0|mm  | Connecting socket for: updatenotification
    0|mm  | Connecting socket for: MMM-Facial-Recognition
    0|mm  | Starting module helper: MMM-Facial-Recognition
    0|mm  | Connecting socket for: calendar
    0|mm  | Starting node helper for: calendar
    0|mm  | Connecting socket for: MMM-EARTH
    0|mm  | Starting module: MMM-EARTH
    0|mm  | Connecting socket for: MMM-LocalTemperature
    0|mm  | MMM-LocalTemperature: module loaded! Path: /home/pi/MagicMirror/modules/MMM-LocalTemperature
    0|mm  | Connecting socket for: mmm-systemtemperature
    0|mm  | Starting node helper: mmm-systemtemperature
    0|mm  | Connecting socket for: newsfeed
    0|mm  | Starting module: newsfeed
    0|mm  | Sockets connected & modules started ...
    0|mm  | (node:11742) [DEP0025] DeprecationWarning: sys is deprecated. Use util instead.
    0|mm  | Launching application.
    0|mm  | libGL error: MESA-LOADER: failed to retrieve device information
    0|mm  | MESA-LOADER: failed to retrieve device information
    0|mm  | MESA-LOADER: failed to retrieve device information
    0|mm  | Create new calendar fetcher for url: http://.... - Interval: 300000
    0|mm  | Whoops! There was an uncaught exception...
    0|mm  | TypeError: PythonShell is not a constructor
    0|mm  |     at Class.python_start (/home/pi/MagicMirror/modules/MMM-Facial-Recognition/node_helper.js:11:21)
    0|mm  |     at Class.socketNotificationReceived (/home/pi/MagicMirror/modules/MMM-Facial-Recognition/node_helper.js:40:14)
    0|mm  |     at Socket. (/home/pi/MagicMirror/modules/node_modules/node_helper/index.js:113:11)
    0|mm  |     at emitTwo (events.js:126:13)
    0|mm  |     at Socket.emit (events.js:214:7)
    0|mm  |     at /home/pi/MagicMirror/node_modules/socket.io/lib/socket.js:513:12
    0|mm  |     at _combinedTickCallback (internal/process/next_tick.js:131:7)
    0|mm  |     at process._tickCallback (internal/process/next_tick.js:180:9)
    0|mm  | MagicMirror will not quit, but it might be a good idea to check why this happened. Maybe no internet connection?
    0|mm  | If you think this really is an issue, please open an issue on GitHub: https://github.com/MichMich/MagicMirror/issues
    0|mm  | Create new calendar fetcher for url: http://i.cal.to/.....ics - Interval: 300000
    0|mm  | https://epic.gsfc.nasa.gov/api/natural
    0|mm  | MMM-LocalTemperature: Socket Notification Received: "INIT".
    0|mm  | MMM-LocalTemperature: Socket Notification Received: "GET_DATA".
    0|mm  | Create new news fetcher for url: https://www.ofc.de/rss-feed.xml - Interval: 300000
    0|mm  | Create new news fetcher for url: http://www.tagesschau.de/xml/rss2 - Interval: 300000
    

    TypeError: PythonShell is not a constructor

    anyone an idea?



  • @eviltrooper said in Facial Recognition - customize your mirror for every user!:

    /home/pi/MagicMirror/modules/MMM-Facial-Recognition/node_helper.js

    @eviltrooper
    under /home/pi/MagicMirror/modules/MMM-Facial-Recognition/node_helper.js
    put pythonshell in braces {} like {pythonshell} and that error may go



  • @eviltrooper you can also install an older version of python-shell (0.4.0 ) and it works without modifying the node_helper.js file! You can install this specific version of python-shell by this command:

    npm install python-shell@0.4.0
    


  • Hey @paviro ! I’m having an issue with the module. This module worked only once for me. Now it just logs into the “everyone” page and doesn’t recognize me anymore. How do I fix this?



  • @nano79
    Fist of all, thanks @MichMich @paviro and @tosti007 gave me provided these fantastic applications and modules!

    Secondly, thanks for your help! According to your method, I installed python-shell 0.4.0 and resolved the issue of “PythonShell is not a constructor” .

    Now I had another issue in the followed steps.

    I have installed and configured MMM-Facial-Recognition-Tools, MMM-Facial-Recognition and MMM-ProfileSwitcher. I passed the facerecognition.py test:

    pi@MagicMirror2:~/MagicMirror/modules/MMM-Facial-Recognition-Tools $ export FACE_ALGORITHM=1
    pi@MagicMirror2:~/MagicMirror/modules/MMM-Facial-Recognition-Tools $ export FACE_USERS=
    pi@MagicMirror2:~/MagicMirror/modules/MMM-Facial-Recognition-Tools $ export FACE_USERS=Xueping
    pi@MagicMirror2:~/MagicMirror/modules/MMM-Facial-Recognition-Tools $ 
    pi@MagicMirror2:~/MagicMirror/modules/MMM-Facial-Recognition-Tools $ export FACE_ALGORITHM=1
    pi@MagicMirror2:~/MagicMirror/modules/MMM-Facial-Recognition-Tools $ export FACE_USERS=Xueping
    pi@MagicMirror2:~/MagicMirror/modules/MMM-Facial-Recognition-Tools $ python facerecognition.py 
    ['Xueping']
    Using FACE_ALGORITM: 1
    Loading training data...
    Training data loaded!
    Strong:Xueping
    Strong:Xueping
    Strong:Xueping
    Strong:Xueping
    Strong:Xueping
    Strong:Xueping
    

    Now I added the configuration in config.js as followings:

    modules: [
    		{
                module: 'MMM-Logging',
                classes: 'default everyone',
                config: {
                }
            },
    
    		{
    			module: "alert",
    			classes: 'default everyone'
    		},
    		{
    			module: "updatenotification",
    			position: "top_bar",
    			classes: 'default everyone'
    		},
    
    		{
    			module: "compliments",
    			position: "lower_third",
    			classes: 'Xueping',
    			config: {
    				compliments: {
    					anytime: [
    						"Hello!THIS IS TESTING!"
    					],
    				}
    			}
    		},
    		{
    			module: "clock",
    			position: "top_left",
    			classes: 'everyone'
    		},
    		{
    			module: 'MMM-Facial-Recognition',
    			position: "top_right",
    			config: {
    				// 1=LBPH | 2=Fisher | 3=Eigen
    				recognitionAlgorithm: 1,
    				lbphThreshold: 50,
    				fisherThreshold: 250,
    				eigenThreshold: 3000,
    				alwaysShowLeave: false,
    				useUSBCam: false,
    				trainingFile: '/home/pi/MagicMirror/modules/MMM-Facial-Recognition-Tools/training.xml',
    				interval: 2,
    				logoutDelay: 30,
    				users: ['Xueping'],
    				defaultClass: "default",
    				everyoneClass: "everyone",
    				welcomeMessage: true,
    			}
    		},
    		{
    			module: 'MMM-ProfileSwitcher',
    			config: {
    				// Disable the enter messages for everyone but me and Kevin
    				enterMessages: {
    					"Xueping": "Hello :D", // Kevin has a custom message
    					"everyone": "Hello :D",
    					"default": "No Users were detected"
    				},
    				// Everyone has a custom message
    				leaveMessages: {
    					// %profile% will be replaced with the correct name
    					"everyone": "Hey %person%, already leaving?",
    					// I have a custom and the default message
    					//  this is not the same as everyone since we changed it
    					"Xueping": ["Bye bye!"], 
    					"default": "Goodbye"
    				}
    			}
    		},
    		{
    			module: "MMM-ping",
    			position: "bottom_right",
    			classes: 'default',
    			config: {
    				colored: true,
    				font: "xsmall",
    				updateInterval: 1,
    				hosts: [
    					"192.168.1.1",
    					"forum.magicmirror.builders"
    				]
    			}
    		},
    
    	]
    

    When I run MagicMirror, the screen layout changed from default classes mode into user classes mode. the icons, which is in default classes mode, disappeared as I want. BUT in user classes mode, the very module (compliments) did not appeared! the whole screen is still black.

    The whole process log is as following:

    2019-03-15T15:08:50  [MMM-Facial-Recognition] Facerecognition started... (/home/pi/MagicMirror/modules/MMM-Facial-Recognition/node_helper.js:16 PythonShell.)
    2019-03-15T15:08:50  [MMM-Facial-Recognition] Loading training data... (/home/pi/MagicMirror/modules/MMM-Facial-Recognition/node_helper.js:16 PythonShell.)
    2019-03-15T15:08:50  [MMM-Facial-Recognition] ALGORITHM: LBPH (/home/pi/MagicMirror/modules/MMM-Facial-Recognition/node_helper.js:16 PythonShell.)
    2019-03-15T15:08:55  [MMM-Facial-Recognition] Training data loaded! (/home/pi/MagicMirror/modules/MMM-Facial-Recognition/node_helper.js:16 PythonShell.)
    2019-03-15T15:08:55  [MMM-Facial-Recognition] -------------------- (/home/pi/MagicMirror/modules/MMM-Facial-Recognition/node_helper.js:16 PythonShell.)
    2019-03-15T15:08:55  [MMM-Facial-Recognition] PiCam ausgewählt... (/home/pi/MagicMirror/modules/MMM-Facial-Recognition/node_helper.js:16 PythonShell.)
    
    
    
    2019-03-15T15:09:07  [MMM-Facial-Recognition] User Xueping with confidence 29.2076146738 logged in. (/home/pi/MagicMirror/modules/MMM-Facial-Recognition/node_helper.js:19 PythonShell.)
    [3656:0315/150907.528143:INFO:CONSOLE(205)] "MMM-ping is resumed.", source: http://10.133.26.219:8080/js/module.js (205)
    [3656:0315/150907.532130:INFO:CONSOLE(154)] "clock received a module notification: CURRENT_USER from sender: MMM-Facial-Recognition", source: http://10.133.26.219:8080/js/module.js (154)
    [3656:0315/150907.533400:INFO:CONSOLE(154)] "MMM-ping received a module notification: CURRENT_USER from sender: MMM-Facial-Recognition", source: http://10.133.26.219:8080/js/module.js (154)
    2019-03-15T15:09:07   payload: undefined (/home/pi/MagicMirror/modules/MMM-Logging/node_helper.js:34 Class.socketNotificationReceived)
    [3656:0315/150907.543631:INFO:CONSOLE(205)] "compliments is resumed.", source: http://10.133.26.219:8080/js/module.js (205)
    [3656:0315/150907.544869:INFO:CONSOLE(275)] "Will not show compliments. LockStrings active: module_6_MMM-ProfileSwitcher", source: http://10.133.26.219:8080/js/main.js (275)
    [3656:0315/150907.545862:INFO:CONSOLE(154)] "clock received a module notification: CURRENT_USER from sender: MMM-Facial-Recognition", source: http://10.133.26.219:8080/js/module.js (154)
    [3656:0315/150907.546709:INFO:CONSOLE(154)] "MMM-ping received a module notification: CURRENT_USER from sender: MMM-Facial-Recognition", source: http://10.133.26.219:8080/js/module.js (154)
    [3656:0315/150907.552615:INFO:CONSOLE(154)] "clock received a module notification: SHOW_ALERT from sender: MMM-Facial-Recognition", source: http://10.133.26.219:8080/js/module.js (154)
    [3656:0315/150907.554160:INFO:CONSOLE(154)] "MMM-ping received a module notification: SHOW_ALERT from sender: MMM-Facial-Recognition", source: http://10.133.26.219:8080/js/module.js (154)
    2019-03-15T15:09:07   payload: undefined (/home/pi/MagicMirror/modules/MMM-Logging/node_helper.js:34 Class.socketNotificationReceived)
    2019-03-15T15:09:07   payload: undefined (/home/pi/MagicMirror/modules/MMM-Logging/node_helper.js:34 Class.socketNotificationReceived)
    [3656:0315/150908.582237:INFO:CONSOLE(198)] "MMM-ping is suspended.", source: http://10.133.26.219:8080/js/module.js (198)
    [3656:0315/150908.587425:INFO:CONSOLE(60)] "MMM-ping is hidden.", source: http://10.133.26.219:8080/modules/MMM-Facial-Recognition//MMM-Facial-Recognition.js (60)
    
    
    
    2019-03-15T15:11:08  [MMM-Facial-Recognition] User Xueping logged out. (/home/pi/MagicMirror/modules/MMM-Facial-Recognition/node_helper.js:23 PythonShell.)
    [3656:0315/151108.702056:INFO:CONSOLE(205)] "MMM-ping is resumed.", source: http://10.133.26.219:8080/js/module.js (205)
    [3656:0315/151108.712169:INFO:CONSOLE(154)] "clock received a module notification: CURRENT_USER from sender: MMM-Facial-Recognition", source: http://10.133.26.219:8080/js/module.js (154)
    [3656:0315/151108.712959:INFO:CONSOLE(154)] "MMM-ping received a module notification: CURRENT_USER from sender: MMM-Facial-Recognition", source: http://10.133.26.219:8080/js/module.js (154)
    2019-03-15T15:11:08   payload: undefined (/home/pi/MagicMirror/modules/MMM-Logging/node_helper.js:34 Class.socketNotificationReceived)
    [3656:0315/151109.703213:INFO:CONSOLE(198)] "compliments is suspended.", source: http://10.133.26.219:8080/js/module.js (198)
    [3656:0315/151109.703561:INFO:CONSOLE(78)] "compliments is hidden.", source: http://10.133.26.219:8080/modules/MMM-Facial-Recognition//MMM-Facial-Recognition.js (78)
    [3656:0315/151109.709930:INFO:CONSOLE(84)] "MMM-ping is shown.", source: http://10.133.26.219:8080/modules/MMM-Facial-Recognition//MMM-Facial-Recognition.js (84)
    
    
    
    
    ^C
    pi@MagicMirror2:~/MagicMirror $
    

    Could you or anyone give me some suggestions? Thanks in advance.