This module is no longer supported. When it does work, the facial recognition methods used performed poorly.
This repository contains tools to setup and train the facial recognition module for the MagicMirror.
The scripts in this directory are based on scripts from pi-facerec-box and should be used on a computer (with a webcam). You need OpenCV installed on your computer. It works on a RaspberryPi.
python capture.py
..jpg
images.training_data/
.python train.py
. The script will automatically scan the directory training_data/
for your images.training.xml
file in the current directory.['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.With this tool you can test if your facerecognition model is working.
training.xml
from running train.py
is in this directoryexport FACE_ALGORITHM=1
export FACE_USERS=Alice,Bob,Casey,Doug
python facerecognition.py
.To install OpenCV run:
sudo apt-get install libopencv-dev python-opencv
If you are using virtual environments you will need to need to copy the opencv python modules into your virutal environment path. That will look something like this:
cp /usr/lib/python2.7/dist-packages/cv* ~/.virtualenvs/MY_VIRTUAL_ENV/lib/python2.7/site-packages/
Where python2.7
will be the name of your python version where
opencv was installed and MY_VIRTUAL_ENV
is the name of your
virtual environment.
Install the required python packages.
pip install -r requirements.txt
Currently this is just the future
module for making the scripts python 2 and 3 cross compatible.
The MIT License (MIT)
Copyright (c) 2014 Tony DiCola
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
The negative training data is from the ORL face database. Please see the file tools/facetrainer/training_data/negative/README for more information on this data.