A project based on tensor flow running on Raspberry that can detect face.
- Raspberrypi 3
- Camera
- Speaker
- Python 3.5 on Windows/MacOs, Python 3.4 on Raspberry
- Lots of images of the target and others
- Put the images into data/target and others
conda create -n 3.5.2 python=3.5.2
source activate 3.5.2
for Linux/MacOS oractivate 3.5.2
for Windowsconda install -c https://conda.anaconda.org/menpo opencv3
conda install h5py
conda install scipy
pip install keras
pip install sklearn
pip install pygame
pip install tensorflow
-
For opencv:http://www.pyimagesearch.com/2016/04/18/install-guide-raspberry-pi-3-raspbian-jessie-opencv-3/
-
For tensorflow:https://github.com/samjabrahams/tensorflow-on-raspberry-pi
-
For keras:https://github.com/bitschift/brew.ai/wiki/Setting-up-the-Pi
-
If you got an error like
Error (-215) size.width>0 && size.height>0 occurred
when attempting to display an image using OpenCV, you can access the camera board on /dev/video0 by running the command: sudo modprobe bcm2835-v4l2 This will have to be run on every boot of the device. Or you can put modprobe bcm2835-v4l2 in /etc/rc.local to make it run on every boot automatically.
- Run
python3.4
in raspberry.
- e.g.
python CapturePictures.py -n 50
python CapturePictures.py -h
will give you more information.
- e.g.
python CropFaces.py -d ./captured_pictures/
python CropFaces.py -h
will give you more information.
- Put the croppe 6202 d face images of each person into different directories under "/train/", like "/train/Tony", "/train/Chao", "/train/Leo". Please note the folder name will be used as the person's name.
python FaceTrain.py
will generate a single model from all the given pictures into "./model".
- When the model is ready,
python DetectFaces.py
will capture faces from the camera video stream and identify who it is. python DetectFaces.py -h
will give you more information.