0% found this document useful (0 votes)
435 views

Facial

This document describes a facial recognition-based attendance monitoring system for educational institutions. The system uses a Raspberry Pi single-board computer equipped with a Pi camera to take photos of students' faces and identify them using facial recognition software. Student attendance is then automatically recorded in a database. Users can access attendance records through a web server hosted on the Raspberry Pi. The system aims to automate attendance tracking and resolve issues with previous manual systems.

Uploaded by

Hisham Maznan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
435 views

Facial

This document describes a facial recognition-based attendance monitoring system for educational institutions. The system uses a Raspberry Pi single-board computer equipped with a Pi camera to take photos of students' faces and identify them using facial recognition software. Student attendance is then automatically recorded in a database. Users can access attendance records through a web server hosted on the Raspberry Pi. The system aims to automate attendance tracking and resolve issues with previous manual systems.

Uploaded by

Hisham Maznan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 77

FACIAL RECOGNITION-BASED ATTENDANCE MONITORING

SYSTEM FOR EDUCATIONAL INSTITUTION

By
Tan Shu Jing

(15ACB03979)

Supervised by

MR. TEOH SHEN KHANG

A REPORT
SUBMITTED TO
Universiti Tunku Abdul Rahman
in partial fulfillment of the requirements
for the degree of
BACHELOR OF INFORMATION TECHNOLOGY (HONS)
COMPUTER ENGINEERING
Faculty of Information and Communication Technology
(Perak Campus)

JANUARY 2018
UNIVERSITI TUNKU ABDUL RAHMAN

REPORT STATUS DECLARATION FORM

Title: __________________________________________________________
__________________________________________________________
__________________________________________________________

Academic Session: _____________

I __________________________________________________________
(CAPITAL LETTER)

declare that I allow this Final Year Project Report to be kept in


Universiti Tunku Abdul Rahman Library subject to the regulations as follows:
1. The dissertation is a property of the Library.
2. The Library is allowed to make copies of this dissertation for academic purposes.

Verified by,

_________________________ _________________________
(Author’s signature) (Supervisor’s signature)

Address:
__________________________
__________________________ _________________________
__________________________ Supervisor’s name

Date: _____________________ Date: ____________________

i
FACIAL RECOGNITION-BASED ATTENDANCE MONITORING

SYSTEM FOR EDUCATIONAL INSTITUTION

By
Tan Shu Jing

(15ACB03979)

Supervised by

MR. TEOH SHEN KHANG

A REPORT
SUBMITTED TO
Universiti Tunku Abdul Rahman
in partial fulfillment of the requirements
for the degree of
BACHELOR OF INFORMATION TECHNOLOGY (HONS)
COMPUTER ENGINEERING
Faculty of Information and Communication Technology
(Perak Campus)

JANUARY 2018
DECLARATION OF ORIGINALITY

I declare that this report entitled “FACIAL RECOGNITION-BASED ATTENDANCE


MONITORING SYSTEM FOR EDUCATIONAL INSTITUTION” is my own work
except as cited in the references. The report has not been accepted for any degree and is not
being submitted concurrently in candidature for any degree or other award.

Signature : _________________________

Name : _________________________

Date : _________________________

iii
ACKNOWLEDGEMENTS

Upon completing this project, I would like to express my sincere expression towards my
supervisor, Mr. Teoh Shen Khang whom had given me unconditional support throughout this
project. Mr. Teoh had not only solved many of my encountered problems but also being very
concern about my project by giving me a lot of alternative options during dealing with the
project. The project couldn’t complete smoothly if it wasn’t his teaching dedication. Thank
you very much for assisting me throughout this project.

Apart from that, I would also like to send my thanks to my parents for being very supportive
in my hard times during conducting this project. Thank you for giving financial aids for the
equipment in this project. Also, special thanks to my siblings and my friend William for the
volunteer to provide their portrait to my project for the testing of my face database system. A
million thank you.

iv
ABSTRACT

The main purpose of this project is to build a face recognition-based attendance


monitoring system for educational institution to enhance and upgrade the current attendance
system into more efficient and effective as compared to before. The current old system has a
lot of ambiguity that caused inaccurate and inefficient of attendance taking. Many problems
arise when the authority is unable to enforce the regulation that exist in the old system. Thus,
by means of technology, this project will resolve the flaws existed in the current system while
bringing attendance taking to a whole new level by automating most of the tasks.

The technology working behind will be the face recognition system. The human face is
one of the natural traits that can uniquely identify an individual. Therefore, it is used to trace
identity as the possibilities for a face to deviate or being duplicated is low. In this project, face
databases will be created to pump data into the recognizer algorithm. Then, during the
attendance taking session, faces will be compared against the database to seek for identity.
When an individual is identified, its attendance will be taken down automatically saving
necessary information into a database system. At the end of the day, the attendance information
regarding an individual can be accessed from a web server hosted by the raspberry pi.

In short, this upgraded version of attendance monitoring system not only saved many
resources, but also provide huge convenience to the authority as many process are automated.

v
TABLE OF CONTENTS

FRONT COVER
REPORT STATUS DECLARATION FORM i
TITLE PAGE ii
DECLARATION OF ORIGINALITY iii
ACKNOWLEDGEMENT iv
ABSTRACT v
TABLE OF CONTENTS vi
LIST OF FIGURES ix
LIST OF TABLES xii
LIST OF ABBREVIATIONS xiii

CHAPTER 1 INTRODUCTION 1
1.1 Problem Statement and Motivation 1
1.2 Research Objectives 2
1.3 Project Scope and Direction 3
1.4 Impact, significance and contributions 3
1.5 Background Information 4
1.5.1 Project Field 4
1.5.2 Historical development prior to the project 5

CHAPTER 2 LITERATURE REVIEW 6

CHAPTER 3 SYSTEM DESIGN 9


3.1 Hardware Development 9
3.1.1 Raspberry Pi 3 set up procedure 9
3.1.2 Setting up the Raspberry Pi for use 11
3.1.2.1 Connecting to Raspberry Pi remotely 11
3.1.2.2 Installing OpenCV into the Raspberry Pi 11
3.1.2.3 Setting up the Pi Camera Module 12
3.2 Software Development 13
3.2.1 The creation of the face database 13

vi
3.2.2 The process of attendance taking 14

CHAPTER 4 SOFTWARE DEVELOPMENT 16


4.1 The creation of the face database 16
4.1.1 Specific requirements 16
4.1.2 Methodology 16
4.1.3 Flow Chart of the image acquisition process 18
4.1.4 Files included 20
4.1.5 Verification Test Plan 22
4.1.6 Implementation and Testing 23
4.2 The process of attendance taking 27
4.2.1 Specific requirements 27
4.2.2 Configuring system requirements 27
4.2.3 Configured Information 33
4.2.4 Methodology 34
4.2.5 Flow Chart of the attendance recording procedure 36
4.2.6 Files Included 37
4.2.7 Verification Test Plan 37
4.2.8 Implementation and Testing 38

CHAPTER 5 DATABASE AND WEBPAGE DEVELOPMENT 40


5.1 Database Development 40
5.1.1 Database Design 40
5.1.2 ER Diagram of the database 44
5.1.3 Relationship between the tables (in phpMyAdmin) 45
5.1.4 Database Analysis 45
5.2 Webpage Development 46
5.2.1 Service provided by the webpage 47
5.2.2 Webpage Analysis 53

CHAPTER 6 CONCLUSION 55
6.1 Project Review 55

vii
6.1.1 Personal Insight 55
6.1.2 Implementation Issue and Challenges 56
6.1.3 Contributions of this project 57
6.1.4 Further Developments 57
6.2 Conclusion 58

BIBLIOGRAPHY 59
PLAGIARISM CHECK RESULT 63

viii
LIST OF FIGURES

Figure Number Title Page


Figure 3.1.1 Raspberry Pi 3 GPIO Header
Figure 3.1.2 Connections of pi-fan and pi-camera on the raspberry
Pi3 board
Figure 3.1.3 Final assembled product
Figure 3.1.4 Operating system installer
Figure 3.1.5 Placement of micro SD card into the raspberry pi
Figure 3.1.6 Interface of the VNC Viewer
Figure 3.2.1 The system flow of the creation of face database
Figure 3.2.2 The system flow of the attendance taking procedure
Figure 3.2.3 Chart showing the service provided by the attendance
management system webpage
Figure 4.1.1 Image Acquisition and Pre-processing procedures
Figure 4.1.2 Hierarchy manner of the face database
Figure 4.1.3 Structure of the content in the csv file
Figure 4.1.4 Flow Chart of the image retrieval process
Figure 4.1.5 The relationships between the files during the face database
creation
Figure 4.1.6 Image provided by the AT&T Facedatabase
Figure 4.1.7 Sample images taken through the system’s pi camera
Figure 4.1.8 Interface displayed when prepare_gallery.sh is executed
Figure 4.1.9 Test result for invalid ID (1st attempt)
Figure 4.1.10 Test result for invalid ID (2nd attempt)
Figure 4.1.11 Test result for invalid ID (3rd attempt)
Figure 4.1.12 Test result for valid ID
Figure 4.1.13 Test result for invalid face capture
Figure 4.1.14 Test result for valid face capture
Figure 4.2.1 How Nginx works with PHP
Figure 4.2.2 Configuration steps for Nginx and PHP
Figure 4.2.3 Test page for the installation of Nginx
Figure 4.2.4 Test page for the configurations of Nginx with PHP
Figure 4.2.5 Configuration steps for MySQL and phpMyAdmin

ix
Figure 4.2.6 Login interface for phpMyAdmin
Figure 4.2.7 Configuration steps for Wordpress
Figure 4.2.8 Completed design of the webpage
Figure 4.2.9 Customization login page
Figure 4.2.10 Process flow of attendance taking through the webpage
Figure 4.2.11 Method of acquiring the portrait
Figure 4.2.12 Process flow of the facial recognition procedure
Figure 4.2.13 Flow chart of attendance recording procedure
Figure 4.2.14 Relationships between files for the attendance taking
process
Figure 4.2.15 Interface of the Record Attendance Page
Figure 5.1.1 Course Table Design View
Figure 5.1.2 Course Table Datasheet View
Figure 5.1.3 Student Table Design View
Figure 5.1.4 Student Table Datasheet View
Figure 5.1.5 Staff Table Design View
Figure 5.1.6 Staff Table Datasheet View
Figure 5.1.7 Course Timetable Table Design View
Figure 5.1.8 Course Timetable Table Datasheet View
Figure 5.1.9 Student Attendance Table Design View
Figure 5.1.10 Student Attendance Table Datasheet View
Figure 5.1.11 ER Diagram of the database
Figure 5.1.12 Relationship between the tables
Figure 5.2.1 Summary of the services provided by the Attendance
Management System webpage
Figure 5.2.2 Registration Forms tab in the UTAR Attendance System
webpage
Figure 5.2.3 4 Different registration forms in the UTAR Attendance
Management System webpage
Figure 5.2.4 Record Attendance interface on the UTAR Attendance
Management System webpage
Figure 5.2.5 Viewing Attendance Menu
Figure 5.2.6 Interface of View Attendance by Student
Figure 5.2.7 Interface of View Attendance by Subject
Figure 5.2.8 Login prompt from record attendance page
Figure 5.2.9 Login prompt from registration forms page

x
Figure 5.2.10 Login page into the UTAR Attendance System
Figure 5.2.11 Users created in Wordpress for this project
Figure 5.2.12 Staff Directory page
Figure 5.2.13 Student Directory page
Figure 5.2.14 Course Directory page

xi
LIST OF TABLES

Table Number Title Page


Table 4.1.1 Verification test plan for the creation of face database
Table 4.2.1 Verification test plan of the attendance taking process
Table 4.2.2 Input validation test towards Timetable ID (1st attempt)
Table 4.2.3 Input validation test towards Timetable ID (2nd attempt)
Table 4.2.4 Input validation test towards current date
Table 5.1.1 Field’s description in Course table
Table 5.1.2 Course table properties
Table 5.1.3 Field’s description in Student table
Table 5.1.4 Student table properties
Table 5.1.5 Field’s description in Staff table
Table 5.1.6 Staff table properties
Table 5.1.7 Field’s description in Course Timetable table
Table 5.1.8 Course Timetable table properties
Table 5.1.9 Field’s description in Student Attendance table
Table 5.1.10 Student Attendance table properties

xii
LIST OF ABBREVIATIONS

Abbreviations Description
CSV Comma Separated Values
GPIO General Purpose Input/ Output
GTK Graphical User Interface Toolkit
GUI Graphical User Interface
HDMI High Definition Multimedia Interface
I/O Input/ Output
ICT Information & Communication
ID Identification
IoT Internet of Things
IP Internet Protocol
LBPH Local Binary Patterns Histograms
LED Light Emitting Diode
NFC Near Field Communication
NOOBS New Out of Box Software
OS Operating System
RFID Radio Frequency Identification
SD Secure Digital
VGA Video Graphics Array
VNC Virtual Network Computing
Wi-Fi Wireless Fidelity
YML YAML Ain’t Markup Laguage
PHP Hypertext Processor
SQL Structured Query Language
FYP Final Year Project
HTTP Hypertext Transfer Protocol
FastCGI Fast Common Gateway Interface
ER Diagram Entity Relationship Diagram

xiii
Chapter 1: Introduction

This is a project about Facial Recognition-Based Attendance Monitoring System for


Educational Institution. In this chapter, the problem and motivation, research objectives,
project scope, project contributions and the background information of the project will be
discussed in detail.

1.1 Problem Statement and Motivation

According to the previous attendance management system, the accuracy of the data
collected is the biggest issue. This is because the attendance might not be recorded personally
by the original person, in another word, the attendance of a particular person can be taken by
a third party without the realization of the institution which violates the accuracy of the data.
For example, student A is lazy to attend a particular class, so student B helped him/her to sign
for the attendance which in fact student A didn’t attend the class, but the system overlooked
this matter due to no enforcement practiced. Supposing the institution establish an
enforcement, it might need to waste a lot of human resource and time which in turn will not
be practical at all. Thus, all the recorded attendance in the previous system is not reliable for
analysis usage. The second problem of the previous system is where it is too time
consuming. Assuming the time taken for a student to sign his/her attendance on a 3-4 paged
name list is approximately 1 minute. In 1 hour, only approximately 60 students can sign their
attendance which is obviously inefficient and time consuming. The third issue is with the
accessibility of those information by the legitimate concerned party. For an example,
most of the parents are very concerned to track their child’s actual whereabouts to ensure
their kid really attend the classes in college/school. However in the previous system, there are
no ways for the parents to access such information. Therefore, evolution is needed to be done
to the previous system to improve efficiency, data accuracy and provides accessibility to the
information for those legitimate party.

BCS (HONS) Computer Engineering 1


Faculty of Information and Communication Technology (Perak Campus), UTAR
1.2 Research Objectives

In order to solve the drawbacks of the previous system stated in 1.1, the existing
system will need to evolve. The proposed system will reduce the paper work where
attendance will no longer involve any manual recording. The new system will also reduce the
total time needed to do attendance recording. The new system will acquire individual
attendance by means of facial-recognition to secure data accuracy of the attendance.
The followings are the objectives of this project:

▪ To develop a portable Smart Attendance System which is handy and self-powered.


▪ To ensure the speed of the attendance recording process is faster than the previous
system which can go as fast as approximately 3 second for each student.
▪ Have sufficient memory space to store the database.
▪ Able to recognize the face of an individual accurately based on the face database.
▪ Allow parents to track their child’s attendance.
▪ Develop a database for the attendance management system.
▪ Provide a user friendly web interface for admins to access the attendance database and
for non-admins (parents) to check their child’s attendance.
▪ Allow new students or staff to store their faces in the database by using a GUI.
▪ Able to show an indication to the user whether the face- recognition process is
successful or not.

BCS (HONS) Computer Engineering 2


Faculty of Information and Communication Technology (Perak Campus), UTAR
1.3 Project Scope and Direction

The main intention of this project is to solve the issues encountered in the old attendance
system while reproducing a brand new innovative smart system that can provide convenience
to the institution. In this project, a smart device will be developed which is capable of
recognising the identity of each individuals and eventually record down the data into a
database system. Apart from that, a website will be developed to provide visual access to the
information. The followings are the project scopes:

▪ The targeted groups of the attendance monitoring system are the students and staff of
an educational institution.
▪ The database of the attendance management system can hold up to 2000 individual’s
information.
▪ The facial recognition process can only be done for 1 person at a time.
▪ There will be two types of webpage interface after the login procedure for the admins
and the non-admins respectively.
▪ The project has to work under a Wi-Fi coveraged area, as the system need to update
the database of the attendance system constantly.
▪ The smart device is powered up by power bank to improve the portability of the
device.

1.4 Impact, significance and contributions

Many attendance management systems that exist nowadays are lack of efficiency and
information sharing. Therefore, in this project, those limitations will be overcome and also
further improved.

The impact and the contribution of this project is as follow:

▪ Students will be more punctual on attending classes. This is due to the attendance of a
particular student can only be taken personally where any absentees will be noticed by
the system. This can not only train the student to be punctual as well as avoids any
immoral ethics such as signing the attendance for their friends.

BCS (HONS) Computer Engineering 3


Faculty of Information and Communication Technology (Perak Campus), UTAR
▪ The institution can save a lot of resources as enforcement are now done by means of
technology rather than human supervision which will waste a lot of human resources
for an insignificant process.
▪ The smart device can operate at any location as long as there is Wi-Fi coverage which
makes the attendance system to be portable to be placed at any intended location. For
an example, the device can be placed at the entrance of the classroom to take the
attendance.
▪ It saves a lot of cost in the sense that it had eliminated the paper work completely.
▪ The system is also time effective because all calculations are all automated.

In short, the project is developed to solve the existing issues in the old attendance system.

1.5 Background Information

1.5.1 Project Field


The project is developed based on the IoT (Internet of Things) concept where smart
device is used to manage systems. IoT is generally about numerous device being
interconnected uniquely in the existing internet infrastructure where information are shared
among them. It can be viewed as a nervous system that links anything or everything together.
It is usually achieved using sophisticated sensors and chips which are embedded in the
physical things for real-time information retrieval. Data collected will then be analysed where
intelligent decision will be taken by machines without human intervention to either solve the
existing problem or to improve the current situation. In short, the IoT technology enhances
many existing system to be more efficient and smarter.

The application area of this project is involved in the smart cities sub-field. Smart
cities is a development vision using Information & Communication technology (ICT) in
urban advancement where city’s assets will be managed by smart devices to improve
efficiency and also to reduce human resource consumption. By integrating these concepts, a
Smart attendance monitoring system will be developed.

BCS (HONS) Computer Engineering 4


Faculty of Information and Communication Technology (Perak Campus), UTAR
1.5.2 Historical development prior to the project

Back in the years, attendance management system in school/colleges was done by


manual reporting where the student’s attendance were recorded by placing a mark or
signature beside their name in a name list to indicate their presence in a particular class.
While the staff in the institution will report their attendance through the punch card machine
which also have to be done manually. Later on, some of those attendance systems had
evolved into using smart cards to replace signature markings where each students/staff will
be required to report their attendance using a smart card embedded with a unique
identification chip.

BCS (HONS) Computer Engineering 5


Faculty of Information and Communication Technology (Perak Campus), UTAR
Chapter 2: Literature Review

Traditionally attendance was taken manually which is very time consuming and often
leads to human error. Additionally, there are many uncertainties towards the sources of the
attendance records which in fact, most of the attendance records are not retrieved from the
actual situation. The old method that uses paper sheets for taking student’s attendance can no
longer be used. Based on the research, there are many solutions that are available to solve this
issue.

According to research journal “Attendance System Using NFC Technology with


Embedded Camera on Mobile Device” (Bhise, Khichi, Korde,Lokare, 2015). The attendance
system is improved by using Near Field Communication (NFC) technology and mobile
application. According to the research paper, each student is given a NFC tag that has a
unique ID during their enrolment into the college. Attendance of each class will then be taken
by touching or moving these tags on the lecturer mobile phone. The embedded camera on the
phone will then capture the student’s face to send all the data to the college server to do
validation and verification. The advantages of this method is where the NFC is simple to use,
and the speed of connection establishment is very high. It indeed speeds up the attendance
taking process a lot. However, this system couldn’t automatically spot the violation when the
NFC tag is not personally tagged by the original owner. Apart from that, the convenience of
the system which uses the mobile phone as the NFC reader was actually an inconvenience to
the lecturer. Imagine if the lecturer had forgotten to bring their mobile phones to work, what
would be the backup procedure for the attendance to be recorded? Moreover, most of the
lecturer will not likely to prefer their personal smart phones to be used in this way due to
privacy matter. Hence, unique information about the student like biometrics or face-
recognition, which is guanine for a student should be used in replacement of the NFC tag.
This will ensure attendance to be taken originally by the actual student.

The second research journals “Face Recognition Based Attendence Marking System”
(Senthamil Selvi, Chitrakala, Antony Jenitha, 2014) is based on the identification of face-
recognition to solve the previous attendance system’s issues. This system uses camera to
capture the images of the employee to do face detection and recognition. The captured image
is compared one by one with the face database to search for the worker’s face where
attendance will be marked when a result is found in the face database. The main advantage of

BCS (HONS) Computer Engineering 6


Faculty of Information and Communication Technology (Perak Campus), UTAR
this system is where attendance is marked on the server which is highly secure where no one
can mark the attendance of other. Moreover, in this proposed system, the face detection
algorithm is improved by using the skin classification technique to increase the accuracy of
the detection process. Although more efforts are invested in the accuracy of the face detection
algorithm, the system is yet not portable. This system requires a standalone computer which
will need a constant power supply that makes it not portable. This type of system is only
suitable for marking staff’s attendance as they only need to report their presence once a day,
unlike students which require to report their attendance at every class on a particular day, it
will be inconvenient if the attendance marking system is not portable. Thus, to solve this
issue, the whole attendance management system can be developed on an embedded design so
that it can be work similarly with just batteries that makes it portable.

The third research journal “Fingerprint Based Attendance System Using


Microcontroller and LabView” (Kumar Yadav, Singh, Pujari, Mishra, 2015) proposed a
solution of using fingerprint to mark the attendance. This system is using 2 microcontrollers
to deal with the fingerprint recognition process. Firstly, the fingerprint pattern will be
obtained through a fingerprint sensor, then the information will be transmitted to
microcontroller 1. Next microcontroller 1 will pass the information to microcontroller 2 to do
the checking with the database that resides in it. After finding a student’s match, the details
are sent to the PC through serial communication to be displayed. This design is good as it
accelerates development while maintaining design flexibility and simplifies testing. But
again, this system is attached to a PC which make it not portable. Other than that, the
database information cannot be accessible easily. Meaning that, for the parents whom are
interested in knowing their child’s attendance cannot easily or conveniently access the
information. Therefore, to provide accessibility of the student’s information to the legitimate
concerned party, the information can be uploaded to a web server for easy access. While the
authentication for the appropriate access can be enforced through a login screen.

According to the forth research journal “RFID based Student Attendence System”
(Hussain, Dugar, Deka, Hannan, 2014), the proposed solution is almost similar to the first
research journal where RFID technology is used to improve the older attendance system. In
this system, a tag and a reader is again used as a method of tracking the attendance of the
students. The difference between the first journals with this is where attendance’s information
can be accessed through a web portal. It provides more convenient for information retrieval.

BCS (HONS) Computer Engineering 7


Faculty of Information and Communication Technology (Perak Campus), UTAR
Again, this system is imperfect in the sense that, firstly, it is not portable, as the RFID reader
can only work when it is connected to a PC. Secondly, the RFID tag is not a guanine
information that can uniquely identify a student, thus, resulting in the inaccuracy of the
collected attendance information.

In conclusion, a better attendance monitoring system should be developed based on its


portability, accessibility and the accuracy of the collected attendance information.

BCS (HONS) Computer Engineering 8


Faculty of Information and Communication Technology (Perak Campus), UTAR
Chapter 3: System Design
The design part of the attendance monitoring system is divided into two
sections which consist of the hardware and the software part. Before the software part can be
developed, the hardware part is first completed to provide a platform for the software to
work. In the hardware part, the process of the raspberry pi’s setup configuration will be
briefly explained in this chapter. While in the software development part, there will be two
major process flow which will be further discussed in Chapter 4.

3.1 Hardware Development

The hardware used in this project so far consists of only 4 components which are:
▪ Raspberry Pi 3
▪ Raspberry Pi 8mp Camera Module
▪ Power Supply Cable
▪ 16Gb Micro SD Card Class 10

3.1.1 Raspberry Pi 3 set up procedure

When the raspberry pi 3 first arrived, its casing, pi-fan, and the pi camera are not
assembled. Thus, the first thing to do is to screw the pi-fan in place on the casing provided
and next secure the pi board onto the
casing by again tightening it with
screws. For the fan to work, it’s end
has to be connected to a 5v pin and a
ground pin which are pin 4 and pin 6
respectively with the red-wired
connector to pin 4 and black-wired
connector to pin 6. Then, assemble
the pi camera onto the raspberry pi by
first lifting up the camera port’s tab
which is located between the Ethernet
and HDMI ports on the raspberry pi to
loosen it up, next insert the pi camera
Figure 3.1.1 Raspberry Pi 3 GPIO Header connector into the port with the silver
(element14 community, 2017)

BCS (HONS) Computer Engineering 9


Faculty of Information and Communication Technology (Perak Campus), UTAR
surface on the camera’s connector facing the HDMI port. After that, push the port’s tab
downwards to secure the connection. Finally, assemble the casing and the final product is
shown in Figure 3.1.3.

Figure 3.1.2 Connections of pi-fan and pi-camera Figure 3.1.3 Final assembled product
onto the raspberry pi 3 board

After the hardware is assembled, it is ready to install the appropriate operating system
into the raspberry pi. The installation process starts by downloading NOOBS (New Out of
Box Software) from the raspberry pi official website into the micro SD card. Then the micro
SD card is inserted into the micro SD slot located below the raspberry pi board.

Figure 3.1.4 Operating system installer (Raspberry


Pi Foundation, 2017)
Figure 3.1.5 Placement of micro SD card into
the raspberry pi

The next step would be the installation of Raspbian operating system (OS) into the
raspberry pi. The raspberry pi is connected to a monitor via the HDMI slot on the raspberry pi
through the HDMI converter to the VGA port on the monitor for display. Then, a mouse and
a keyboard are connected to the raspberry pi via the USB ports to provide communication
platform between the raspberry pi. Finally, the raspberry pi is powered up and the
initialization is completed by following the on-screen instruction.

BCS (HONS) Computer Engineering 10


Faculty of Information and Communication Technology (Perak Campus), UTAR
3.1.2 Setting up the Raspberry Pi for use

3.1.2.1 Connecting to Raspberry Pi remotely

Before the raspberry pi can be accessed from a remote device through the connection
of wifi, initial setup has to be done for future convenience. Therefore, when the desktop first
appeared after the initialization process mentioned in the previous section, the Wi-Fi is turned
on to obtain wifi connection from the hotspot provided by a mobile phone. This is to allow
the raspberry pi to remember the entered password for that particular Wi-Fi, so that in the
future, the raspberry pi will automatically connect to the wifi on its start-up. Then, a remote
access software such as VNC Viewer is installed onto the laptop. Upon connecting the
raspberry pi to the remote viewer software (VNC Viewer) on the laptop, the raspberry pi has
to be in the same network as the laptop, then the connection progress can be done by just
entering the IP address of the raspberry pi into the VNC Viewer.

Figure 3.1.6 Interface of the VNC Viewer

3.1.2.2 Installing OpenCV into the Raspberry Pi

In this project, OpenCV is used to do facial recognition where the whole program will
be coded in Python Language. The installation of OpenCV is merely not enough, therefore,
OpenCV is installed with Python bindings to bridge Python and C++ in OpenCV. In short,
the binding is crucial to enable the calling of a C++ function from Python. The following is a
brief walkthrough on the installation process that had done:

BCS (HONS) Computer Engineering 11


Faculty of Information and Communication Technology (Perak Campus), UTAR
3.1.2.3 Setting up the Pi Camera Module

After installing the Pi Camera Module onto the raspberry pi board, the next step is to
enable the camera module. Before being able to do that, the raspberry pi firmware is being
updated first. Then, the camera module is being enabled by going into the configuration menu
at the terminal. Next, the raspberry pi is rebooted. In order for python to interact with the pi
camera, a picamera module with NumPy array support is installed. This is due to OpenCV
takes images as NumPy arrays.

BCS (HONS) Computer Engineering 12


Faculty of Information and Communication Technology (Perak Campus), UTAR
3.2 Software Development

There are two major system flows in the software development section as shown below:

▪ The creation of the face database


▪ The process of attendance taking

Both process mentioned above are essential because they made up the backbone of the
attendance management system. In this section, the process of both flows will be briefly
described. Meanwhile, their full functionality, specific requirements and also the
methods/approach to accomplish such objectives will be discussed in the upcoming chapter.

3.2.1 The creation of the face database

Portrait Acquisition Face Detection


The image of the student’s The captured image will first
face will be captured for a undergo a face detection
specific amount to be algorithm to ensure the system
stored into the files on the can identify a face in every
raspberry pi. portrait.

Creation of CSV file Portrait Pre-processing


Then, by using the path of the stored Captured image with a
image, a csv file is created with each confirmed face detected in it
image being labelled accordingly. The will then undergo cropping,
csv file is created to aid the process of colour conversion before
list insertion of the portraits with their actually being stored into
corresponding labels. the files.

Training the Recognizer Save the Trained Data


The images in the created list retrieved After the training process is done, the
from the csv will then be pumped into a trained sets of data will be stored into a
recognizer which is the EigenFace (.yml) file which will be retrieved during the
Recognizer (a library provided by recognition process to ensure the training
OpenCV) to do the training. process are only done for the minimum time.

Figure 3.2.1: The system flow of the creation of face database

The face database is an important step to be done before any further process can be
initiated. This is because the face database acts as a comparison factor during the recognition
process which will be discussed in later section. In the process above, a csv file is created to
aid the process of image labelling because there will be more than one portrait stored for each
student, thus, in order to group their portraits under the name of the same person, labels are

BCS (HONS) Computer Engineering 13


Faculty of Information and Communication Technology (Perak Campus), UTAR
used to distinguish them. After that, those images will be inserted into a recognizer to do its
training. Since the training process is very time consuming as the face database grew larger,
the training is only done right after there is a batch of new addition of student’s portraits to
ensure the training is done as minimum as possible.

3.2.2 The process of attendance taking

Access the Attendance Management


Initiate Python script
System Website
After receiving the button click action
The attendance taking session can be
from the lecturer done in the webpage, a
started after the lecturer selected the
python script will be initiated called
related date and timetable ID for the
from a bash file.
current class session

Acquire Portrait Load the trained data


The system will then start to capture In the python script, the first step
student’s portraits and then undergo is to load the trained data (.yml)
the same pre-processing routine and file which is saved during the
face detection process. face database creation process.

Recognise the faces Mark the attendance


Valid portraits will then be After identifying the appropriate student
compared against the loaded from the capturing process, a record of the
gallery from the recognizer to current attendance will be added into the
identify the captured faces. attendance table managed by a database.

Figure 3.2.2: The system flow of the attendance taking procedure

Other than the creation of face database, the rest of the remaining process can all be
done through a webserver. Thus, the attendance taking procedure will also be done through a
web server. This is to provide a friendly user-interface to the user (lecturer) while being able
to conduct an execution on the raspberry pi to do attendance taking without the need to
control the raspberry pi from a terminal which will be ambiguous for most user. Therefore,
just with a click of button on the webpage, a python script will be executed which it will
launch a series of initialization such as loading the trained data to the recognizer and etc. The
attendance taking process will then proceed in a loop to acquire, identify and mark the
attendance for each of the students that is obtained from the pi camera. In chapter 4, every
step in both of the process flow above will be explained in detailed on its accomplishment.
However, for the whole system to store the data effectively, a database using MySQL will be
created to store every single piece of related information in a proper manner so that during

BCS (HONS) Computer Engineering 14


Faculty of Information and Communication Technology (Perak Campus), UTAR
the data retrieval process, information can be easily tracked or filtered to be displayed. The
detailed description of the database created will be further elaborated in chapter 5. Apart from
the database development, another important component which is the website development
will also be further discussed in the same chapter. In this project, the website acts as a
platform for the user to communicate with the database which is stored in the raspberry pi.
The following figure describes the service provided by the designed webpage:

Attendance Management
System Webpage

Record Attendance View Attendance Add data into the database


Lecturer can select the The recorded attendance Data such as course
appropriate date and can be retrieved from the details, staff/ students
timetable ID related to database and viewed in details and also timetable
the current class session two different forms which details can be added into
to initiate the attendance is either by student database by means of
recording process. (accessible by anyone) or friendly user interface.
by subject (only accessible
by lecturer)

Allow logins for authorized user


Authorized user such as the staffs and webpage owner have different levels of authorized
capability to do amendments to the database or webpage. While non-authorized user can
view only some of the pages in the websites and can never interfere with the database.
This is to allow parents/students as non-administrator to only bound to the viewing of the
attendance record and lecturer as staff authorized user to initiate the attendance taking
process and lastly only authorised user with the webpage owner priority can make
amendments to the design of the webpage.

Figure 3.2.3: Chart showing the service provided by the attendance management system webpage

BCS (HONS) Computer Engineering 15


Faculty of Information and Communication Technology (Perak Campus), UTAR
Chapter 4: Software Development

4.1 The creation of the face database

4.1.1 Specific requirements

There will be several requirements to achieve the creation of the face database. The below are
the required software or packages needed to accomplish this objective.

Required software: OpenCV 3.4, Python 3


Required packages: tkinter package - To provide user interface
picamera module – To interact with the raspberry pi’s camera

4.1.2 Methodology

Before the attendance management system can work, there are a set of data needed to
be inputted into the system which essentially consist of the individual’s basic information
which is their ID and their faces. The first procedure of portrait acquisition can be done by
using the Raspberry Pi Camera to capture the faces of the individual. In this process the
system will first detect the presence of a face in the captured image, if there are no face
detected, the system will prompt the user to capture their face again until it meets certain
number of portraits which will be 10 required portraits in this project for each student. The
decision of storing only 10 portrait per student is due to the consideration of the limited
storage space in the raspberry pi because the total amount of students in the university is
considered heavy. Then, the images will undergo several pre-processing procedures to obtain
a grayscale image and cropped faces of equal sized images because those are the pre-
requisites of using the EigenFaces Recognizer. Both of the processes mentioned above can be
represented in the diagram below.

Face Detection in
image

Pre-processing Store it into


Cropping the face, respective
grayscale it, resize it files

Figure 4.1.1: Image Acquisition and Pre-processing procedures

BCS (HONS) Computer Engineering 16


Faculty of Information and Communication Technology (Perak Campus), UTAR
After the images are being processed, they are stored into a file in a hierarchy manner.
In this project, all the faces will be stored in a hierarchy manner under the ‘database’ folder.
When expanding through the database folder, there will consist of many sub-folders which
each of them will represent an individual where a series of face portrait belonging to the same
individual will be stored in that particular sub-folder. The sub-folders that represent each
individual will be named upon the ID no. of that individual which is unique for every single
individual in the institution. The whole process of image retrieval, pre-processing, storing
mechanism is done by the script named create_database.py.

database
|----- 1503979
| |----- 0.pgm
| |----- 1.pgm
| |----- 2.pgm
| | ....
| |----- 9.pgm
|----- 1543268
| |----- 0.pgm
| |----- 1.pgm
| | ….
| |-----9.pgm
| ….
| ….
|----- 1613765
|----- 0.pgm
| ….
|----- 9.pgm

Figure 4.1.2: Hierarchy manner of the face database

After a successful retrieval of facial images into the respective folder, a CSV file is
created to aid the next process of pumping the faces into the recognizer for the training
process. The creation of the CSV file will be done based on a script named create_csv.py. In
this project, the content of CSV file will look like the following format:

database/1503979/0.pgm;0
Base Folder Sub-folder Image File Label
Represents each
individual in one
sub-folder. Named by
their ID.

Figure 4.1.3: Structure of the content in the csv file

BCS (HONS) Computer Engineering 17


Faculty of Information and Communication Technology (Perak Campus), UTAR
After having sufficient images in the database, those images will then be inserted into
a training mechanism. There are generally 3 different types of training mechanism provided
in OpenCV 3.4 which are EigenFaces, FisherFaces, and Local Binary Patterns Histograms
(LBPH). The recognizer that will be focused in this project will be the EigenFaces
recognizer. The concept behind EigenFaces is simple – it recognizes a particular face by
catching the maximum deviation in a face and then turning those identified variations into
information to be compared when a new face arrives. In the training process, the csv file will
be read to provide the path to all of the images where those images and labels will be loaded
into a list variable. Then, the list will be passed into the training function where the training
process will take a measurable time to run. The larger the face database, the longer the time
will be needed to train those images. In this project there are 40 subjects, which will provide
400 images to be trained that takes approximately 50 seconds for the training session.
Imagine if the system holds 5000 students there will be 50,000 images in total to be trained
which might takes up roughly 1.30 hours to complete the training process. Therefore, to
maintain the efficiency of the system, a .yml file will be saved after the training process so
that during the recognition process, only the .yml file will be loaded instead of repeating the
whole training process.

4.1.3 Flow Chart of the image acquisition process

The development of the face database is an important phase before any facial
recognizing process can be carried out. It acts as a library to compare against with whenever
the system wanted to identify a person. In the image retrieval process, the system will first
prompt for an input from the user to enter their ID number. The system will then validate the
entered input and then check for duplication in the system. In order to proceed, the entered
input must contain only 7 digits of number. Apart from that, the ID inputted have to be a non-
registered ID to ensure no duplication. After that, a directory is created for each individual
where their portraits will be stored inside of it. It is a compulsory to store 10 portraits per
person in the file. After the acquisition of image is done, the images undergo a pre-processing
before storing it into the respective folder.

BCS (HONS) Computer Engineering 18


Faculty of Information and Communication Technology (Perak Campus), UTAR
Figure 4.1.4: Flow Chart of the image retrieval process

The above flowchart is only the program flow for the image acquisition process which
describes the program flow for the script create_database.py. There are two more python
scripts that responsible for the remaining execution which will be explained in the next sub-
section.

BCS (HONS) Computer Engineering 19


Faculty of Information and Communication Technology (Perak Campus), UTAR
4.1.4 Files included
There are in total 3 python scripts, 1 bash file, 1 csv file, 1 yml file and 1 folder
needed in the face database creation part. 3 of the python scripts will be included in the bash
file for 2 reasons. Firstly, it is to provide convenience to the user whenever they wanted to
register images for new students. By running those script in bash, the user can avoid some
ambiguous steps such as tuning to the cv environment before the script is being able to run
from terminal because the bash file will handle the environment tuning. Secondly, the csv file
creation and also the training process can be automated after the images are added. This
function is crucial as it forces the yml file to be up to date before any recognition process is
done just in case the user mistakenly missed this step.

Python scripts: create_database.py, create_csv.py, train_faces.py


Bash file: prepare_gallery.sh (stored in /usr/local/bin/)
CSV file: faceDirectory.csv (stored in the database folder)
Yml file: trained_data.yml
Folder name: database *All the files mentioned can be found in the cd

The following diagram will explain the relationships between these files.
Process Flow prepare_gallery.sh Store images in created
Call the following scripts folder with the name of
Portrait Acquisition student’s ID

Create folder in
Face Detection create_database.py database

Portrait Pre-processing

Create file
Creation of CSV file create_csv.py faceDirectory.csv

Training the Recognizer


Create file
train_faces.py Trained_data.yml

Save the trained data

Figure 4.1.5: The relationships between the files during the face database creation

BCS (HONS) Computer Engineering 20


Faculty of Information and Communication Technology (Perak Campus), UTAR
Here, the sample images of the faces used in this project are the faces downloaded
from the internet. This is due the insufficient reluctance of real person to join the testing
community. Thus, this problem is solved by using the downloaded faces to form the face
database while adding some of the real images captured from the system’s pi camera to
prepare the database for verification test. The specific face database being used is named
AT&T Facedatabase which can be obtained from http://www.cl.cam.ac.uk/research/dtg/
attarchive/facedatabase.html. In the provided database, there are 40 different subjects each
with 10 sets of their very own portrait captured at a different timeline. This database consists
of subjects with different expressions such as a smiling or frowning and etc. Apart from that,
some of the subjects have different variation on their face such as wearing glasses in some of
their portraits. Therefore, this database is relatively applicable to this system since the
required amount of sample portrait for each person by this system is also similar as the
provided amount of portrait by the downloaded database.

Figure 4.1.6: Images provided by the AT&T Facedatabase (AT&T Laboratories Cambridge, 2002)

Figure 4.1.7: Sample images taken through the system’s pi camera

BCS (HONS) Computer Engineering 21


Faculty of Information and Communication Technology (Perak Campus), UTAR
4.1.5 Verification Test Plan
The system uses dialog box interface (supported by tkinter package) to communicate with the
user which is designed to have as minimum input as possible from the user to reduce the need
of heavy validation. The designed interface is also user friendly because buttons are provided
to aid the process flow of the system. In this section, there are only 2 times of input prompt
from the system where the first is for the input ID and the portrait of the new user.

Testcase Status
No. Description Test Type Test Values Test Output
Name (pass/fail)

An error box
appeared stating
Input value more
1 ‘12345678’ that ‘Length of ID pass
than 7 digits.
number can only
be 7 digits!’

An error box
Input value
appeared stating
2 This test is include alphabetic ‘123abc7’ pass
performed to that ‘Invalid ID
character.
Test check whether number entered’
Input ID the ID typed An error box
by the user is Input ID that is appeared stating
3 valid or not. ‘1600001’ pass
already existed. that ‘ID number
existed’

Input value that A notice box


have 7 numerical appeared stating
4 digits which is not ‘1503979’ that ‘Directory is pass
existed in the created
database. successfully’

An error box
Captured image Capture a appeared stating
5 pass
has no face blank image that ‘No face
This test detected!’
performed is
to ensure the An error box
Move while
captured Captured image is appeared stating
6 the image is pass
image motion blur. that ‘No face
taken.
Test
contains a face detected!’
Image
which is The person is Capture the An error box
Capture
detected by standing too close portraits 5cm appeared stating
7 the system pass
during the away from the that ‘No face
before storing capturing process. pi camera. detected!’
it into the face
database Capture an A notice box
Captured image image with a appeared stating
8 pass
has a face. person facing that ‘1 portrait
the pi camera saved!’

Table 4.1.1: Verification test plan for the creation of face database

BCS (HONS) Computer Engineering 22


Faculty of Information and Communication Technology (Perak Campus), UTAR
4.1.6 Implementation and Testing
The followings are the implementation test and its results produced during the creation of
face database in the raspberry pi.

Interface of dialog box when the prepare_gallery.sh bash file is executed:

Figure 4.1.8: Interface displayed when prepare_gallery.sh is executed

Invalid input ID (Existed ID) test:

ID already existed

Figure 4.1.9: Test result for invalid ID (1 st attempt)

BCS (HONS) Computer Engineering 23


Faculty of Information and Communication Technology (Perak Campus), UTAR
Invalid input ID (ID consist alphabet) test:

Invalid ID

Figure 4.1.10: Test result for invalid ID (2 nd attempt)

Invalid input ID (ID longer than 7) test:

12345678 Invalid ID

Figure 4.1.11: Test result for invalid ID (3rd attempt)

BCS (HONS) Computer Engineering 24


Faculty of Information and Communication Technology (Perak Campus), UTAR
Valid input ID (ID valid and not exist) test:

Figure 4.1.12: Test result for valid ID

Portrait Capture (No Face) test:

Figure 4.1.13: Test result for invalid face capture

BCS (HONS) Computer Engineering 25


Faculty of Information and Communication Technology (Perak Campus), UTAR
Portrait Capture (Normal) test:

Figure 4.1.14: Test result for valid face capture

BCS (HONS) Computer Engineering 26


Faculty of Information and Communication Technology (Perak Campus), UTAR
4.2 The process of attendance taking

4.2.1 Specific requirements

There will be several requirements before the process of attendance taking can be initiated.
The below are the required software or packages needed to accomplish this objective.

Required software: OpenCV 3.4


Python 3
PHP5-fpm – To display webpage of the hosted website by the pi
PHPMyAdmin – To aid database configuration
MySQL – To create an attendance management system database
Nginx – To allow the raspberry pi to host website
Wordpress – To aid the webpage design
Required packages: picamera module – To interact with the raspberry pi’s camera
pymysql module – To be able to interact with MySQL with python

4.2.2 Configuring system requirements


Before proceeding to the methodology discussion, there are quite a number of
installations and configurations needed to be done in order for the system to work. In this
section, the procedure of the entire linkage configurations between the required software
packages such as PHP 5, PHPMyAdmin, MySQL, Nginx and Wordpress will be focused. A
brief explanation and reasons of selection of those software packages will also be discussed
later.
In this project, the process of attendance taking will be initiated through a webpage
hosted by the raspberry pi. In order to achieve that, the raspberry pi will firstly need a HTTP
Web Server to allow itself to host websites. The planned selection of the web server during
FYP1 was the Apache web server. However, in this project, the web server being used is
Nginx. This is due to the easier configuration of Nginx and also its ability to manage heavy
loads more effectively than Apache. For raspberry pi which is a relatively resource limited
device, it is more suitable to use Nginx as it is better at handling the resource distribution
making it more effective. However, the only drawback while considering Nginx was its
incapability to handle dynamic content. Although in this project, the ability to process
dynamic content is very much needed at one of the design phase, but, these requirements can
be easily overcome by sending the request to another software.

BCS (HONS) Computer Engineering 27


Faculty of Information and Communication Technology (Perak Campus), UTAR
fetch
Browser Nginx PHP 5 Content

Figure 4.2.1: How Nginx works with PHP


Next, the raspberry pi also need a platform for web development where PHP 5 will be
needed to act as server scripting language to communicate with webpages hosted by the
raspberry pi. By implementing it, Nginx can be configured to serve content through PHP
where the webpage content will be stored in the raspberry pi. Since Nginx is used in this
project, PHP5-fpm is needed to run as FastCGI interface with Nginx. As for the webpage
development, Wordpress is one of the most suited software to deal with webpage designs
because firstly, it is supported by raspberry pi. Secondly, the web editing process can be done
on a virtual host which is remotely accessed through the platform decorated by Nginx and
PHP, this made the development process much more convenient. Thirdly, Wordpress
provides fabulous webpage interface with numerous plugins which can be installed whenever
needed to aid the building of the webpage interface. Also, Wordpress allows drag and drops
feature during designing the webpage. At last but not least, the database used by Wordpress
can be easily linked to a PHPMyAdmin account to view and perform various amendments to
the data. While in PHPMyAdmin, databases can be created and managed easily. Thus, the
attendance management system database can be created and stored using PHPMyAdmin and
then by using Wordpress, its data can be easily retrieved and displayed in the intended
manner in the website. Finally, MySQL is needed to manage the database stored in the
raspberry pi. The reason why MYSQL is chosen to be used is because of its high software
maturity, in simple words, it is widely used and accepted. Other than that, there are plenty of
forums available on the internet making it a very practical choice whenever a database
management system is ever needed.
Configuration steps (Step 1: Installing Nginx and PHP):

Download and Configure Nginx and PHP


install Nginx Edit the configuration file so that Nginx can listen to
port 80 for IPv4 and IPv6. Then add configurations
in the file to allow Nginx to handle PHP files by
using a socket method. Then change the value of the
path info to 0 in the initialization file of php5.
Download and
install PHP5-fpm
Test the
package Reload Nginx and PHP
configuration
Figure 4.2.2: Configuration steps for Nginx and PHP

BCS (HONS) Computer Engineering 28


Faculty of Information and Communication Technology (Perak Campus), UTAR
The configurations can be tested by entering the IP address of the raspberry pi to the web
browser on any device that is connected to the same network as the raspberry pi. Throughout
this project, the localhost address being used is 192.168.43.232. Apart from that, the root file
where all the PHP files and index pages are stored at this path /var/www/html/. To test the
above configurations the index.php file should be placed under the root file which is in the
html folder.

Figure 4.2.3: Test page for the installation of Nginx

Figure 4.2.4: Test page for the configurations of Nginx with PHP

BCS (HONS) Computer Engineering 29


Faculty of Information and Communication Technology (Perak Campus), UTAR
Configuration steps (Step 2: Installing MySQL and PHPMyAdmin):

Refer to section 4.2.3(a)

Enter a root password for MySQL which


Download and install will be used later to grant permission for
MySQL-server PHPMyAdmin to connect with MySQL-
server on the pi.

Execute MySQL secure


installation

Create a new Database user in


MySQL to allow access in
PHPMyAdmin. To do this, login Download and install python
to the MySQL on the pi through bindings for MySQL through the
the terminal and run the virtual environment. The python
“GRANT ALL PRIVILEDGES” bindings being used in this project is
command to create a new user. PyMySQL.
Then quit it.

Refer to section 4.2.3(b)

Download and install


PHPMyAdmin

Enter the created root During the setup, there will be


password to allow another prompt for a phpMyAdmin
PHPMyAdmin to password. This password is needed to
communicate with the access the phpMyAdmin interface
MySQL-server. later on the web browser.

Test the Configure Nginx to use


configurations with phpMyAdmin.

Figure 4.2.5: Configuration steps for MySQL and PHPMyAdmin

After the above steps are done, the interface of phpMyAdmin is now accessible from the web
browser again, from any devices which is connected in the same network as the raspberry pi.
PhpMyAdmin is installed in the root file (/var/www/html/), thus, during accessing its
interface on the browser, the path http://192.168.43.232/phpmyadmin is entered to reach the
login interface of phpMyAdmin. During the login, the username is set to ‘root’ and the
password prompted is second one that is created during the setup. All the configured
usernames and passwords for this project will be summarized in the upcoming sub-section.

BCS (HONS) Computer Engineering 30


Faculty of Information and Communication Technology (Perak Campus), UTAR
Figure 4.2.6: Login interface for phpMyAdmin

Configuration steps (Step 3: Installing and setting up Wordpress with phpMyAdmin)

Download and Extract


Wordpress on the
raspberry pi Configure the
Wordpress’s .config
file in the pi by entering
the created username
Create a new database and password to get
and user account in the them connected.
phpMyAdmin page.

Refer to section 4.2.3(c)


Make all the files in Wordpress
owned under Nginx user to
automate every update.

Refer to section 4.2.3(d)

Start customizing webpages Install Wordpress through


from Wordpress’s interface the internet browser and
webpage through the browser. then login to Wordpress.

Figure 4.2.7: Configuration steps for Wordpress

By connecting Wordpress and phpMyAdmin, the webpage information is held in


phpMyAdmin. It can be easily accessed by logging into the phpMyAdmin page. In this
project, Wordpress is installed to the root path /var/www/html/wordpress where an additional
folder named Wordpress is created in the root path to hold all of its information. Thus,
Wordpress can be accessed from the browser by typing http://192.168.43.232/wordpress.
There are two phases in the development of the website. One is where the website already has

BCS (HONS) Computer Engineering 31


Faculty of Information and Communication Technology (Perak Campus), UTAR
pages which are publicized, while the other is still under construction with none of the pages
being publicized. In the first condition, the webpage can be accessed by typing the above-
mentioned web path. This is to allow unauthorised user to view the webpage, while
authorized user can access the customization page by logging in from the webpage.
However, in the second condition where there are no displayable webpages, in order to access
the Wordpress’s dashboard to do customization, the following web path http://192.168.43.
232/wordpress/wp-admin is needed instead. This path will direct the user to the login page of
Wordpress where authorized admins can enter the password to customize the webpage.

Figure 4.2.8: Completed design of the webpage

Figure 4.2.9: Customization login page

BCS (HONS) Computer Engineering 32


Faculty of Information and Communication Technology (Perak Campus), UTAR
4.2.3 Configured Information

In this project, many usernames and password are created during the configuration process,
the below are the configured information.

(a) MySQL root user


Password: mysql123abc

(b) New user created to login to PHPMyAdmin


Username: root
Password: phpmyadmin123abc

(c) New user account to store Wordpress’s database


Username: wordpress
Host: localhost
Password: 5julKmzJZe9pxtqx

(d) Wordpress root user


Email: [email protected]
Password: 5ul0CVfYJZ!RwUcnlx

(e) Wordpress staff user


Email: [email protected]
Password: q0grkfYjIPf@cf0Tot9uHJ&r

The followings are the summarized file path and web path for this project.
Root file in raspberry pi: /var/www/html/
PhpMyAdmin file: /var/www/html/phpmyadmin
Wordpress file: /var/www/html/wordpress
Access path to phpmyadmin web interface: http://192.168.43.232/phpmyadmin
Access path to wordpress web interface: http://192.168.43.232/wordpress
Access path to wordpress login page: http://192.168.43.232/wordpress/wp-admin
*Note: These web paths are only accessible by devices that are connected to the same
network as the raspberry pi. Meaning the website can only be accessed locally. In order for
them to be accessed outside the network, port forwarding mechanism can be done to allow
this. However, in this project, there are no administrative power to use the university’s
network.
BCS (HONS) Computer Engineering 33
Faculty of Information and Communication Technology (Perak Campus), UTAR
4.2.4 Methodology
After the all the configurations are done, the website now is available for use and thus
users such as the lecturer can start taking down attendance simply by just accessing the
“Record Attendance” tab in the Attendance Management System website. However, in
order for user to access this tab, he/she has to be authorized to do so by logging in into the
system as a “contributor” role (will be further explained in Chapter 5). After logging into the
respective tab, the user will be prompted to select the current timetable ID from a table and
also select the current date to start the attendance taking process. When the user selected the
“submit” button a .php file called student_attendance.php will be called which a python script
named record_attendance.py will be executed from the .php file. In this
student_attendance.php file, two variables which are the timetable ID and the current date
(passed by POST method from the html) will be passed into the python script upon calling it.
Webpage
Record Attendance Php Script
Student_attendance.php

Execute

Python Script
Record_attendance.py

Figure 4.2.10: Process flow of attendance taking through the webpage

The facial-recognition process is started when the python script is executed. When the
script is first executed, variables are initialized and most importantly, the .yml file created
previously during the recognizer training process is now loaded into the system. After the
system is loaded with the intended data, the process of capturing student faces is initiated.
Firstly, all the students are advised to stand approximately 20cm away from the attendance
taking device (packaged pi camera + raspberry pi) with their face remained parallel to the pi
camera. Usually this can be done by ensuring the eye position is same level as the pi camera.

20cm

Figure 4.2.11: Method of acquiring the portrait

BCS (HONS) Computer Engineering 34


Faculty of Information and Communication Technology (Perak Campus), UTAR
During the capturing process, students are advised to remained still for approximately 3s for a
higher rate of successful recognition. After the portrait is successfully acquired from the pi
camera, the system will start to do face detection to ensure a face is presence before
proceeding to the pre-processing process. During the pre-processing process, images are
cropped and converted to grayscale. Then, it is pumped into the trained recognizer to identify
the identity of the captured face. If the face captured is valid meaning that the detected face is
present in the student database, the system will return a label corresponding to the identified
person in the face database. Then, by using the label, the student’s ID number can be
retrieved since in the face database, student’s portraits are distinguished and grouped using
their ID number. After that, the individual’s attendance will be recorded into the
attendance database which is specifically the student_attendance table. However, before
adding the record into the table, the student ID and the related information will be checked
against the table to ensure there are no redundant attendance added into the table. Apart from
that, the Green LED will be triggered when a capture is valid, else the Red LED will be
triggered. Finally, the attendance information in the database can be viewed through the
Attendance Management System website at the “Attendance” tab.

Image acquisition
The student’s/staff’s portrait are captured
through a Raspberry Pi Camera Module
during attendance taking.
Repeat the process again when a face is detected

Image pre-processing
The image undergoes face detection
algorithm, being cropped and etc.

Identify the person Return student ID


Cropped face is inserted into Eigen
Face Recognizer to identify the
identity of the individual.
Check for existence
The student ID, timetable ID and
current date are being used to
search whether the table already
recorded this information. If
Mark Attendance record is present, the system will
A record of presence will be created not add the record again.
in the student’s database
(student_attendance table) to
indicate his/her presence.

Figure 4.2.12: Process flow of the facial recognition procedure

BCS (HONS) Computer Engineering 35


Faculty of Information and Communication Technology (Perak Campus), UTAR
4.2.5 Flow Chart of the attendance recording procedure

Since the face database are downloaded from the internet, thus to test whether the face
recognizer is working, facial images were manually pumped into the code to check for
identification. However, the following flow chart will explain the intended process flow of
the face recognition process.

START

Images = []
Labels = []
idList =[]
Read data from the csv file

True
len(Images) Output
<= 1 error_msg

False

gallery = cv2.face.createEigenFaceRecognizer()
gallery.load(“trained_data.yml”)

Input im_face

label= gallery.predict(im_face)

foundID = idList[label]

Exist
Check ID existence in the database

Not Exist

Add foundID, timetable_ID,


cur_date into database

Figure 4.2.13: Flow Chart of attendance recording procedure

BCS (HONS) Computer Engineering 36


Faculty of Information and Communication Technology (Perak Campus), UTAR
4.2.6 Files Included
In this section, there are only 1 php file, 1 bash file, 1 python script and 1 yml file used to
execute the attendance taking process. The followings are the related files and their storage
path.

PHP file: student_attendance.php (stored in /var/www/html/wordpress)


Bash file: runcv_env.sh (stored in /usr/local/bin)
Python script: record_attendance.py
Yml file: trained_data.yml *All the files mentioned can be found in the cd

The php file is the first file that will be called after the user clicked the submit button to start
the attendance taking process. Then, in the php file, a bash file will be executed where the
values entered by the user will also be passed in into the bash file. The bash file will then
again tune the environment to cv environment before executing the python script. During the
execution of the python script, the values passed into the bash file will also be passed into it.
The following diagram explains the relationship between these files.
trained_data.yml
load
execute execute
student_attendance.php runcv_env.sh record_attendance.py

Figure 4.2.14: Relationships between files for the attendance taking process

4.2.7 Verification Test Plan


During the attendance taking process which is conducted on the webpage, the user (lecturer)
is required to enter the current timetable ID and date before the process can be initiated. Thus,
the validation is done through the php file where it will produce an error page if the inputs
entered are invalid.

Testcase Status
No. Description Test Type Test Values Test Output
Name (pass/fail)

Invalid entered
This test is Input value have
input! Timetable
1 performed to more than 7 ‘12345678’ pass
Test ID must be 7
check digits.
input digits long.
whether the
Timetable Invalid entered
Timetable
ID Input value have input! Timetable
2 entered is ‘123456’ pass
valid or not less than 7 digits. ID must be 7
digits long.

BCS (HONS) Computer Engineering 37


Faculty of Information and Communication Technology (Perak Campus), UTAR
Timetable ID
Input value
9999999 doesn’t
3 doesn’t exist in ‘9999999’ pass
exist in the
the database.
database.

Input value that


have 7
4 numerical digits ‘1000001’ No error page. pass
which existed in
the database.

This test is Error! Please


performed to Doesn’t select select a date
5 - pass
check any date. before
whether the submitting.
Test
user select a
input
date before
date
starting the
6 attendance Selected a date ‘9/4/2018’ No error page. pass
taking
process.

Table 4.2.1: Verification test plan of the attendance taking process

4.2.8 Implementation and Testing


The followings are the implementation test and its results produced during the attendance
taking process.

Interface of the “Record Attendance” page

Figure 4.2.15: Interface of the Record Attendance Page

BCS (HONS) Computer Engineering 38


Faculty of Information and Communication Technology (Perak Campus), UTAR
Invalid
Input of
Timetable
Less than 7 digits
ID

Results

Table 4.2.2: Input validation test towards Timetable ID (1st attempt)

Non-Exist
Input of
Timetable
ID ID doesn’t exist

Results

Table 4.2.3: Input validation test towards Timetable ID (2nd attempt)

Invalid
Input of
Current
Date Unselected Date

Results

Table 4.2.4: Input validation test towards current date

BCS (HONS) Computer Engineering 39


Faculty of Information and Communication Technology (Perak Campus), UTAR
Chapter 5: Database and Webpage Development

5.1 Database Development


5.1.1 Database Design

Course Table (Table name: Course)

Course Table Design View (in phpMyAdmin)

Figure 5.1.1: Course Table Design View

Course Table Datasheet View (in phpMyAdmin)

Figure 5.1.2: Course Table Datasheet View

Field Name Description


sub_ID Identification number for a subject
sub_name Name of a subject
Table 5.1.1: Field’s description in Course table

Field Name Data Type Field Length Nulls PK/FK Reference to


sub_ID Varchar 15 No PK -
sub_name Varchar 100 No - -
Table 5.1.2: Course table properties

BCS (HONS) Computer Engineering 40


Faculty of Information and Communication Technology (Perak Campus), UTAR
Student Table (Table name: Student)
Student Table Design View (in phpMyAdmin)

Figure 5.1.3: Student Table Design View


Student Table Datasheet View (in phpMyAdmin)

Figure 5.1.4: Student Table Datasheet View

Field Name Description


stu_ID Identification number for a student
stu_name Name of a student
stu_fac Faculty of the student
Table 5.1.3: Field’s description in Student table
Field Name Data Type Field Length Nulls PK/FK Reference to
stu_ID integer 7 No PK -
stu_name Varchar 50 No - -
stu_fac Varchar 10 No - -
Table 5.1.4: Student table properties

Staff Table (Table name: Student)


Staff Table Design View (in phpMyAdmin)

Figure 5.1.5: Staff Table Design View

BCS (HONS) Computer Engineering 41


Faculty of Information and Communication Technology (Perak Campus), UTAR
Staff Table Datasheet View (in phpMyAdmin)

Figure 5.1.6: Staff Table Datasheet View

Field Name Description


stf_ID Identification number for a staff
stf_name Name of a staff
stf_fac Faculty of the staff
stf_dpt Department of the staff
Table 5.1.5: Field’s description in Staff table
Field Name Data Type Field Length Nulls PK/FK Reference to
stf_ID integer 7 No PK -
stf_name Varchar 50 No - -
stf_fac Varchar 10 No - -
stf_dpt Varchar 200 No - -
Table 5.1.6: Staff table properties

Course Timetable Table (Table name: course_timetable)


Course Timetable Table Design View (in phpMyAdmin)

Figure 5.1.7: Course Timetable Table Design View

BCS (HONS) Computer Engineering 42


Faculty of Information and Communication Technology (Perak Campus), UTAR
Course Timetable Table Datasheet View (in phpMyAdmin)

Figure 5.1.8: Course Timetable Table Datasheet View


Field Name Description
timetable_ID Identification number for a specific timetable (Auto-increment)
sub_ID Identification number of the related subject
stf_ID Identification number of the staff incharge
day Day of the current session
timestart Time Start of the current session
timeend Time End of the current session
session Session of the subject
Table 5.1.7: Field’s description in Course Timetable table
Field Name Data Type Field Length Nulls PK/FK Reference to
timetable_ID integer 7 No PK -
sub_ID Varchar 15 No FK Subject(sub_ID)
stf_ID integer 7 No FK Staff(stf_ID)
day Varchar 10 No - -
timestart Varchar 5 No - -
timeend Varchar 5 No - -
session Varchar 3 No - -
Table 5.1.8: CourseTimetable table properties

Student Attendance Table (Table name: student_attendance)


Student Attendance Table Design View (in phpMyAdmin)

Figure 5.1.9: Student Attendance Table Design View

BCS (HONS) Computer Engineering 43


Faculty of Information and Communication Technology (Perak Campus), UTAR
Student Attendance Table Datasheet View (in phpMyAdmin)

Figure 5.1.10: Student Attendance Table Datasheet View


Field Name Description
num Index number of this table (Auto-increment)
timetable_ID Identification number of the related timetable
stu_ID Identification number of the student
attnd_date The date where this attendance is taken
Table 5.1.9: Field’s description in Student Attendance table
Field Name Data Type Field Length Nulls PK/FK Reference to
num integer 100 No PK -
Course_timetable
timetable_ID integer 7 No FK
(timetable_ID)
stu_ID integer 7 No FK Student(stu_ID)
attnd_date Varchar 10 No - -
Table 5.1.10: Student Attendance table properties

5.1.2 ER Diagram of the database

Figure 5.1.11: ER Diagram of the database

BCS (HONS) Computer Engineering 44


Faculty of Information and Communication Technology (Perak Campus), UTAR
5.1.3 Relationship between the tables (in phpMyAdmin)

Figure 5.1.12: Relationship between the tables

5.1.4 Database Analysis

From the designed database above, there are reasons for the creation of every table. In
an institution attendance management system, the main focus is on the staff and students.
Thus, the Student and Staff tables are created to store their basic information. In most
institution, every student is attending classes based on their registered course which are
conducted according to the arranged sessions. While different students can be taking the same
subject in the same semester but are conducted at a different time session. Therefore, there is
a need to store the information of every class sessions according to the subjects so that the
system can track the exact class session that the students had attended. Thus, the
course_timetable table is created to manage that. After having almost every relevant tables
created, another table is needed to store the attendance information of the students which will
be the student_attendance table.
The three main parent tables in this database are the Course, Student and Staff
responsible to hold basic information for the subject details, student’s information and staff’s
information respectively. While there are two child tables in this database which are made up
of the course_timetable table and the student_attendance table. In the course_timetable
table, information of different class session of a particular subjects are stored. In this table, 2
referenced keys are assigned to connect this table with another two tables which are the
sub_ID (connecting it to the Course table) and stf_ID (connecting it to the Staff table). While
in the student_attendance table, there are 3 important elements being stored for each
attendance record which are the stu_ID, timetable_ID and the attnd_date. The timetable_ID
and the stu_ID are connected to the course_timetable table and Student table respectively.

BCS (HONS) Computer Engineering 45


Faculty of Information and Communication Technology (Perak Campus), UTAR
5.2 Webpage Development
5.2.1 Services provided by the Webpage

Attendance Management System Webpage

Add data into Record View Allow logins for


the database Attendance Attendance authorized user

Figure 5.2.1: Summary of the services provided by the Attendance Management System webpage

Based on the chart above, there are in total four types of different utility provided by
the Attendance Management System webpage. In Chapter 4, the setup procedure of the
website is reviewed and the access path to this website is also discussed in detail. In this
Chapter, the created webpage which are hosted by the raspberry pi by Wordpress will be
illustrated and explained here. Since the website created is connected to the database which
can be accessed from the phpMyAdmin page, the ultimate goal provided by this website is to
allow the user (usually the staff or lecturer) to communicate with the database without the
need to access the phpMyAdmin page nor the raspberry pi. And by logging in into the
system, various actions such as adding records to the table, viewing the records and
filtering the intended records can all be performed through the webpage at ease.

Adding data into the database:


In this section, there are 4 different pages created in Wordpress to deal with this service. By
considering what data are needed to be stored into the database, the created database at the
previous section will provide a rough idea of what is needed. By looking back to the previous
section, there are three major parent tables which consist of Course, Student and Staff. Thus,
the details for these three tables are guaranteed to be obtained from the input interface of the
website. Then, the course_timetable table also needed its data to be inputted by a user (staff)
to arrange class sessions for each subject. The followings are the requirements.
▪ Able to input course details into the Course table
▪ Able to input student details into the Student table
▪ Able to input staff details into the Staff table
▪ Able to input timetable details for each class session into the course_timetable table

BCS (HONS) Computer Engineering 46


Faculty of Information and Communication Technology (Perak Campus), UTAR
The followings are the created interface pages for this purpose.

Figure 5.2.2: Registration Forms tab in the UTAR Attendance System webpage

BCS (HONS) Computer Engineering 47


Faculty of Information and Communication Technology (Perak Campus), UTAR
Figure 5.2.3: 4 Different registration forms in the UTAR Attendance Management System webpage

Attendance Recording:
There is a page in this website specifically designed to initiate a python script containing the
recognition algorithm during the attendance taking process is started. But before that could
happen, flashing back to the previous section, the student_attendance table require 3
elements to make a record which are the student ID, timetable ID and also the current date.
Thus, in this page, the user (lecturer) will be required to enter the related timetable ID and

BCS (HONS) Computer Engineering 48


Faculty of Information and Communication Technology (Perak Campus), UTAR
current date, so that, those values can be passed into the python script and then executed to be
stored into attendance table. The following is the created interface.

Figure 5.2.4: Record Attendance interface on the UTAR Attendance Management System webpage

Attendance Viewing:
After the attendance is being recorded into the database, the next requirements is to be able to
retrieve it. By considering what different user are interested in the form of data to be
displayed, it appears that the lecturer are more interested to view the attendance by the
subjects they teach whilst, students are more interested to view their own attendance for each
of the subjects they registered. Therefore, the attendance viewing page is designed to have
two different access methods.
▪ View attendance by Student ID
▪ View attendance by Subject ID (only accessible by lecturer)

BCS (HONS) Computer Engineering 49


Faculty of Information and Communication Technology (Perak Campus), UTAR
The followings are the created interface for the purpose.

Figure 5.2.5: Viewing Attendance Menu

Figure 5.2.6: Interface of View Attendance by Student

Figure 5.2.7: Interface of View Attendance by Subject

BCS (HONS) Computer Engineering 50


Faculty of Information and Communication Technology (Perak Campus), UTAR
Authorized User Login:
In this project, the attendance management system webpage designed is protected by
authorized logins. Some of the pages are not accessible by a non-authorized user such as the
“Record Attendance” page and “Registration Forms” page. When either one of this page is
clicked by the user, the following interface will appear to prompt for a login.

Figure 5.2.8: Login prompt from record attendance page

Figure 5.2.9: Login prompt from registration forms page

As for authorized user, they can easily login into the system by either clicking on the orange
“LOGIN” word or by choosing the “ADMIN LOGIN” tab which a login page will then
appear as below.

Figure 5.2.10: Login page into the UTAR Attendance System

BCS (HONS) Computer Engineering 51


Faculty of Information and Communication Technology (Perak Campus), UTAR
Apart from that, in the authorized user category, there are two different authorized users with
different access priority. To be able to gain full control on the customization of the webpage,
the user have to login as the “root” user, whereas the “contributer” type user can only access
both the record attendance and registration forms page to record attendance or communicate
with the database. This user is not allowed to make any changes to the design of the webpage.
Usually, the “root” user will be held by the website owner while the “contributor” user will
be held by the staff or lecturer in the institution. As the “root” user, he/she has the power to
create more “contributor” users. The Email and Password for both of the mentioned users
can be obtained in Chapter 4 (4.2.3 (d)) & (4.2.3 (e)).

Figure 5.2.11: Users created in Wordpress for this project

Other Pages:
Apart from the pages created above, there are 3 additional pages created just for viewing
purpose where the records in the database can be viewed here.
▪ Staff Directory page
▪ Student Directory page
▪ Course Directory page
The Staff and Student Directory pages only display a direct Staff and Student tables from the
database, whilst in the Course Directory page, it allows user to enter a specific Subject ID to
enable the viewing of all its timetable details.

Figure 5.2.12: Staff Directory page

BCS (HONS) Computer Engineering 52


Faculty of Information and Communication Technology (Perak Campus), UTAR
Figure 5.2.13: Student Directory page

Figure 5.2.14: Course Directory page

5.2.2 Webpage Analysis


Most of the webpage content are displayed by Wordpress, however some of the webpage
have filtering functions that are actually executed from a php file where query is used to filter
the required data from the database. In this project, all the created php files are stored under

BCS (HONS) Computer Engineering 53


Faculty of Information and Communication Technology (Perak Campus), UTAR
the path /var/www/html/wordpress in the raspberry pi. The followings are the corresponding
php file working behind the service provided by the webpage.

Registration Forms:
▪ Course Registration Form  student_details.php
▪ Course Timetable Form  timetable_details.php
▪ Staff Registration Form  staff_details.php
▪ Student Registration Form  student_details.php
Attendance:
▪ View Attendance by Student  show_attendance.php
▪ View Attendance by Subject  show_course_attendance.php
Record Attendance  student_attendance.php
Course Directory  show_timetable.php

*Note: All the php files above can be found in the attached cd.

BCS (HONS) Computer Engineering 54


Faculty of Information and Communication Technology (Perak Campus), UTAR
Chapter 6: Conclusion
6.1 Project Review
After conducting this project, attendance can now be taken with a portable mini box
(raspberry pi + pi camera) in a Wifi coverage area. This technology can reduce the effort of
enforcing students to attend classes as everything is automated. Since Wifi coverage is not a
problem for most of the institution, by using a mobile phone, the lecturer can enter the current
class session’s information into the Attendance Management System Webpage hosted by the
raspberry pi to start the attendance taking process. This had provided convenience not only to
the lecturer but also to the students because the attendance taking process for a class of
approximately 100 students can be done in 5 minutes which is way more faster than the old
method of passing attendance sheet around in the classroom which created a lot of issues to
the institutions and inconvenience to the students. Other than that, this system provides
excellent graphical interface to the user. Data accessing can be easier nowadays simply by
logging in into the webpage where searching of a record can be done easily. This also reduces
the need of the lecturer to keep on entering the attendance record manually into the system.

6.1.1 Personal Insight


The raspberry pi is indeed a very powerful portable device that can perform many
tasks to solve our every day’s life problem. It is not only a mini computer, but it also allows
embedded systems to work where huge computers are no longer needed to navigate simple
yet helpful task. Throughout this project, I’ve learnt that building and hosting an own website
is totally possible. I am a big fan of website design and development thus, it is a little
unfortunate that I didn’t manage to create a domain name for the webpage, however, it is
possible to get it done without charges, thus, I would definitely explore more about this in the
future to make use of this advantage. Although raspberry pi has limited resources, however
its portability is the best thing to ever exist because I can actually manage or work on the
project anywhere I want. Apart from that, I’ve learnt that phpMyAdmin is a very useful tool
for managing a database, it provides a lot of convenient to me throughout the development of
this project because it reduced the need to communicate with the database using sql language
which can be disastrous if I am not fluent enough to handle it. Overall, this project had given
me the chance to discover the world that can barely exist in the class. The thirst for solving
each and every problem encountered in this project had made me acquire determinations

BCS (HONS) Computer Engineering 55


Faculty of Information and Communication Technology (Perak Campus), UTAR
towards responsibilities. If I am ever given the chance to work on such projects with a larger
scales in the future, I will definitely take a leap into it.

6.1.2 Implementation Issue and Challenges


During the development of the project, there are several issues that cause minor
hindrance to the development. Initially, a GUI is created to aid the user for storing their
portrait for the formation of face database. To achieve that, an external library called guizero
is downloaded to aid the creation of the GUI. However, there are many limitations to this
library as it does not support the view of other image file type except for .gif image file type.
Therefore, images cannot be displayed through the window. Besides that, there are many
restrictions on the layout of the GUI window which makes the created interface undesirable.
Thus, the usage of guizero is abandoned in later times which is then replaced by Tkinter.
Apart from that, before being able to test out the recognizer, there are insufficient
faces in the created database as there are only a small amount of volunteer willing to help out
to form the face database. However, this problem is overcome by doing some research on the
internet which came out with the solution of using a pre-prepared face database that are
downloadable from the internet. The downloaded face database is normalized and greyscaled,
thus making the testing process very convenient.
However, in this project, the website developed can only be accessed locally by
devices that are using the same network as the raspberry pi. This is due to the lack of
administrative power to alter the institution’s networking system. But, it is feasible/possible
for the raspberry pi to gain access from an outer network if there is allowance from the
authority to allow implementation of the port forwarding configuration.
It is also very challenging while dealing with the pre-processing of the captured
image. Fortunately, those problems can be resolved by surfing through the internet for
recommended solutions. In short, developing a face recognition system can be very easy
when there is sufficient background knowledge of how those process worked because most of
the complicated algorithm are provided in the library itself which only requires understanding
in order to be able to integrate it into the developing system.

BCS (HONS) Computer Engineering 56


Faculty of Information and Communication Technology (Perak Campus), UTAR
6.1.3 Contributions of this project
The attendance taking process had never been an easy task to every institution. The
old method of using paper to collect the attendance had created numerous troubles to the
institution. However, with the invention of this project using the raspberry pi to solve issues
like this can somehow be very effective for the institution. This project utilized the presence
of genuine characteristic in every student to conduct the attendance taking procedure which
never been practised before in history. In directly, the achieved objectives of this project had
induced the following effects.
▪ Students cannot sign the attendance for their friend.
▪ The process of attendance taking is now paperless where resources can be saved.
▪ Apart from resources, this system also saves a lot of time.
▪ Enforcement is done indirectly without human workforce.
▪ Students will be more punctual to class.
▪ It is almost impossible to sabotage the system.
By implementing this system, lecturer can just sit back and collect the attendance without
worries.

6.1.4 Further Developments


Since the development time for this project is very limited, the designed system only
consists of the minimum function required for it to work. However, it can be further
improved to maximise the usage of the raspberry pi to produce a better system. The
followings are the further developments for the project to be improved.
▪ Provide a better domain name for the webpage.
▪ Improve the face recognition algorithm.
▪ Provide better search functions in the webpage.
▪ Expand the storage of the raspberry pi.
▪ Develop a fingerprint recognition mechanism to enhance the recognition system.
▪ Improves the system so that it can eliminates the need of lecturer input before the
recognition procedure can start.
▪ Improves the database so that it can also stores the information of the subjects taken
by each student to facilitate the attendance marking procedure.

BCS (HONS) Computer Engineering 57


Faculty of Information and Communication Technology (Perak Campus), UTAR
6.2 Conclusion
Before the development of this project. There are many loopholes in the process of
taking attendance using the old method which caused many troubles to most of the
institutions. Therefore, the facial recognition feature embedded in the attendance monitoring
system can not only ensure attendance to be taken accurately and also eliminated the flaws in
the previous system. By using technology to conquer the defects can not merely save
resources but also reduces human intervention in the whole process by handling all the
complicated task to the machine. The only cost to this solution is to have sufficient space in
to store all the faces into the database storage. Fortunately, there is such existence of micro
SD that can compensate with the volume of the data. In this project, the face database is
successfully built. Apart from that, the face recognizing system is also working well. A
webpage is also successfully built with fully functioning feature which is user-friendly. The
database built is hidden from the user, however they can still access and make changes to it
through the developed webpage with excellent interface.
At the end, the system not only resolve troubles that exist in the old model but also
provide convenience to the user to access the information collected which perfected the
existence of technology to assist human’s needs.

BCS (HONS) Computer Engineering 58


Faculty of Information and Communication Technology (Perak Campus), UTAR
Bibliography

Diepen, G. (2017). Detecting and tracking a face with Python and OpenCV. [online]
www.GuidoDiepen.nl. Available at: https://www.guidodiepen.nl/2017/02/detecting-and-
tracking-a-face-with-python-and-opencv/ [Accessed 19 Oct. 2017].
Docs.opencv.org. (2017). Face Recognition with OpenCV — OpenCV 2.4.13.4
documentation. [online] Available at:
https://docs.opencv.org/2.4/modules/contrib/doc/facerec/facerec_tutorial.html#face-
database [Accessed 19 Oct. 2017].
Element14.com. (2017). Community: Raspberry Pi 3. [online] Available at:
https://www.element14.com/community/community/raspberry-
pi/raspberrypi3/content?filterID=contentstatus[published]~objecttype~objecttype[docum
ent]&filterID=contentstatus[published]~language~language%5Bcpl%5D [Accessed 21
Oct. 2017].
GitHub. (2017). iashris/Face-Detection-OpenCV. [online] Available at:
https://github.com/iashris/Face-Detection-OpenCV/blob/master/FaceDet.py [Accessed
19 Oct. 2017].
Opencv-python-tutroals.readthedocs.io. (2017). Getting Started with Images — OpenCV-
Python Tutorials 1 documentation. [online] Available at: http://opencv-python-
tutroals.readthedocs.io/en/latest/py_tutorials/py_gui/py_image_display/py_image_displa
y.html [Accessed 19 Oct. 2017].
Projects.raspberrypi.org. (2017). Cite a Website - Cite This For Me. [online] Available at:
https://projects.raspberrypi.org/en/projects/getting-started-with-guis [Accessed 18 Oct.
2017].
Raja, R. (2017). Face Detection using OpenCV and Python.. [online] SuperDataScience - Big
Data | Analytics Careers | Mentors | Success. Available at:
https://www.superdatascience.com/opencv-face-recognition/ [Accessed 19 Oct. 2017].
Raspberry Pi. (2017). Download NOOBS for Raspberry Pi. [online] Available at:
https://www.raspberrypi.org/downloads/noobs/ [Accessed 19 Oct. 2017].
Rosebrock, A. (2017). Accessing the Raspberry Pi Camera with OpenCV and Python -
PyImageSearch. [online] PyImageSearch. Available at:
https://www.pyimagesearch.com/2015/03/30/accessing-the-raspberry-pi-camera-with-
opencv-and-python/ [Accessed 19 Oct. 2017].
Rosebrock, A. (2017). How to install OpenCV 3 on Raspbian Jessie - PyImageSearch.
[online] PyImageSearch. Available at:
https://www.pyimagesearch.com/2015/10/26/how-to-install-opencv-3-on-raspbian-
jessie/ [Accessed 18 Oct. 2017].
Rosebrock, A. (2017). Practical Python and OpenCV: Learn Computer Vision in a Single
Weekend. [online] Pyimagesearch.com. Available at:
https://www.pyimagesearch.com/practical-python-opencv/?src=sidebar-face-detection
[Accessed 18 Oct. 2017].

BCS (HONS) Computer Engineering 59


Faculty of Information and Communication Technology (Perak Campus), UTAR
The Pi Hut. (2017). How to install / use the Raspberry Pi Camera. [online] Available at:
https://thepihut.com/blogs/raspberry-pi-tutorials/16021420-how-to-install-use-the-
raspberry-pi-camera [Accessed 20 Oct. 2017].
Althority.com. (n.d.). Software Development Life Cycle | Software Testing is an Art!. [online]
Available at: http://www.althority.com/sdlc/ [Accessed 6 Apr. 2017].
Cha, B. (2014). A Beginner's Guide to Understanding the Internet of Things. [online] Recode.
Available at: https://www.recode.net/2015/1/15/11557782/a-beginners-guide-to-
understanding-the-internet-of-things [Accessed 6 Apr. 2017].
Gordiyenko, S. (2014). Waterfall Software Development Life Cycle (SDLC) Model: Steps,
Stages, Case Studies. [online] XB Software. Available at:
https://xbsoftware.com/blog/software-development-life-cycle-waterfall-model/
[Accessed 6 Apr. 2017].
Half, R. (2015). 6 Basic SDLC Methodologies: Which One is Best?. [online] Robert Half.
Available at: https://www.roberthalf.com/technology/blog/6-basic-sdlc-methodologies-
the-pros-and-cons [Accessed 6 Apr. 2017].
Ieeexplore.ieee.org. (2014). Internet of Things for Smart Cities - IEEE Xplore Document.
[online] Available at: http://ieeexplore.ieee.org/document/6740844/ [Accessed 6 Apr.
2017].
Libelium.com. (2016). Top 50 Internet of Things Applications - Ranking | Libelium. [online]
Available at:
http://www.libelium.com/resources/top_50_iot_sensor_applications_ranking/ [Accessed
6 Apr. 2017].
Qastation.wordpress.com. (2008). SDLC | Qastation | Page 2. [online] Available at:
https://qastation.wordpress.com/tag/sdlc/page/2/ [Accessed 6 Apr. 2017].
Santiago, D. (n.d.). edu-scrum. [online] Slidedeck.io. Available at:
http://slidedeck.io/Dawlys/edu-scrum [Accessed 6 Apr. 2017].
SearchSoftwareQuality. (2015). What is systems development life cycle (SDLC)? - Definition
from WhatIs.com. [online] Available at:
http://searchsoftwarequality.techtarget.com/definition/systems-development-life-cycle
[Accessed 6 Apr. 2017].
Smartcitysystems.com. (2015). Smart City Systems : Time and Attendance Machines,HR and
Payroll Software UAE, HR and Payroll Software dubai, HR and Payroll UAE, HR and
Payroll dubai, HRMS UAE, HR and Payroll Software Abu Dhabi, HR and Payroll
Software Sharjah, Payroll Software UAE, Payroll Software Saudi Arabia, Payroll
Software Oman, Payroll Software Qatar, Payroll Software Kuwait, Payroll Software
Dubai, payroll Software Abu Dhabi, payroll Software Sharjah, HRMS dubai. [online]
Available at:
http://www.smartcitysystems.com/content/default.aspx?categorycode=Time_and_Attend
ance_Machines [Accessed 6 Apr. 2017].
Ti.com. (2012). Application Areas for the Internet of Things | TI.com. [online] Available at:
http://www.ti.com/ww/en/internet_of_things/iot-applications.html [Accessed 6 Apr.
2016].

BCS (HONS) Computer Engineering 60


Faculty of Information and Communication Technology (Perak Campus), UTAR
A2hosting.com. (2018). Connecting to MySQL using Python - A2 Hosting. [online]
Available at: https://www.a2hosting.com/kb/developer-
corner/mysql/connecting-to-mysql-using-python [Accessed 10 Feb. 2018].
Agarwal, N. (2018). How to Create Customized Form in WordPress | InkThemes.
[online] InkThemes. Available at: https://www.inkthemes.com/how-you-can-
easily-create-customized-form-in-wordpress/ [Accessed 11 Feb. 2018].
Balkhi, S. (2018). [online] Wpbeginner.com. Available at:
http://www.wpbeginner.com/beginners-guide/beginners-guide-to-wordpress-
database-management-with-phpmyadmin/ [Accessed 6 Feb. 2018].
Bazerra, G. (2018). How to use python 3.5.1 with a MySQL database. [online]
Stackoverflow.com. Available at:
https://stackoverflow.com/questions/35684400/how-to-use-python-3-5-1-with-
a-mysql-database [Accessed 10 Feb. 2018].
Breuning, S. (2018). Raspberry Pi web server - Setting up Nginx and uWSGI for
CGI scripting. [online] Raspberrywebserver.com. Available at:
http://raspberrywebserver.com/cgiscripting/setting-up-nginx-and-uwsgi-for-
cgi-scripting.html [Accessed 11 Feb. 2018].
command, I. (2018). Image Processing (OpenCV with PHP) - Issue with the exec
command. [online] Stackoverflow.com. Available at:
https://stackoverflow.com/questions/35381705/image-processing-opencv-with-
php-issue-with-the-exec-command/35382122 [Accessed 15 Feb. 2018].
Docs.opencv.org. (2018). Saving and Loading a FaceRecognizer — OpenCV
2.4.13.6 documentation. [online] Available at:
https://docs.opencv.org/2.4/modules/contrib/doc/facerec/tutorial/facerec_save_
load.html [Accessed 10 Mar. 2018].
Hobbs, S. (2018). How to Install WordPress on a Raspberry Pi | samhobbs.co.uk.
[online] Samhobbs.co.uk. Available at: https://samhobbs.co.uk/2014/02/how-
to-install-wordpress-on-a-raspberry-pi [Accessed 6 Feb. 2018].
Linux.com | The source for Linux information. (2018). Understanding Linux File
Permissions. [online] Available at:
https://www.linux.com/learn/understanding-linux-file-permissions [Accessed 3
Mar. 2018].
Lovely, S. (2018). How to set up a web server on the Raspberry Pi - The Pi.
[online] The Pi. Available at: https://thepi.io/how-to-set-up-a-web-server-on-
the-raspberry-pi/ [Accessed 3 Feb. 2018].
page, C. (2018). Calling OpenCV python script with php page. [online]
Stackoverflow.com. Available at:
https://stackoverflow.com/questions/44745170/calling-opencv-python-script-
with-php-page [Accessed 15 Feb. 2018].
BCS (HONS) Computer Engineering 61
Faculty of Information and Communication Technology (Perak Campus), UTAR
PHP, R. (2018). Running a Python script from PHP. [online] Stackoverflow.com.
Available at: https://stackoverflow.com/questions/19735250/running-a-python-
script-from-php [Accessed 15 Feb. 2018].
Pi My Life Up. (2018). Raspberry Pi MYSQL & PHPMyAdmin Tutorial. [online]
Available at: https://pimylifeup.com/raspberry-pi-mysql-phpmyadmin/
[Accessed 6 Feb. 2018].
place?, W. (2018). Why do I have to keep using `source ~/.profile` to get settings in
place?. [online] Stackoverflow.com. Available at:
https://stackoverflow.com/questions/10320885/why-do-i-have-to-keep-using-
source-profile-to-get-settings-in-place [Accessed 20 Feb. 2018].
Projects.raspberrypi.org. (2018). [online] Available at:
https://projects.raspberrypi.org/en/projects/lamp-web-server-with-wordpress/9
[Accessed 6 Feb. 2018].
Raspberrypi.org. (2018). Setting up an NGINX web server on a Raspberry Pi -
Raspberry Pi Documentation. [online] Available at:
https://www.raspberrypi.org/documentation/remote-access/web-
server/nginx.md [Accessed 3 Feb. 2018].
script, R. (2018). Raspberry pi call workon cv in bash or python script. [online]
Stackoverflow.com. Available at:
https://stackoverflow.com/questions/48034370/raspberry-pi-call-workon-cv-
in-bash-or-python-script [Accessed 16 Feb. 2018].
script, S. (2018). Shell Script: Execute a python program from within a shell script.
[online] Stackoverflow.com. Available at:
https://stackoverflow.com/questions/4377109/shell-script-execute-a-python-
program-from-within-a-shell-script [Accessed 20 Feb. 2018].
Ste Wright the Web Developer. (2018). Install MySQL on Raspberry Pi tutorial.
Install MySQL on Raspbian. [online] Available at:
https://www.stewright.me/2014/06/tutorial-install-mysql-server-on-raspberry-
pi/ [Accessed 3 Feb. 2018].
Wright, S. (2018). Tutorial - Install Nginx and PHP on Raspbian - Ste Wright the
Web Developer. [online] Ste Wright the Web Developer. Available at:
https://www.stewright.me/2014/06/tutorial-install-nginx-and-php-on-raspbian/
[Accessed 6 Feb. 2018].

BCS (HONS) Computer Engineering 62


Faculty of Information and Communication Technology (Perak Campus), UTAR
Turnitin: Plagiarism check summary

BCS (HONS) Computer Engineering 63


Faculty of Information and Communication Technology (Perak Campus), UTAR

You might also like