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.

    MMM-FacialRecognition Training tool

    Scheduled Pinned Locked Moved Troubleshooting
    10 Posts 7 Posters 5.9k Views 7 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.
    • E Offline
      eliddell
      last edited by

      I cloned the Facial Recognition training tool to my linux laptop, to generate a Training.xml file that i could put on my pi later, but its not working…

      First i tried capturing with my webcam, and i see the webcam light go on, but it fails like so:

      sudo python capture.py 
      Remember to set the name list environment variable FACE_USERS
      Using default FACE_ALGORITM: 1
      What do you want to do?
      [1] Capture training images from webcam
      [2] Convert '*.jpg' pictures from other cameras to training images
      --> 1
      
      Enter the name of the person you want to capture or convert images for.
      --> Erik
      Images will be placed in ./training_data/Erik
      
      --------------------
      Starting process...
      
      Capturing positive training images.
      Press enter to capture an image.
      Press Ctrl-C to quit.
      
      Traceback (most recent call last):
        File "capture.py", line 38, in 
          capture.capture(preview)
        File "/root/MMM-Facial-Recognition-Tools/lib/capture.py", line 54, in capture
          input()
        File "", line 0
          
          ^
      SyntaxError: unexpected EOF while parsing
      

      Then I tried just using jpg files, got no errors but no images are actually being put in the [Person’s name] folder under training data…

      root@atreyu:~/MMM-Facial-Recognition-Tools# python capture.py 
      Remember to set the name list environment variable FACE_USERS
      Using default FACE_ALGORITM: 1
      What do you want to do?
      [1] Capture training images from webcam
      [2] Convert '*.jpg' pictures from other cameras to training images
      --> 2
      
      Enter the name of the person you want to capture or convert images for.
      --> Erik
      Images will be placed in ./training_data/Erik
      
      Please enter path to images or drag and drop folder into terminal
      --> '/root/Documents/erik1.jpg' 
      
      --------------------
      Starting process...
      
      root@atreyu:~/MMM-Facial-Recognition-Tools#
      

      I put gave it like 5 images for Erik and one for Essy, but
      When i try running the training.py it looks like there are no images: i get this:

      root@atreyu:~/MMM-Facial-Recognition-Tools# python train.py 
      Remember to set the name list environment variable FACE_USERS
      Using default FACE_ALGORITM: 1
      Which algorithm do you want to use?
      [1] LBPHF (recommended)
      [2] Fisherfaces
      [3] Eigenfaces
      --> 1
      
      Reading training images...
      --------------------
      Assign label 1 to Essy
      Assign label 2 to Erik
      --------------------
      
      ('Read', 0, 'positive images and', 400, 'negative images.')
      
      --------------------
      
      Training model type 1 with threshold 80
      ('Training data saved to', 'training.xml')
      
      Please add or update (if you added new people not just new images) ['Essy', 'Erik'] 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).
      root@atreyu:~/MMM-Facial-Recognition-Tools#
      

      Am i missing something?

      I tried running the Facial recognition test, and it opens up the preview and detects my face, eyes, nose etc… but always says no match

      please help…

      1 Reply Last reply Reply Quote 0
      • E Offline
        eliddell
        last edited by

        Ok I figured out that it wasn’t recognizing images because I was suppose to give a folder not a file… that said, I now have it trained for three people, [Erik, Essy, Paul] but when it recognizes any of them it just says that they are Essy when I run the tester script. I updated the config.py and everything… I know it recognizes all three people because others show up as None…

        Anyone have this problem

        1 Reply Last reply Reply Quote 0
        • E Offline
          eliddell
          last edited by

          Seems to be a problem in the config.py it was setting label to 0 no matter what

          Erik

          1 Reply Last reply Reply Quote 0
          • J Offline
            Jan
            last edited by

            Hi. I face the same issue as you, Erik. I can’t make captures via camera (same error as you wrote), and if i train my own jpgs, i can not run the face recognation without issues. Did you solve the problem ?

            1 Reply Last reply Reply Quote 0
            • A Offline
              apm1007
              last edited by

              got the same problem…

              1 Reply Last reply Reply Quote 0
              • G Offline
                gismo2006
                last edited by

                Hey,
                I hopüe I understand your problem and maybe I can help you. I use this modul since about one year. At first I had many problems but now it works perfect.

                What I do: I use the trainer on my pi. Because of my experince whit an other modul, i rember its better not to use other sources (like your laptop…)

                I use a usb cam not the pi cam. Because of that the traine wouldn´t work whit option one (take pictures from your webcam) So I have to choose option to (use jpg pictures)

                for this i use fswebcam whit the option --no-Banner. So i take about 50 pictures of myself. Then I copied all pictures in one Folder, Pictures for example. Choose in the trainer option 2 use your own jpg pictures and paste the path to your folder. I think now or before you choose your path the trainer ask you for a name. Lets work it… After this you have a new folder in your folder facetrainer. now you can start the train.py and everthing should Ok.

                Greets gismo

                1 Reply Last reply Reply Quote 0
                • R Offline
                  reaper81
                  last edited by

                  Hello everyone,

                  i also have a problem withe Facial Recognition Tool. When i start “python capture.py” i get this error.

                  pi@raspberrypi:~/MagicMirror/modules/MMM-Facial-Recognition-Tools $ sudo python capture.py
                  Traceback (most recent call last):
                  File “capture.py”, line 18, in
                  import lib.capture as capture
                  File “/home/pi/MagicMirror/modules/MMM-Facial-Recognition-Tools/lib/capture.py”, line 12, in
                  from builtins import input
                  ImportError: No module named builtins

                  I deleted and cloned the module twice. The installation of the OpenCV dependencies where successfull. The installation of the python dependencies (“pip install -r requirements.txt”) failed, because there where no requirements.txt.

                  I hope you can help me. Thanks.

                  N 1 Reply Last reply Reply Quote 0
                  • R Offline
                    reaper81
                    last edited by

                    OK, I found a sollution by my self. The Problem was realy the python dependency. It seems in the missing “requirements.txt” where the python future package listed so I installed it by my self with

                    sudo pip install future --upgrade

                    I hope paviro fix the missing file in his project, because I like it very much.

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

                      @reaper81 Same problem. Thanks a million for the fix!!! @paviro

                      1 Reply Last reply Reply Quote 0
                      • K Offline
                        kengberg
                        last edited by

                        This is aweome - I needed that fix as well - one step closer, thanx!

                        1 Reply Last reply Reply Quote 0
                        • 1 / 1
                        • 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