MagicMirror Forum
    • Recent
    • Tags
    • Unsolved
    • Solved
    • MagicMirror² Repository
    • Documentation
    • 3rd-Party-Modules
    • Donate
    • Discord
    • Register
    • Login
    1. Home
    2. konradwalsh
    A New Chapter for MagicMirror: The Community Takes the Lead
    Read the statement by Michael Teeuw here.
    K
    Offline
    • Profile
    • Following 0
    • Followers 2
    • Topics 3
    • Posts 15
    • Groups 0

    konradwalsh

    @konradwalsh

    7
    Reputation
    977
    Profile views
    15
    Posts
    2
    Followers
    0
    Following
    Joined
    Last Online

    konradwalsh Unfollow Follow

    Best posts made by konradwalsh

    • Facial Recognition Module - Step by Step Guide

      Hi all,

      Due to there being no guide on this and I was looking for one… I have decided to just make one…
      I only start figuring it out last night and so I am still setting up. So I will complete this post as I progress.

      I am using the following hardware

      • Raspberry Pi 3

      • Logitech 1080 HD USB Webcam

      • MagicMirror is installed and confirmed functioning correctly.

      The software I am using to do this is Mobaxterm.
      It might be easier to do all of this on the PI directly.

      The steps I have taken to get this working:

      Set up the tools

      1. Facial Recognition Tools

      on the github page click download as zip
      extract zip and remove -master from the end of the folder. Note: its the internal folder that you want with the same name.
      copy to MagicMirror/modules using your FTP or whatever folder browser you are using.

      run this:

      sudo apt-get update
      sudo apt-get install libopencv-dev python-opencv
      sudo npm install python-shell
      sudo apt-get install python-pip
      

      change to the tools module folder

      cd /MagicMirror/modules/MMM-Facial-Recognition-Tools
      

      run

      sudo npm install
      
      pip install -r requirements.txt
      

      Capturing training images

      Run

      python capture.py
      

      Decide whether you want to capture images from your web cam or convert existing .jpg images.
      Enter the name of the person you are about to capture. Images will be stored in a folder named after the captured person in training_data/.
      Follow screen instructions.

      Training model

      Make sure you have captured all your images. Run ``` python train.py ``` The script will automatically scan the directory training_data/ for your images. Wait. You will end up with a training.xml file in the current directory. Copy down the ['name', 'name2','name3'] part because you will later need it for setting up your mirror's face recognition and to test your face recognition model.
      1. Test your steps so far

      Make sure your training.xml from running train.py is in this directory - /MagicMirror/modules/MMM-Facial-Recognition-Tools

      specify the face recognition algorithm in the environment with

      export FACE_ALGORITHM=1
      

      specify your user labels in the environment with

      export FACE_USERS=Alice,Bob,Casey,Doug
      

      Run

      python facerecognition.py.
      

      Success?

      1. Set up the module for the mirror
        on the github page for the MMM-Facial-Recognition page, click download as zip
        extract zip and remove -master from the end of the folder. Note: its the internal folder that you want with the same name.
        copy to MagicMirror/modules using your FTP or whatever folder browser you are using.

      Visit the terminal window and go to your newly create folder - /MagicMirror/Modules/MMM-Facial-Recognition and run

      sudo npm install
      

      Open your config.js file and add:

      {
      	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: false,
      		// Path to your training xml
      		trainingFile: 'modules/MMM-Facial-Recognition/training.xml',
      		// recognition intervall in seconds (smaller number = faster but CPU intens!)
      		interval: 2,
      		// 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: [],
      		//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",
      		// Boolean to toggle welcomeMessage
      		welcomeMessage: true
      	}
      },
      

      Change the line to the actual location. It’s probably still under the Tools Module

      trainingFile: 'modules/MMM-Facial-Recognition/training.xml',
      

      for me, I changed it to

      trainingFile: 'modules/MMM-Facial-Recognition-Tools/training.xml',
      

      Also, change the line called Users to add you list of users that you set up during the Capture.py section above.

      users: ['Joe'],
      

      Finally, change the line, if applicable

      useUSBCam: True,
      

      FINAL STEP!

      For each module in your config.js, set the profile under which it should load. E.g -
      {
      	module: 'example_module',
      	position: 'top_left',
      	//Set your classes here seperated by a space.
      	//Shown for all users
      	classes: 'default everyone',
      },
      {
      	module: 'example_module2',
      	position: 'top_left',
      	//Set your classes here seperated by a space.
      	//Shown for all users
      	classes: 'Joe',
      },
      

      So now the first example module will load for everyone and the second will only load for Joe.


      THIS IS AS FAR AS I AM .. I AM DOCUMENTING AS I GO

      @paviro
      Module Developer - Please feel free to copy this or use as you see fit. I hope it is helpful to anyone else

      posted in Troubleshooting
      K
      konradwalsh
    • RE: Where are you from?

      From Galway in Ireland

      posted in General Discussion
      K
      konradwalsh
    • Spam Posts

      Is there really nothing that can be done to stop the spam posts?

      posted in General Discussion
      K
      konradwalsh

    Latest posts made by konradwalsh

    • RE: Known Irish Suppliers

      thats very helpful. Thanks.

      So you got 5 panes… Did you make 5 mirrors?

      posted in General Discussion
      K
      konradwalsh
    • RE: MMM-Rest

      works perfectly
      thanks!

      posted in Utilities
      K
      konradwalsh
    • RE: MMM-Rest

      ah… very cool

      posted in Utilities
      K
      konradwalsh
    • RE: MMM-Rest

      QUALITY!
      Thanks my friend… looking forward to getting home and getting this going

      posted in Utilities
      K
      konradwalsh
    • RE: MMM-Rest

      @Tuxdiver
      yes of course
      I feel confident in implementing it myself and see what I come up with…

      I suppose it would be good to have a dynamic situation where it maybe a string.
      For example, I am displaying my Hot Water Level. The result will be Low - Good - High.
      So it maybe a case of comparing a string value and reacting… Low would be blue and high would be red

      posted in Utilities
      K
      konradwalsh
    • RE: MMM-Rest

      @Tuxdiver said in MMM-Rest:

      { range:[0, 10], format: ’ span style=“color: yellow”%d /span’ },
      { range:[10, undef], format: ‘span style=“color: red”%d /span’ },
      { format: ‘span style=“color: green”%d /span’ },

      Thanks for the prompt reply… Seems my PI has gone offline and I am at work… so I will try this later and report back

      posted in Utilities
      K
      konradwalsh
    • RE: MMM-Rest

      Is it possible to create an in-line if statement to control the formatting?

      So, if the result, say @1 > 10 then color:red else color:green

      posted in Utilities
      K
      konradwalsh
    • RE: In what way is DAKboard related to MagicMirror

      it would be nice to copy some of those modules…
      I like the top weather warning bar

      posted in General Discussion
      K
      konradwalsh
    • RE: Non Ticker Stocks

      i wanted this so I just changed the CSS to remove the key frames section and it shows static list of updated stocks

      posted in Requests
      K
      konradwalsh
    • RE: Facial Recognition Module - Step by Step Guide

      reserved

      posted in Troubleshooting
      K
      konradwalsh