Professional Documents
Culture Documents
ALGORITHM
compiled as one of the requirements for completing the Undergraduate Study Program in
the Electrical Engineering Department, Faculty of Engineering
by:
M HAIDAR REZA
D400184040
ii
iii
ANALYSIS OF FACIAL RECOGNITION SYSTEM USING LBPH
ALGORITHM
Abstract
Abstrak
1
1. INTRODUCTION
Biometric is body measurements and calculations related to human characteristics.
Biometric authentication is used in computer science as a form of identification. The
working principle of biometric authentication is by measuring the intrinsic physical or
behavioral trait. There are two main types of biometric identifiers that are physiological
characteristics and behavioral characteristics. The Physiological identifiers relate to the
composition of the user being authenticated. While Behavioral identifiers include the unique
ways in which individuals act.
One of the physiological identifiers of biometric identification is facial recognition. facial
recognition is a technology capable of matching a human face from a digital image or a video
frame against a database of faces by mapping an individual's facial features mathematically.
Facial recognition is used to authenticate users through ID verification services. With the help of
artificial intelligent system, the facial structure of humans can be analyzed..
There are several methods for recognizing a person’s face. Each method has different
characteristics and accuracy. Recognition accuracy is the most important factor in facial
recognition algorithms. There are many factors that affect recognition accuracy. Environmental
factors, quality of image, shifting, and scaling of images are the common factors that affect the
recognition accuracy(Paul & Acharya, n.d.).
For recognizing the face, software goes through several processes the first step is face
detection. One of the popular algorithms used in face detection is Viola-Jones Detection
Technique known as Haar Cascades. The following process is analyzing the face that is captured.
By analyzing the data software can convert the image to data. This data then compared to the face
in the database by matching geometric features of the face with the general specification defined
by a vector showing the position and size of the main facial features, for example, the eyebrows,
nose, mouth, and facial contours(Deeba et al., 2019). In this study, python is used as a
programming language for facial recognition. Python is a powerful high-level, interpreted,
interactive, and object-oriented scripting language created by Guido Van Rossum in late 1980s
(A.L.Sayeth Saabith 1 et al., n.d.). One of the libraries used in this program is OpenCV. OpenCV
is one of the libraries that is often used in computer vision image processing that utilizes an
Application Programming Interface (API) where OpenCV allows the computer to see like humans
with camera. The most useful part of OpenCV may well be its architecture and memory
management. It provides a framework within which it is possible to work with images and videos
2
in any number of ways (“Motion Detection and Face Recognition Using Raspberry Pi, as a part
of, the Internet of Things,” 2019). With Opencv several algorithms can use easily for facial
recognition. One of the algorithms used in this study is LBPH (Local Binary Pattern Histogram)
algorithm. Based on Suma SL LBPH algorithm achieved 85%-95% accuracy(Suma Sl & Sarika
Raga, 2018).
In this study, author develop facial recognition software to find out the accuracy of the
algorithm used in the process with test it to several conditions and faces. This test was carried out
using 5mp Picamera that connected into the CSI camera port in Raspberry 3 model B+. This
facial recognition system used LBPH algorithm method to recognize humans faces. LBP is an
efficient feature for texture classification and combined with histogram it will improve the
detection performance making it powerful and efficient algorithm that can run in Raspberry Pi 3
model B+.
2. METHOD
3
Figure 1. Facial Recogniton Flowchart
2.2.1 Raspberry Pi
Raspberry Pi is single board circuit(SCB) with the sizes like a credit card.
Although the size is quite mini, the capabilities of this computer are not inferior
to computers in general. Raspberry Pi is able to run office programs, play
music, and videos with high resolution. Raspberry pi is developed in the United
Kingdom by Raspberry Pi Foundation. This research itself is using Raspberry pi
3 model B+ as a CPU with the specification shown below:
Broadcom BCM2837B0, Cortex-A53 (ARMv8) 64-bit SoC @ 1.4GHz
1GB LPDDR2 SDRAM
2.4GHz and 5GHz IEEE 802.11.b/g/n/ac wireless LAN, Bluetooth 4.2,
BLE
5V/2.5A DC power input
4
Figure 2. Raspberry Pi 3 Model B+
2.2.2 Picamera
Pi Camera module is a camera that can be used to take pictures and high-
definition videos. The Pi Camera module can attach to the Raspberry Pi’s CSI
port using 15-pin ribbon cable. In this project, the camera has 5mp resolution
with up to 1080p video recording.
Figure 3. Picamera
When the tool is ready in the raspberry pi installed Opencv as a library for facial
recognition. this library is often used in computer vision where Opencv allows the
computer to see like humans with a camera. This library work by acquiring,
5
processing, and analyzing the data so the camera can recognize human's face. After
installing the OpenCV The camera and CV2 library were tested on Raspberry pi by
running the script.
For the next step is implementing face detection with haar cascade classifier
algorithm. Haar cascade classifier is an algorithm that is often used in face detection.
In the OpenCV, the Haar Cascade script is already included in OpenCV data. By
calling haarcascade.xml file to the program the camera will automatically
programmed to detect objects using Haar Cascade algorithm. Haar Cascade can detect
the face in real-time so it can be used in video streaming. Haar-Features are good at
detecting edges and lines. This makes it especially effective in face detection.
However, because Haar Features have to be determined manually, there is a certain
limit to the types of things it can detect. If you give a classifier (a network, or any
algorithm that detects faces) edge and line features, then it will only be able to detect
objects with clear edges and lines. Even as a face detector, if we manipulate the face a
bit like tilting head to the side a Haar-based classifier may not be able to recognize the
face. In this haar cascade it using scalefactor 1.05 and minNeighbors 6 as the
parameters.
When the face is already detected it’s time to create the dataset. To create the
dataset new folder is needed for the data place. By gathering the data from photos of a
test subject in the folder the more data it gets the more accurate facial recognition is. If
the data gathering is complete. Data that already gathered will trained. This process is
important for facial recognition because of camera will try to match our face in camera
with the data. This data is then converted to yml file. When the camera failed to
recognize the face on the camera. This means the data need to be trained again by
scaling the picture, cropping the picture, and converting the picture to grayscale. Train
the data again and again to improve the accuracy and time needed to recognize the
face. In this research the data converted to gray with the command in the trainer. This
is done to make raspberry pi easier to process so it can fasten the process time. In
RGB image it consist 3 dimensional pixel value while on the grayscale a pixel value
6
will be one dimension. To convert the RGB image to grayscale I’m using this
formula :
L= Gray
R= Red
G= Green
B= Blue
The dataset that is already trained will produce yml file. That yml will be
called in facial recognition script and help the camera to recognize face. For the facial
recognition itself author used Local Binary Patterns Histograms (LBPH) algorithm.
Local Binary Patterns Histograms is simple but efficient algorithm used for
recognizing face. This algorithm work by labeling the pixel of an image by
thresholding the neighborhood of each pixel and considers the result as a binary
number. This pixel then matched with the face on the video that captured with predict
function it enable us to know the labels of the data value based on trained model. In
this study author using default parameters for LBPH algorihm.
Figure 4. LBPHParameters
7
Figure 5. LBPH algorithm flowchart
8
3. RESULTS AND DISCUSSION
9
This dataset then trained with LBPH algorithm with parameter shown in figure 4.
for recognize the face with numpy array.With numpy array the image in dataset will
change to the number inside array. This number contain height width and channel
format. In this study author change the pixel size of the image to gain higher
accuracy.
In the test I set the confidence level of the facial recognition is 50%. If the face
recognize and the accuracy above 50% program will print the name of the face above
the square with the help of pickle. By predict the value of image in [y:y+h, x:x+w]
confidence level is shown
Facial recognition test are carried out repeatedly to see the level of accuracy and
the ability to detect face in several distance and lighting. In this table below it show
the result of experiment.
Face
Distanc Face
Lighting Accuracy Result
e Detection Recognition
Bright
(580 40cm Detected Recognized 70%
lumen)
10
70cm Detected Recognized 77%
Not
100cm Detected
recognized -
Face
Lightin Distanc
Detectio Face Accuracy Result
g e
n Recognition
Not
40cm Detected 69%
Recognized
Dim
(420 70cm Detected Recognized 68%
lumen)
Not
100cm Detected -
recognized
11
Table 3 Experiment of Data A In Dark Lighting
Face
Distanc
Lighting Detectio Face Accuracy Result
e
n Recognition
Not Not
40cm -
Detected Recognized
Not Not
Dark 70cm -
Detected Recognized
Not Not
100cm -
Detected recognized
In this experiment several other face and position also tested in this figure
below will show the result of the testing:
12
Figure 10. Recognized More Than One face With Photo
4. CLOSING
From the results of the study, it can be concluded that the facial recognition system is
affected by several variables. In this experiment, the greater distance of the face will make
the camera won't recognize the face. On the other hand if the face is too close from the
camera it also reduces the accuracy. In this experiment when the face is around 40cm and
13
70cm the camera can recognize the face but when it's above 100cm the camera already can
not recognize the face of the person. Not only that the lighting of the room also affected the
result if the lighting in the room is too low it will disturb face detection and facial
recognition process. Based on the research even the camera won't detect anything at all in
dark lighting while in dim light camera still recognize but the accuracy is lower. Training
data also affected the accuracy of the facial recognition program. In this study training the
data by resizing the pixel image can improve the accuracy of the camera. Several head
positions also affected the process of face detection when the face is tilted a little haar
cascade can not detect the face because the face line and edge are not clear.
Suggestion for further research, it is better to use more powerful board for the processing unit
so it can detect faster and can run better algorithms. A more powerful board can help improve the
accuracy of the facial recognition system by making a complex program and a lot of dataset..
ACKNOWLEDGEMENT
All praise is to Allah for all His blessings and with that, I was able to accomplish my tasks
in this final project. But the whole process also involved different individuals who advised
me and guided me to reach my goal and these include;
1. Mr. Dedi Ary Prasetya,S.T., M.Eng as my supervisor who provided me with various
suggestions and inputs during the period of making my final project.
2. My friends at The Department of Electrical Engineering at Muhammadiyah University of
Surakarta.
3. My family that helped me to accomplish this study
REFERENCE
A.L.Sayeth Saabith 1, , MMM.Fareez 2, & , T.Vinothraj3. (n.d.). PYTHON CURRENT TREND
Research Development.
Deeba, F., Memon, H., Ali, F., Ahmed, A., & Ghaffar, A. (2019). LBPH-based Enhanced Real-
14
Motion Detection and Face Recognition using Raspberry Pi, as a Part of, the Internet of Things.
Paul, S., & Acharya, S. (n.d.). A Comparative Study on Facial Recognition Algorithms. 14.
Suma Sl & Sarika Raga. (2018). Real Time Face Recognition of Human Faces by using LBPH and
15