- Contains code files for the project Face recognition using Haar-cascade.
- Create a new folder names: project_face_recog. Copy all files from the repository to the created folder
- Open cmd in the folder.
- Install dependencies
pip install -r requirements.txt
- Test whether opencv can detect camera.
python demo_cam_test.py
- Make sure the .xml is present in the directory, check if face detection is working:
python demo_face_detection.py
- Start building dataset for training purposes.
- Create a dataset folder in the same directory as the script.
- To build a dataset for your face for recognition purposes.
python face_dataset.py
- Inputs: face_id (int).
- Program will ask for an input.
Enter user id end press <return> ==> 1
- Can repeat this step for multiple faces, just give a different id (sequential)
- This will take 30 images of your face and save them in the dataset folder
- At the end, the datasets folder will be opened, delete bad images.
- Create a trainer folder in the same directory as script.
- After dataset has been created, train a classifier on your face images.
- First update line 16
names = ['None'] # add your name corresponding to the id number like,
# names = ['None', 'Vaibhav', ...]
python face_training.py
- After training, for recognition demo, execute:
python face_recognition.py