cenksoykan / RealTimeFaceRecognition

OpenCV Haarcascade and SVM for real time facial tracking and recognition using webcam

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

RealTimeFaceRecognition

Summary

Real time facial tracking and recognition using harrcascade and SVM(Radial Basis Function Kernal). Designed SVM classification model using cross-validation and exhaustively grid search, implemented using scikit in python, and trained on Extended Yale Database B. Achieved facial Tracking in OpenCV and optimized Haarcascade to detect up to 45 degrees head tilting. To build the model, 2452 samples from 38 people in the database are splitted into training and testing sets by a ratio of 3:1. The top 150 eigenfaces are extracted from 1839 training faces in the database using Principal Component Analysis (PCA). The principal components are then feeded into the C-SVM Classification model and trained with various kernel tricks. At the end of the recognition task, an accuracy of 93.3% is obtained with the Radial Basis Function (RBF) kernel on the testing set of 613 samples.

The dataset used is the Extended Yale Face Database B Cropped

http://vision.ucsd.edu/~leekc/ExtYaleDatabase/ExtYaleB.html

Training For Face Recognition

Training for face recognition using the command below. face_profile_name is the name of the user face profile directory that you want to create in the default ../face_profiles/ folder for storing user face images and training the SVM classification model:

python train.py [face_profile_name=<the name of the profile folder in database>]

Example to create a face profile named David:

python train.py David

Usage during run time:

press and hold 'p' to take pictures of you continuously once a cropped face is detected from a
pop up window. All images are saved under ../face_profiles/face_profile_name

press 'q' or 'ESC' to quit the application

Running Face Recognition In Real Time

Running the program in real time to recognize faces:

python main.py

Or running with options (By default, scale_multiplier = 4):

python main.py [scale_multiplier=<full screensize divided by scale_multiplier>]

Say you want to run with 1/2 of the full sreen size, specify that scale_multiplier = 4:

python main.py 4

Top 12 Eigenfaces generated from the Extended Yale Database B

alt text

Top 12 Predictions

alt text

Prediction of User Face

alt text

About

OpenCV Haarcascade and SVM for real time facial tracking and recognition using webcam


Languages

Language:Python 100.0%