Probably the clearest example of face recognition using your very own dataset. This project is using Python, open-cv and TensorFlow. Yes! Say DEEP LEARNING!
The goal is to recognize only you and consider other people (not you) as strangers.
https://www.geeksforgeeks.org/image-classifier-using-cnn/
https://www.pyimagesearch.com/2018/06/18/face-recognition-with-opencv-python-and-deep-learning/
This project is a combination of both sources.
-
Python
I am using python 3.6.4 because the latest version of python is not supported by TensorFlow yet. You can download it here https://www.python.org/downloads/
-
TensorFlow
You can read how to install it here https://www.tensorflow.org/install/pip I am not using virtual environment and just run
pip install --upgrade tensorflow
did it with no issue for me. -
tflearn
Deep learning library featuring a higher-level API for TensorFlow used to create layers of our CNN. run
pip install tflearn
from your cmd -
open-cv
To process the image like converting them to grayscale and etc. run
pip install opencv-python
-
numpy
To process the image matrices. run
pip install numpy
-
tqdm
Instantly make your loops show a smart progress meter, just for simple designing sake. run
pip install tqdm
-
imutils
run
pip install imutils
- Run buildData.py to build your dataset
- your camera will detect your face using cv2.CascadeClassifier haarcascade_frontalface_default.xml and saves it as .png images
- You can change your file name on line 39. (it is "jordan" in my project)
- In this step, you have to direct the camera to capture only your face.
- You can be as expressive as possible
- Capture it from different angles
- Now, run the first step again, but change your file name into "unknown". This time, capture other people faces to be detected as unknown or strangers, which means not you.
- Create 2 new folders, name them as training and testing
- Move 70% of your images into training folder and the rest 30% into testing folder. Do the same for strangers images.
- Run training.py to generate training files
- change your training and testing directory on line 9, 10
- change your label on line 22, 23 according to your file names
- Run modelling.py to generate model files
- Run deploy2.py and enjoy how it works!
If you provide variative dataset of your face (different angle, brightness, contrast), it will mostly produce higher accuracy of your image recognition. So, train as many variative photos of yours.