Face Recognition Using Haar Cascade Classifier: Varun Garg Kritika Garg
Face Recognition Using Haar Cascade Classifier: Varun Garg Kritika Garg
Abstractwith development of machine learning technology the database directory and then from these names individual
many applications have been revolutionized which earlier used to number is extracted, which is used as a label for the face in
utilize high amount of resources .Face recognition is a crucial that image. Since, the dataset images are in gif format and as
security application .Though this paper we present this appli-
cation using optimized amount of resources and high efficiency.
of now, OpenCV does not support gif format, Image module
from PIL is used to read the image in grayscale format. Numpy
KeywordsFace detection, Machine Learning, Open CV, arrays are used to store the images
Raspberry Pi, Haar Cascade Classifier
B. Load the face detection Cascade
I. INTRODUCTION To Load the face detection Cascade the first step is to
The face is crucial for human identity. It is the feature which detect the face in each image. Once we get the region of
best distinguishes a person. Face recognition is an interesting interest containing the face in the image, we use it for
and challenging problem, and impacts important applications training the recognizer. For the purpose of face detection, we
in many areas such as identification for law enforcement, will use the Haar Cascade provided by OpenCV. The haar
authentication for banking and security system access, and cascades that come with OpenCV are located in the directory
personal identification among others. Face recognition is an of OpenCV installation. haarcascade frontalface default.xml is
easy task for humans but its entirely different task for a used for detecting the face. Cascade is loaded using the cv2
computer. A very little is known about human recognition CascadeClassifier function which takes the path to the cascade
to date on How do we analyze an image and how does the xml file. if the xml file is in the current working directory, then
brain encode it and Are inner features (eyes, nose, mouth) relative path is used.
or outer features (head shape, hairline) used for a successful
face recognition? Neurophysiologist David Hubel and Torsten C. Create the Face Recognizer Object
Wiesel has shown that our brain has specialized nerve cells The next step involve creating the face recognizer object.
responding to specific local features of a scene, such as lines, The face recognizer object has functions like FaceRecog-
edges, angles or movement. Since we dont see the world as nizer.train to train the recognizer and FaceRecognizer.predict
scattered pieces, our visual cortex must somehow combine the to recognize a face. OpenCV currently provides Eigenface
diff erent sources of information into useful patterns. Recognizer,Fisherface Recognizer and Local Binary Patterns
Automatic face recognition is all about extracting those Histograms Face Recognizer.we have used Local Binary Pat-
meaningful features from an image,putting them into a use- terns Histograms Face Recognizer to perform face recognition.
ful representation and performing some classifications on With Local Binary Patterns it is possible to describe the texture
them.Face recognition based on the geometric features of and shape of a digital image. This is done by dividing an
a face is probably the most intuitive approach to Human image into several small regions from which the features are
identification.The whole process can be divided in three major extracted that can be used to get a measure for the similarity
steps where the first step is to find a good database of faces between the images.
with multiple images for each individual.The next step is to
detect faces in the database images and use them to train the D. Prepare the training set Perform the training
face recognizer and the last step is to test the face recognizer To create the function to prepare the training set, we will
to recognize faces it was trained for. define a function that takes the absolute path to the image
database as input argument and returns tuple of 2 list, one
II. IMPLEMENTATION
containing the detected faces and the other containing the
A. Import the required modules corresponding label for that face. For example, if the ith index
The Modules required to perform the facial recognition are in the list of faces represents the 4th individual in the database,
cv2, os, image module and numpy. cv2 is the OpenCV module then the corresponding ith location in the list of labels has
and contains the functions for face detection and recognition. value equal to 4.
OS will be used to maneuver with image and directory names. Now to perform the training using the Face Recognizer.
First, we use this module to extract the image names in Train function. It requires 2 arguments, the features which
in this
JETIR1612019 Journal of Emerging Technologies and Innovative Research (JETIR) www.jetir.org 140
December 2016, Volume 3, Issue 12 JETIR (ISSN-2349-5162)
case are the images of faces and the corresponding labels Result: If the image of coming person is present in the saved
assigned to these faces which in this case are the individual data it will print his/her name as saved. you are recognized
number that we extracted from the image names. as ......
E. Testing
For testing the Face Recognizer, we check if the recognition
was correct by comparing the predicted label predicted with
the actual label actual. The label actual is extracted using the
os module and the string operations from the name of the
image. We also display the confidence score for each
recognition.
JETIR1612019 Journal of Emerging Technologies and Innovative Research (JETIR) www.jetir.org 141
December 2016, Volume 3, Issue 12 JETIR (ISSN-2349-5162)
IV. ADVANTAGES
This is real time project. It takes less than 5 seconds to give
result. It is based on Linux, can be work on computer or any
board with Linux in it. It could be implemented anywhere.
With raspberry pi it consists of very small hardware, so easy
to implement. it is affordable and the cost is very resonabe
Google drive has large space. We are able to get the data on
android app from Google drive. Data is available for future
use. Counting of entries is done without any human help.
V. DRAWBACKS
It needs more than one image of same face, for accurate
result. It needs working internet to send the data to cloud.
It compares every coming image and gives positive result in
confidence level, even for face is not present in data base. We
need o set a threshold value below which result is acceptable. It
takes time to load the database in beginning. More the database
more it takes time. Raspberry pis CPU is little bit slower than
our computers CPU.
VI. CONCLUSION
Thus using open cv libraries haarcascade classifier we were
successfully able to perform face detection with high efficency
.I have used the open cv package to extract the features of face
and then to compare them. Saved database should have more
than one images of same face it make face recognition more
accurate. Images and their corresponding labels being store
in arrays. It compares every coming image with stored data
and gives result in confidences level value. Even if face is not
present in data it gives a confidence value. But the confidence
value will be very high, so we consider a threshold value below
which result is acceptable.
REFERENCES
[1] Face Recognition using Python and OpenCV
http://hanzratech.in/2015/02/03/face-recognition- using-opencv.html.
[2] Raspberry pi fswebcam , http://raspberrypi.stackexchange.com/questions/8303/fswebcam-
not- displaying-images-properly.
[3] Internet of things, http://micrium.com/designingtheinternetofthingspart1iot-
devicesandlocalnetworks/
[4] Installing Google Drive On Raspberry Pi, http://www.home-automation-
community.com/google-drive-on-raspberry-pi/.
[5] open cv on raspberry pi B+, http://www.pyimagesearch.com/2015/06/22/install-
opencv-3-0- and-python-2-7-on-ubuntu/ .
[6] Python Software foundation(us), https://www.python.org/.
[7] Raspberry pi, documentation, http://venturebeat.com/2014/09/02/were-
going-to-need-more- storage-for-the-internet-of-things/.
[8] Storage need in iot http://venturebeat.com/2014/09/02/were-going-to-
need-more-storage-for- the-internet-of-things/
JETIR1612019 Journal of Emerging Technologies and Innovative Research (JETIR) www.jetir.org 142