Introduction

Face recognition is a crucial security application. Through this project, a very basic form of face recognition has been implemented using the Haar Cascades Classifier, openCV & K-Nearest Neighbors Algorithm.

Face-Recognition

Face Recognition using KNN algorithm and open cv for python.

Technology Stack

Python - The whole code has been written in Python cv2 - cv2 is the OpenCV module and is used here for reading & writing images & also to input a video stream Algorithm - KNN Classifier - Haar Cascades

Breakdown of the code for KNN classifier

1. Importing libraries
2. Create some data for classification
3. Write the kNN workflow
4. Finally, run knn on the data and observe results

Dependencies

Python 2.7 and OpenCv

How it works!

  • Run generating selfie training data.ipynb.The script will open a camera window.Stand in front of the camera until recording of the face is completed.Input the person's name. Press q after having enough samples.
  • The default file where the features are stored is name.npy.
  • Run the Building Face Classifier.ipynb file!

Demo Images

Training_1

Training_1

Training_2

Training_2

Training_3

Training_3

Testing_1

Testing_1

Testing_2

Testing_2