MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.

    Facial Recognition - customize your mirror for every user!

    Scheduled Pinned Locked Moved Troubleshooting
    216 Posts 56 Posters 521.5k Views 58 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • Y Offline
      YourhighnessLeender @nuckinfutz
      last edited by

      @nuckinfutz
      Ok here is the output from train.py:

      pi@raspberrypi:~/MagicMirror/modules/MMM-Facial-Recognition-Tools-master/facetrainer $ sudo python train.py
      Which algorithm do you want to use?
      [1] LBPHF (recommended)
      [2] Fisherfaces
      [3] Eigenfaces
      --> 1
      
      Reading training images...
      --------------------
      Assign label 1 to Johannes
      --------------------
      
      Read 13 positive images and 400 negative images.
      
      13 images from subject Johannes
      --------------------
      
      Training model...
      Training data saved to training.xml
      
      Please add or update (if you added new people not just new images) ['Johannes'] inside config.js (mirror module) or config.py (model tester). You can change the names to whatever you want, just keep the same order and you'll be fine.
      Please add 1 as your choosen algorithm inside config.js (mirror module) or config.py (model tester).
      pi@raspberrypi:~/MagicMirror/modules/MMM-Facial-Recognition-Tools-master/facetrainer $ 
      

      Here is my config.js:

      GNU nano 2.2.6                                      File: config.js                                                                                    
      
      /* Magic Mirror Config Sample
       *
       * By Michael Teeuw http://michaelteeuw.nl
       * MIT Licensed.
       */
      
      var config = {
              port: 8080,
              ipWhitelist: ["127.0.0.1", "::ffff:127.0.0.1", "::1"],
      
              language: 'sv',
              timeFormat: 24,
              units: 'metric',
      
              modules: [
                      {
                              module: 'MMM-Facial-Recognition',
                              config: {
                              // 1=LBPH | 2=Fisher | 3=Eigen
                              recognitionAlgorithm: 1,
                              // Threshold for the confidence of a recognized face before it's considered a
                              // positive match.  Confidence values below this threshold will be considered
                              // a positive match because the lower the confidence value, or distance, the
                              // more confident the algorithm is that the face was correctly detected.
                              lbphThreshold: 50,
                              fisherThreshold: 250,
                              eigenThreshold: 3000,
                              // force the use of a usb webcam on raspberry pi (on other platforms this is always true automatically)
                              useUSBCam: true,
                              // Path to your training xml
                              trainingFile: '/home/pi/MagicMirror/modules/MMM-Facial-Recognition/training.xml',
                              // recognition intervall in seconds (smaller number = faster but CPU intens!)
                              interval: 1,
                              // Logout delay after last recognition so that a user does not get instantly logged out if he turns away from the mirror for a f$
                              logoutDelay: 5,
                              // Array with usernames (copy and paste from training script)
                              users: ['johannes'],
                              //Module set used for strangers and if no user is detected
                              defaultClass: "default",
                              //Set of modules which should be shown for every user
                              everyoneClass: "everyone"
                                      }
                      },
      
      
      bheplerB N 2 Replies Last reply Reply Quote 0
      • PointPubMediaP Offline
        PointPubMedia
        last edited by

        @paviro Do you think it can be possible to have a “CURL” call when a user log in and log out ?

        paviroP B 2 Replies Last reply Reply Quote 0
        • bheplerB Offline
          bhepler Module Developer @YourhighnessLeender
          last edited by

          @YourhighnessLeender Check your capitalization. Your training script output was ‘Johannes’ and your config.js has ‘johannes’.

          Y 1 Reply Last reply Reply Quote 1
          • Y Offline
            YourhighnessLeender @bhepler
            last edited by

            @bhepler thanks! Tried that but still no luck. Started over from scratch, still undefined user. The. Lowercase was me testing if it made any difference.

            Cound it be that the webcam captures in too low res when running MM compare to the test script? And in that case, how can I check or change that?

            Im a noob with linux and the terminal.

            N 1 Reply Last reply Reply Quote 0
            • N Offline
              nuckinfutz @YourhighnessLeender
              last edited by nuckinfutz

              @YourhighnessLeender You spelled your name as Johannes in the training file and in config.js you spelled it johannes. config.js is a lower case J.

              Been there done that. lol…

              N 1 Reply Last reply Reply Quote 0
              • N Offline
                nuckinfutz @nuckinfutz
                last edited by

                @nuckinfutz behelper beat me to it.

                1 Reply Last reply Reply Quote 0
                • B Offline
                  benkej
                  last edited by

                  Hi guys,

                  I have the same problem, tried with picam and normal webcam too.
                  Capture working, train working, facerecognition_tester working, MMM-Facial-Recognition doesn’t work.

                  Anyone sitting in front of the mirror, I get the message in terminal “User undefined with confidence null logged in”

                  Y 1 Reply Last reply Reply Quote 0
                  • N Offline
                    nuckinfutz @YourhighnessLeender
                    last edited by

                    @YourhighnessLeender Webcam is fine. If it worked in training it will work in the module.

                    Y 1 Reply Last reply Reply Quote 0
                    • Y Offline
                      YourhighnessLeender @nuckinfutz
                      last edited by

                      @nuckinfutz that is whats so strange. It does work in training but not in the module. Did a new install of the module and new training.xml but no luck. Very very wierd.

                      Maybe I should buy a picam and try with that.

                      1 Reply Last reply Reply Quote 0
                      • Y Offline
                        YourhighnessLeender @benkej
                        last edited by

                        @benkej question: did you change any of the capture settings in config.js? Like threshold etc? I was thinking of trying a different algorithm, did you try that?

                        B 1 Reply Last reply Reply Quote 0
                        • B Offline
                          benkej @YourhighnessLeender
                          last edited by paviro

                          @YourhighnessLeender only for trial but I changed everything back to the default. I’m using raspberry pi 3 model b, here is part of my config:

                          {
                              module: 'MMM-Facial-Recognition',
                              config: {
                                  // 1=LBPH | 2=Fisher | 3=Eigen
                                  recognitionAlgorithm: 1,
                                  // Threshold for the confidence of a recognized face before it's considered a
                                  // positive match.  Confidence values below this threshold will be considered
                                  // a positive match because the lower the confidence value, or distance, the
                                  // more confident the algorithm is that the face was correctly detected.
                                  lbphThreshold: 50,
                                  fisherThreshold: 250,
                                  eigenThreshold: 3000,
                                  // force the use of a usb webcam on raspberry pi (on other platforms this is always true automatically)
                                  useUSBCam: true,
                                  // Path to your training xml
                                  trainingFile: 'modules/MMM-Facial-Recognition/training.xml',
                                  // recognition intervall in seconds (smaller number = faster but CPU intens!)
                                  interval: 3,
                                  // Logout delay after last recognition so that a user does not get instantly logged out if he turns away from the mirror for a few seconds
                                  logoutDelay: 15,
                                  // Array with usernames (copy and paste from training script)
                                  users: ["Jani"],
                                  //Module set used for strangers and if no user is detected
                                  defaultClass: "default",
                                  //Set of modules which should be shown for every user
                                  everyoneClass: "everyone"
                              }
                          }
                          

                          and part of console log:

                          [MMM-Facial-Recognition] Facerecognition started...
                          [MMM-Facial-Recognition] Loading training data...
                          [MMM-Facial-Recognition] ALGORITHM: LBPH
                          [MMM-Facial-Recognition] Training data loaded!
                          [MMM-Facial-Recognition] --------------------
                          [MMM-Facial-Recognition] Webcam ausgewählt...
                          [MMM-Facial-Recognition] User undefined with confidence null logged in.
                          [MMM-Facial-Recognition] User undefined logged out.
                          [MMM-Facial-Recognition] User undefined with confidence null logged in.
                          [MMM-Facial-Recognition] User undefined logged out.
                          [MMM-Facial-Recognition] User undefined with confidence null logged in.
                          [MMM-Facial-Recognition] User undefined logged out.
                          ^C[MMM-Facial-Recognition] Shutdown: Cleaning up camera...
                          [MMM-Facial-Recognition] Terminating..
                          

                          @YourhighnessLeender and the output of train.py:

                          Which algorithm do you want to use?
                          [1] LBPHF (recommended)
                          [2] Fisherfaces
                          [3] Eigenfaces
                          --> 1
                          
                          Reading training images...
                          --------------------
                          Assign label 1 to Jani
                          --------------------
                          
                          Read 3 positive images and 400 negative images.
                          
                          3 images from subject Jani
                          --------------------
                          
                          Training model...
                          Training data saved to training.xml
                          
                          Please add or update (if you added new people not just new images) ['Jani'] inside config.js (mirror module) or config.py (model tester). You can change the names to whatever you want, just keep the same order and you'll be fine.
                          Please add 1 as your choosen algorithm inside config.js (mirror module) or config.py (model tester).
                          

                          Note from admin: Please use Markdown on code snippets for easier reading!

                          1 Reply Last reply Reply Quote 0
                          • Y Offline
                            YourhighnessLeender
                            last edited by

                            @benkej same as me, but no luck :-(

                            B 1 Reply Last reply Reply Quote 0
                            • B Offline
                              benkej @YourhighnessLeender
                              last edited by

                              @YourhighnessLeender unfortunately yes :angry:
                              I try to reinstall the whole system

                              Y 1 Reply Last reply Reply Quote 0
                              • Y Offline
                                YourhighnessLeender @benkej
                                last edited by

                                @benkej oke, please update on your progress. Good luck. Im very close to giving up.

                                1 Reply Last reply Reply Quote 0
                                • paviroP Offline
                                  paviro @PointPubMedia
                                  last edited by paviro

                                  @PointPubMedia Well sure but you could also write your own module listening for the notifications from my module :)

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

                                  @YourhighnessLeender Check your capitalization. Your training script output was ‘Johannes’ and your config.js has ‘johannes’.

                                  This does not make any difference :)

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

                                  @YourhighnessLeender only for trial but I changed everything back to the default. I’m using raspberry pi 3 model b, here is part of my config:

                                  Read 3 positive images and 400 negative images.
                                  

                                  You should definitely use more than 3 pictures! I use around 200 :D

                                  We're all stories in the end. Just make it a good one, eh?

                                  – The Doctor

                                  Y B 2 Replies Last reply Reply Quote 0
                                  • Y Offline
                                    YourhighnessLeender @paviro
                                    last edited by

                                    @paviro 200 pictures - aha! Maybe my 13 isnt enough. I can’t use the capture script since i’m on webcam so I took em with my phone and transferred them to the pi. I’ll add more and cross my fingers.

                                    1 Reply Last reply Reply Quote 0
                                    • paviroP Offline
                                      paviro
                                      last edited by

                                      Well that could also be a cause. You should use the same camera for best results!
                                      Why shouldn’t you be able to use a webcam with the capture script? I never used it with anything else to be honest :D

                                      We're all stories in the end. Just make it a good one, eh?

                                      – The Doctor

                                      Y 1 Reply Last reply Reply Quote 1
                                      • Y Offline
                                        YourhighnessLeender @paviro
                                        last edited by

                                        @paviro hmm. Just can’t get it working for some reason… will try again. It complaind about no picam. Maybe I have to change something in the script? I’ll du another try.

                                        1 Reply Last reply Reply Quote 0
                                        • paviroP Offline
                                          paviro
                                          last edited by

                                          Well the capture script does not have an enforce webcam option. Try to uninstall the picam python module, it will fallback to webcam then.

                                          To minimize recognition errors the MagicMirror module requires two identical recognitions to be accepted as current user. If your training data is not good enough it could happen that you are never recognized twice in two directly following images -> Always unknown user.

                                          We're all stories in the end. Just make it a good one, eh?

                                          – The Doctor

                                          Y 1 Reply Last reply Reply Quote 0
                                          • Y Offline
                                            YourhighnessLeender @paviro
                                            last edited by

                                            @paviro thanks for the help. How do I uninstall the picam? Is it just to remove picam.py?

                                            1 Reply Last reply Reply Quote 0

                                            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                                            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                                            With your input, this post could be even better 💗

                                            Register Login
                                            • 1
                                            • 2
                                            • 3
                                            • 4
                                            • 5
                                            • 6
                                            • 7
                                            • 8
                                            • 9
                                            • 10
                                            • 11
                                            • 6 / 11
                                            • First post
                                              Last post
                                            Enjoying MagicMirror? Please consider a donation!
                                            MagicMirror created by Michael Teeuw.
                                            Forum managed by Sam, technical setup by Karsten.
                                            This forum is using NodeBB as its core | Contributors
                                            Contact | Privacy Policy