Professional Documents
Culture Documents
BSIT 8th Reg # 01 SAAD NAZEER (Final Report)
BSIT 8th Reg # 01 SAAD NAZEER (Final Report)
Registration. No BSIT-021R16-01
Session 2016-2020
All thanks are to almighty ALLAH the most beneficial, merciful and gracious who gave me the
courage to complete the task assigned to me. Thanks ALLAH! I couldn’t have this
achievement if His kindness didn’t support me. Many people whom I want to pay my thanks at
the event, all my honorable teachers, my parent and all the friends. I say my special thanks to
my respected Rector Mr. Saqib Nazeer and my respected H.O.D Mr. Malik Bashir and my
respected supervisor Mr. Zohair Haider Naqvi. Finally, I would like to express my gratitude to
my loving family, especially to my parents for providing me full support during the project and
for all sort of moral and social support in life. Their prayers have enabled me to reach at this
stage.
SAAD NAZEER
BSIT-021R16-01
Final Year Project Undertaking Form
It is declared that I have developed a software (Security System for Person Identification
Using Face Recognition for ISP) containing modules that I managed and written this report
under the guidance of my project supervisor on the basis of my personal effort. The report
and the system that we submitted for the completion of Final Year Project are investigation
and effort of my own.
Signature of Student
_________________
Name: -----------------
Signature of Supervisor:
___________________
Name: Ma’am/Sir Date:
COPYRIGHTS©
All copyrights of software application and report strictly reserved By ISP Multan.
Publisher
Saad Nazeer,
BSIT-021R16-01,
ISP MULTAN
Proofreading
Sir Zohair
DEDICATION
This Project (Security System for Person Identification Using Face Recognition for ISP) I’m
dedicating to My Loving Parents, Friends and Respected Teachers, who prayed for my
success and all my supporting ones whom I love and respect from the core of my heart.
(March 2020)
Acknowledgment
I am highly indebted to Institute of Southern Punjab for their guidance and I will especially
thankful to my supervisor Sir Zohair Naqvi whose expertise was priceless in providing
necessary information regarding the project & also for their support in completing the project
without his support it was not easy for me. I will especially appreciate and thankful to my
HOD Sir Mubashir Malik whose motivation excited me to complete all the tasks. Further I will
thankful to my parents for their wise counsel, they are always there for me. This is result of
their prayers that I am stand here.
________________________
Saad Nazeer (BSIT-021R16-01)
Abstract
The face is one of the easiest ways to distinguish the individual identity of each other. Face
recognition is a personal identification system that uses personal characteristics of a person to
identify the person's identity. The product is needed to recognize the individuals with the
objectives of face detection and recognition and give details of that individual. I applied the
face recognition by utilizing the resources which is image processing and python libraries. In
outcome we can pick out the individuals which are known or unknown to organization. The
product I implemented is reliable and effective. The product can authenticate the processed
images fast by comparing to other systems. It will train the product with capturing the images
on real time, will process the images and give outcome by identify the image.
Internal Examiner
Department of Computer Science
--------------------
(Signature)
External Examiner
--------------------
(Signature)
Project Coordinator
Institute of Southern Punjab
--------------------
(Signature)
HOD
Institute of Southern Punjab
--------------------
Submitted to Mr/Mrs
Database SQL
imutls, dlib, pyqt5, tkinter, opencv, pickle, pyodbc and sql server
6 References .......................................................................................................................... 42
1 Chapter # 1: Introduction
1.1 Introduction
Any project starts with the brief introduction. Chapter # 1 keeps brief introduction of Security
System for Person Identification Using Face Recognition for ISP as well as purpose of the
system, objectives of the system, product scope and software tools that are used to develop this
system.
Biometrics are study of science and technology measuring and examining biology. Biometrics are
referred by technologies that measure and examine the human body features such as DNA, Finger
prints and facial pattern for authentication. Face detection is a method which checks whether tha
face is present in the given image or not. If present then it return the image location and content
of every image. Face detection is the general case of face localization in which the locations and
sizes of a known number of faces (usually one) are interpreted. [1]
A facial recognition device is a device that takes an image or a video of a human face and
compares it to other image faces in a database. The structure, shape and proportions of the faces
are compared during the face recognition steps. In addition, distance between the eyes, nose,
mouth and jaw, upper outlines of the eye sockets, the sides of the mouth, location of the nose and
eyes, and the area surrounding the check bones are also compared. [2]
Automatic face recognition has been a challenging task for the research community. It has been
extensively adopted by the applications including biometrics, surveillance, security, identification,
and authentication. Face recognition usually exploit high-dimensional information which makes it
computationally intensive. In addition, wrong detected features can make the recognition process
even slower. [6]
The system is developed for Institute of Southern Punjab Multan. In this system the camera will
be placed at entrance area of university with the purpose of monitoring the individuals and will
detect the faces and compare with the dataset, provide outcome in the form of details which will
be inserted in database that are as follow:
Face ID
Registration # (Roll number of individual)
Monitoring cameras which are placed in entrance area are only for monitoring objective and not
doing any identification of individuals so, there is also risk of unknown person can enter in
organization. The existing system has some drawbacks as it does not contains much information
of Individual, and results are not satisfactory because it does not recognize the individual
accurately. The major disadvantages required special attention.
1.4 Purpose
The purpose of this project is to defining the security system that is known as biometric
verification based on face recognition. This security system’s goal will to authenticate the
individual on the basis of detecting and identify his or her face and also will tell whether he is
student, staff or visitor, his name, his registration # and also department of that individual. If the
individual will not recognized then he will be considered as unknown to the organization.
Gives facility of automatically identification of individuals. Uses real time face recognition so that
security problems and much time of security guards will be reduced. The product is limited to
only ISP entrance area.
The tools which are selected to implement the product are as follows:
Python’s Idle
Python
OpenCv library
Face recognition api
Dlib library
Imutils
Pickle library
Tkinter library
PyQT5 library
SQL server
Pyodbc library
The software requirements of the system that are used to run this system are as follows:
1. Windows 7, 8 10 Operating System
2. Drivers of Camera
3. Drivers of GPU
4. Display Drivers
5. USB Drivers
Weeks 1st 2nd 3rd 4th 5th 6th 7th 8th 9th 10th 11th 12th 13th 14th 15th 16th
Work
Planning
Design
Coding
Testing
Delivery
2.1 Introduction
This phase has the analysis of the system and literature review. In this chapter I explained the
existing system and compare with my proposed system based on features. I also mention my
proposed system through functional and non-functional requirements and did the comparison of
my system with the existing system.
The Entrance Security System through Face Recognition was implemented last year by Hussain
Ahmed in Institute of Southern Punjab Multan. The system take two entries, Face Id entry and
Student or Teacher or Visitor entry. The system make folders of Student, Teacher and Visitor.
Then during testing it gives output whether the person is student, teacher or visitor. The
problems in existing system of security system using face recognition there is no database to store
the information of user, also when adding user it does not require the information of user such as
name, registration number and department. The system cannot update the information of user if
required. The login page contains only login button if admin wants to change the password then
he/she cannot do it. The admin cannot check the dataset in the system through system. And the
method of face detection gives lot of false predictions because Haar Cascade is used in the system
and in recognition process there is Local Binary Pattern Histogram is used which is less accurate
and also requires lots of images for training.
My proposed system of security system (Security System for Person Identification Using Face
Recognition for ISP) keeps the information that is stored in the database when adding the user.
This system provides the update information of users. The system takes the information like
name, registration #, type and department. In this system the login page contains login function
logout function and admin can update the password. In this system it requires only one image to
train and gives perfect match with high accuracy because in this system face recognition module
is used which has 99.38 % accuracy of perfect matching.
Face detection is a method to find whether or not there are any faces in a given image (usually in
gray scale) and, if present, return the image location and content of each face. This is the first
step of any fully automatic system that analyzes the information contained in faces (e.g. identity,
gender, expression, age, race and pose). Face detection is a type of object class detection in
which the locations and sizes of all objects in an image that belong to a given class are found.
Face detection is the general case of face localization in which the locations and sizes of a known
number of faces (usually one) are interpreted. [1]
The method that is used for face detection in the existing system used Haar Cascade Classifier
which is used in object detection, and the method of face detection gives lot of false predictions.
A Haar Cascade is basically a classifier which is used to detect particular objects from the source.
The haarcascade_frontalface_default.xml is a haar cascade designed by OpenCV to detect the
frontal face. A Haar Cascade works by training the cascade on thousands of negative images with
the positive image superimposed on it. The haar cascade is capable of detecting features from the
source.
The other method to detect the face more accurately is Dlib, Dlib for face detection uses a
combination of HOG (Histogram of Oriented Gradient) & Support Vector Machine (SVM)
which is trained on positive and negative images (meaning there are images that have faces and
ones that don’t).This type of object detector is fairly general and capable of detecting many types
of semi-rigid objects in addition to human faces. The first step is to convert the input image to
gray scale. It only looks at the changes between light and dark areas in an image. It doesn’t need
color information. It takes a pixel and compares how dark this pixel is compared to the next
pixels around it and find out in which direction the biggest changes happened. [5]
In above the left pixel is lighter and the right pixel is darker. The direction for biggest change is
left to right.
If we repeat this process for every single pixel for an image then the image will turn into a map of
transition from light to dark areas. After placing every pixel the full gradient map is the simplified
version of the actual image. To detect a face all we need an overall structure of an image and
that’s what Hog does. [5]
The real-time face recognition system gets the testing images from the camera firstly, and then
determines the face’s information or the face ID. This process consists of two key steps: face
detection and face recognition. Only those images which really contain a face should be
recognized. Therefore, the system we proposed includes face detection and face recognition. We
get the interested face region by face detection and identify the face ID by face recognition. [3]
In the existing system, Local Binary Pattern Histogram (LBPH) is used. The basic idea of Local
Binary Patterns is to summarize the local structure in an image by comparing each pixel with its
neighborhood. Take a pixel as center and threshold its neighbors against. The main idea is to
divide the LBP image into local regions and extract a histogram from each. These histograms are
called Local Binary Patterns Histograms.
1. Present new image to the recognizer.
2. The recognizer creates a histogram for that new image.
3. The new histogram is compared with the histogram it already has.
4. Finally, it detects the best match and returns the student name associated with that best
match. [4]
The second method of face recognition is face recognition module which is created by Adam
Geitgey. Face recognition module is based on Resnet34 network architecture, which is the
Convolutional Neural Network’s architecture under Dlib library (created by Davis King) which is
part of face recognition module. It’s a C++ library and contains machine learning algorithms and
tools and can solve a real-world problem like face recognition. The network of face recognition
quantifies the faces, constructing 128d embedding (quantification) of each face. The network
itself was trained by Davis King on a dataset of ~3 million images. On the Labeled Faces in the
Wild (LFW) dataset the network compares to other state-of-the-art methods, reaching 99.38%
accuracy. [8] https://www.pyimagesearch.com/2018/06/18/face-recognition-with-opencv-python-
and-deep-learning/
It compares two images and perfectly predict if both images are the same person with 99.38 %
accuracy that is pretty good as compared to LBPH. [5]
The network architecture of face recognition module (RESNET) has 29 conv layers. It is a
version of RESNET34 from the Deep Residual Learning for Image Recognition by He, Zhang,
Ren. The model has an accuracy of 99.38% on the standard Labeled Faces in the Wild
benchmark. This is comparable to other state-of-the-art models and means that, given two face
images, it correctly predicts if the images are of the same person 99.38% of the time. [9]
Table 3 (Comparison of face recognition method)
The function requirements describe the functions of the system, where a function is described as a
specification of behavior between outputs and inputs. The functional requirements of the system
are as follows:
2.6.1 Admin
With the requirements of the system, admin can perform the actions that are defined below:
2.6.2 Login
User’s image is taken from the camera that detects the face of the user, takes face Id, user’s
information like name, registration number, type and department of the user that he/she belongs
to and store information of user into the database and the dataset of user will be placed on the
assigned path/ directory.
When assigning the path, then it will train the dataset by using Face Recognition Module.
2.6.6 Recognize
After training of dataset the recognizer will recognize the face and return the information of that
face from the database.
The admin can also able to see the dataset that he collected.
2.6.8 Logout
The logout function will take the admin to the login page.
The performance of the system is good, saves time and requires high level of specification of the
machine to perform best. It cannot handle the low specification of machine. It requires high level
of GPU and CPU to perform real time face recognition.
2.7.3 Usability
The usability of the system contains simplicity and it is very easily understandable.
2.7.4 Availability
The functions of the system are accessible and available to the admin.
2.7.5 Maintainability
The system can be easy to maintain if needed in future
2.7.6 Flexible
The system allows flexibility to update of modify if required in future.
Database No Yes
Logout No Yes
3.1 Introduction
The most important phase of any project is the designing of the logical data and database which
involve the designing of different diagrams. This chapter keeps the methodology which involves
in development of the system, contains Data Flow Diagram, USE case diagram and Entity
Relationship Diagram.
3.2 Methodology
Software development methodology is a framework that is used to structure, plan, and control
the process of developing an information system. This kind of development methodologies are
only concerned with the software development process, so it does not involve any technical
aspect of, but only concern with proper planning for the software development. Many
methodologies are used for software development some of them are fellows:
Waterfall Model
Spiral Model
V- Model
Iterative Model
Agile Model
When concerning with Advance projects like AI based projects many changes can be done
because of research or according to requirement, so to see this, I am using agile methodology in
my system because agile methodology is a practice which promotes continue interaction between
development and customer after every iteration of development. In the Agile method, the entire
project is divided into small incremental builds therefore customer easily see the product and
realize whether he is fulfilled or not that is why this is one of the benefits of this model.
Agile software development comprises various approaches to software development under which
requirements and solutions evolve through the collaborative effort of self-organizing and cross-
functional teams and their customer(s)/end user(s). It advocates adaptive planning, evolutionary
development, early delivery, and continual improvement, and it encourages rapid and flexible
response to change.
3.4.1 Planning
I held meeting with my supervisor of this project and gather the requirements. According to the
supervisor the existing system needed to changes some extent. All the requirements needed for
develop the system are gathered and analyze in this phase. I gather the requirement and write on
the paper, noted the requirements that the supervisor needed for this project.
3.4.2 Design
System design assists defining hardware and system needs which help in defining over all the
system architecture. In this system I designed different diagrams like use case, sequence and data
flow diagrams.
3.4.3 Development
Inputs from system design, stem is first developing in small program called units, in next phase
these units are integrated. Each unit is developed and tested for its functionality, are referred as
unit testing. In implementation, code is written to implement the design phase. The tool that is
used is Python’s idle.
3.4.4 Testing
Testing process cleans the system from errors. Software’s units are tested and debugged. The
system is achieved its goals and ready to use.
3.4.5 Release
The system is released according to deadline given from the supervisor. Also meet its aim.
The system is performing well and solved the problems that was received in the existing system of
security system using face recognition.
Design Description include Data Flow Diagram, Entity Relationship diagram, Sequence Diagram
and Use case diagram.
1. Login
2. Capture Faces
3. Processing\ Training
4. Recognize the images.
A data flow diagram shows the way information flows through a process or system. It includes
data inputs and outputs, data stores, and the various sub processes the data moves through.
DFDs are built using standardized symbols and notation to describe various entities and their
relationships. Data flow diagrams visually represent systems and processes that would be hard to
describe in a chunk of text. You can use these diagrams to map out an existing system and make
it better or to plan out a new system for implementation. Visualizing each element makes it easy
to identify inefficiencies and produce the best possible system. Components of DFD are as
follows:
1. External Entity
2. Data Flow
3. Process
4. Store
Individual
Flow of data
3.7.3 Process
3.7.4 Store
Act as storage area for two processes that occurs at different times.
Store
Entrance Area
3.8.3 Relationship
Relationship that links between different entities. Every relationship has name, also has cardinality
(optional, mandatory) and degree (binary, ternary).
3.8.4 Cardinality
The maximum number of possible relationship occurs for an entity that participate in the
relationship.
3.8.5 Degree
The number of entity types that are participating in the relationship.
3.8.6 Attributes
Within each entity, there can be more than one attribute. Attributes provide detailed information
about the concept. In a relational database, attributes are represented by the fields where the
information inside a record is held.
Business Rule
The admin must input the information of one or more individual. All the individual’s information
must be input by one admin.
Type of relationship: one to many.
Type of cardinality: one mandatory to many mandatory.
Type of Degree: Binary.
3.10 Database
A database is an application that manages data and allows fast storage and retrieval of that data.
A database is a collection of data which is organized in such a way that each piece of data is
available to those who need it and with minimum duplication of data. There are different types of
database but the most popular is a relational database that stores data in tables where each row in
the tables holds the same sort of information.
3.10.1 Advantages
2. Consistency of data
3. Data integrity
4. Sharing of data
5. Ease of application development
6. Uniform security, privacy and integrity controls
7. Reduced program maintenance
8. Improved data security
As per second normal form there must not be any partial dependency of any column on primary
key. It means that for a table that has concatenated primary key, each column in the table that is
not part of the primary key must depend on the entire concatenated key for its existence. If any
column depends only on one part of the concatenated then the table fails second normal form. All
the rules include first normal form and second normal form. No non-key field depends upon
another. All non-key fields depend only the primary key.
The rules include first normal form and second normal form. No non-key field depends upon
another
4.1 Introduction
After requirement and design is completed then implementation and evaluation phase starts, in
this phase the coding is started according to requirements and design that us discussed above, and
evaluation of the system, testing system against the requirements.
Figure 12 (login)
When entering into the main system admin must enter password and then take access of the
system.
The register face interface takes information of individual and will insert to the database.
Now the record that is inserted in register face interface is successfully inserted in database.
After registering the information it will register the face and put face into the dataset.
4.2.4 Dataset
Figure 19 (Dataset)
The faces that was captured above now placed into the dataset.
Update Information interface will take information and then update the information in database.
The face recognizer will recognize the face and show the information of that individual.
4.3 Evaluation
When the coding of the system is done, then it starts for evaluation of the system to make sure
that the functions are built are working correctly. The system is entirely tested, software testing is
an activity to check that the system whether it is performing according to needs and actual results
matches the expected results also ensures the system is freed from defect. Software testing is also
helps to check that whether there is errors or any lacking needs against the actual requirements.
So the developer detects the errors and corrects those errors until the system works correctly, so
he/she use testing of different types which are written below:
White Box Testing
Black Box Testing
Unit Testing
Integration Testing
System Testing
Regression Testing
In white box testing we understand the internal functionalities of the system, with white-box
testing, we have at least some idea of what is going on inside the software.
Test Cases
Table 9 (Test Case 1)
Black Box Testing is a software testing method in which testers evaluate the functionality of the
software under test without looking at the internal code structure.
Test Case
Table 16 (Black box Test Case 1)
The testing of an individual program or module is called unit testing. The objective is to identify
and eliminate execution errors that could cause the program to terminate. During unit testing,
programmers must test each part independently. Each module/function of this system is checked
to remove errors.
Testing one or more program is known as integration testing. In integration testing two or more
modules are dependent on each other. In this system, all the modules that depend on each other
are working finely.
After completing integration testing, system testing is performed which involves the entire
system. A system test includes all typical processing situations and is intended to assure users,
developers, and managers that the program meets all specifications and that all necessary features
have been included. Whole system is tested after integration testing. Complete system is working
properly and gives results that satisfy requirements.
Whenever programmer wants to change the features, regression testing is performed to ensure
that any modification cannot destroy the current functionalities. Regression testing is nothing but
a full or partially selection of already executed test-cases which are re-executed to ensure existing
functionality works fine. The system might not affected if do any changes.
5.1 Introduction
In this phase conclusion is briefly summarize the project and its goals.
5.2 Conclusion
Face Recognition Systems are going to have widespread application in the smart environment.
Security System for Person Identification Using Face Recognition for ISP was meant for
identification of the individuals which identify individuals based on personal characteristics with
the aim of face detection and recognition. The system gives the information when recognize the
face like he/she is a student, teacher, visitor or other staff member also gives the detail of
department to whom he/she belongs to and if the face is not recognized then it will be considered
as unknown to organization. The system is time saving and effective.
[1] S.Padmapriya & Esther Annlin KalaJames, "Real Time Smart Car Lock Security System
Using Face," jan 2012.
[2] Face RecogMichel Owayjan, Amer Dergham, Gerges Haber, Nidal Fakih, Ahmad Hamoush,
Elie Abdo, "Face Recognition Security System," dec,2013.
[3] Ren Meng, Zhang Shengbing, Lei Yi, Zhang Meng, "CUDA-based Real-time Face
Recognition System," 2014.
[4] SudhaNarang, Kriti Jain, MeghaSaxena, AashnaArora, "Comparison of Face Recognition
Algorithms Using Opencv for Attendance System," February 2018.
[5] Momtahina, Rakibul Hossain, Md. Mushfiqur Rahman,Onul Ashrafi Tania, "Image Capturing
and Automatic Face Recognition," January 2019.
[6] Danish Ali Chowdhry, Aqeel Hussain, Muhammad Zaka Ur Rehman, Farhan Ahmad, Arslan
Ahmad, Mahmood Pervaiz, "Smart Security System for Sensitive Area," 2013.
[7] H. Haris, "Automated attendance System through Face Recognition".
[8] https://www.pyimagesearch.com/2018/06/18/face-recognition-with-opencv-python-and-deep-
learning/
[9] http://blog.dlib.net/2017/02/high-quality-face-recognition-with-deep.html
[10] https://www.learnopencv.com/face-detection-opencv-dlib-and-deep-learning-c-python/