This Project is built on Python to detect Faces for a Given input image. Using Haar-Cascade Classifier the faces were detected and using LBPH face recognizer the model was trained to store two classes of images.
I suggest to run it on virtual environment to avoid previous dependencies.
pip install virtualenv
virtualenv [foldername]
source activate foldername/bin/activate
Extract the zip file and place it in filename folder.
Then install OpenCV libraries.
pip install opencv-python
pip install opencv-contrib-python
After Extracting the zip file in [foldername]. This file structure Appears.
.
├── bin # Virtual Environment files
├── include # Virtual Environment files
├── lib # Virtual Environment files
├── Q3 # Project Root Folder
└── README.md
Contents of Project folder is down below.
.
├── Test # Test files
│ ├── example.jpg
│ ├── tomlookalike.jpg
│ └── tom1.jpeg
├── Train
│ ├── 0 # Contains 200 images
│ │ ├──1.jpg
│ │ └──...
│ └── 1 # Contains 214 images
│ ├──1.jpg
│ └──...
├── haarcascade_frontalface_default.xml # Haar-cascade file
├── test.py # Run this to get output
├── train.py # Contains logic for face detection and training using
│ LBPH Recognizer
└── trainData.yml # Contains labels of trained data in yml format.
python test.py Test/example.jpg
Add new images in your desired folder and run the above code accordingly.