Raspberry Pi Attendance
Raspberry Pi Attendance
Abstract—Facial image acquisition systems produce low quality Decision Tree (DT), Adaboost (AB) and Support Vector Ma-
face images. This happens because the imaging conditions like chine (SVM). We chose accuracy and execution time because
illumination, occlusion or noise might change among images. these metrics specify the performance of a face recognition
To achieve optimal images, we proposed an image acquisition
method for face recognition. Then, with this method, it was cre- system in real-time environments [3]. The ResNet-34 was
ated the Smart Event Faces Database that contains video frames used because deep learning models had good results in face
from videos taken by smartphones and Raspberry Pi. Also, it recognition accuracy regarding the state of the art [4] and
was measured the accuracy for face recognition and execution also a ResNet was used in the Visual Recognition Challenge
time for the Smart Event Faces Database using ResNet 34 for (ILSVRC) of 2015 and obtained a top-5 error rate of 3.6%
feature extraction and the next classifiers: K-Nearest Neighbors,
Naive Bayes, Random Forest, Multi-Layer Perceptron, Decision in the ImageNet Large Scale [5]. Finally, we implemented an
Tree, Adaboost and Support Vector Machine. Additionally, we automatic attendance system with a Raspberry Pi, ResNet 34
compared these classifiers to show which was effective for the and KNN to quicken the entry of persons to an event.
dataset in terms of accuracy and execution time. Then, we
used the Smart Event Faces Database to create an automatic II. R ELATED W ORK
attendance system for events using Raspberry Pi, ResNet-34 and In [1] and [6], they proposed an image acquisition system.
K-Nearest Neighbors classifier. The results achieved in the Smart The first one divided their order into 4 modules: face detection,
Event Faces Database showed that K-Nearest Neighbors and
Support Vector Machine had the best results with more than camera control, face tracking, and face quality assessment.
0.96 of accuracy for face recognition and less than 1.5 seconds The second one also proposed a new face quality assessment
respectively of execution time. The automatic attendance system criterion calculation method.
had an accuracy for face recognition of 0.94 and 0.5 seconds
approximately per frame in execution time for 19 persons in 2 Then, in [2], [7], [8], [9], [10], [11] and [12], they talked
events. about different applications for face recognition using Rasp-
Index Terms—image acquisition method, face recognition, berry Pi. In detail, [2] proposed a face recognition security
automatic attendance system. system connected to a smart home system, [7] a face recog-
nition system with high accuracy that includes face detection,
I. I NTRODUCTION feature extraction and face recognition, [8] a system that
Facial image acquisition systems depend on the quality after recognizing a face, alerts security by e-mail and mobile
of the image [1]. Because of that, we proposed an image notification, [9] consists in a group of computers, a Raspberry
acquisition method that creates a Smart Event Faces Database Pi and a camera that detect and recognize human faces using
that contains video frames from videos taken by Raspberry Pi image processing algorithms, [10] used a face detection and
and smartphones. We used a Raspberry because the Raspberry recognition technology to create an attendance management
Pi camera can support 1080p resolution and capture videos system, [11] created a smart home automation system for
at a high rate [2]. After that, we used a residual neural old people using Raspberry Pi and a smartphone, finally [12]
network (ResNet-34) for feature extraction and is measured implemented a visitor access control system for senior citizen.
by accuracy for face recognition and execution time with the III. T HEORETICAL F OUNDATION
next classifiers: K-Nearest Neighbors (KNN), Naı̈ve Bayes A. Object Detection Using Haar Feature-Based Cascade
(Bayes), Random Forest (RF), Multi-Layer Perceptron (MLP), Classifiers
Machine learning approach to detect objects in images
978-1-7281-3646-2/19/$31.00 ©2019 IEEE proposed by [13].
B. Deep convolutional neural networks
Deep networks integrate different level features and classi-
fiers in an end-to-end multilayer style, and the level of features
can be increased by the number of stacked layers [14].
C. Raspberry Pi Model B+
It has a 64-bit quad core processor running at 1.4GHz,
dual-band of 2.4GHz, 5GHz of wireless of local area network
(LAN), Bluetooth 4.2, Bluetooth of low energy (BLE), faster
Ethernet, and power over Ethernet (PoE) capability via a
separate PoE add on board [15].
IV. M ETHOD
First, we proposed an image acquisition method for face Fig. 1. Face images from the “event faces” dataset folder that were taken
recognition. This method starts with a video as an input, from the Raspberry Pi camera.
loads a Haar Cascade frontal face XML, detects a face in the
video using Haar Cascade classifier until the number of images
detecting a face is 50, then these images use an ellipse mask
with a black background and finally the images are cropped
and resized to 140x140, leaving a face image with an ellipse
mask as output. This process is the same from the videos taken
by a Raspberry Pi and smartphones. We did this because in the
automatic attendance system, the videos from the smartphones
are for training and the videos from the Raspberry Pi are for
the test.
Second, we generated a new dataset named Smart Event
Faces Database using the image acquisition method explained
before 1 . This dataset contains 52 persons. Forty-nine men and
three women. All of them were undergraduate students that
Fig. 2. Face images from the “smart faces” dataset folder that were taken
were between 18 and 30 years old. For each person, there are from the smartphones.
50 images in the folder “smart faces” and 50 images in the
folder “event faces.” Both envelopes have the same labels. In
total, Smart Event Faces Database has 5200 pictures. Then, the Raspberry Pi used the “smart faces KNN.pickle”
and the pretrained ResNet-34 for face recognition as input to
Third, we used KNN, Bayes, RF, MLP, DT, AB, and SVM
streaming a video that can recognize faces from the Smart
to measure accuracy for face recognition and execution time
Event Faces Database and take automatic assistance using the
in the Smart Event Faces Database. To do this, we used a
Firebase database.
total of 5000 images from the Smart Event Faces Database.
The images in the “event faces” and “smart faces” folders V. E XPERIMENTAL S ETTINGS
were encoded into a “pickle” file for each folder. It was used We collected face images using smartphones with an An-
ResNet-34 for feature extraction, and the result is encoded in droid version of 5.1 or more, a Raspberry Pi 3 Model B+ and a
“pickle” files output vectors and labels 2 . For this process, Raspberry Pi camera module v2.0. Also, the background used
we used only 50 persons, and for each of them, we used 50 for all the persons in the Smart Event Faces Database was
images for training and 50 images for the test. white, and the sceneario was well illuminated.
We used the seven classifiers named above to obtain their
mean scores for the Smart Event Faces Database. Then, we We used a computer with 16GB, Python, Jupyter Notebook,
encoded the results for both datasets in “pickle” files. OpenCV, Scikit-Learn and face recognition [16] to measure
accuracy for face recognition and execution time using 5000
Finally, we used a Raspberry Pi with its Raspberry Pi images from the Smart Event Faces Database and the next
camera to take attendance automatically to quicken the entry of classifiers: KNN, Bayes, RF, MLP, DT, AB, and SVM. The
persons to an event. To do this, it was used the “smart faces” configurations for the classifiers are as follows: for KNN the
folder to encode a KNN trained classifier. The output is a number of neighbors was 5 and the Murkowski metric. For
“smart faces KNN” pickle file for the Raspberry Pi. bayes, it’s for default from Scikit-Learn. For RF, the maximum
1 https://www.kaggle.com/luisfunglung/smart-event-faces-database depth of the tree is 250, the number of trees is 200 and the
2 https://gitlab.com/mikael.nb/recognize event faces/blob/master/smart number of features to consider is 5. For MLP, the alpha for
event faces/notebooks/sef vectors.ipynb regularization is 3.1. For DT, the maximum depth is 250 and
Fig. 5. Raspberry Pi camera streaming a video and recognizing both faces
using Raspberry Pi, ResNet-34 and KNN classifier.
TABLE I
B EST RESULTS OF THE SEVEN CLASSIFIERS FOR 50 PERSONS USING 50
IMAGES PER PERSON FOR TRAINING AND TEST FOR THE Smart Event Faces
Fig. 3. Accuracy for 50 persons and N° of images per person varying from Database
5 to 50 images for Smart Event Faces Database using ResNet 34.
Persons: 50
Classifiers Accuracy (%) Execution time (seconds)
KNN 98 1.26
Bayes 65 0.09
RF 93 1.19
MLP 20 2.15
DT 39 1.01
AB 12 6.31
SVM 98 1.13
VI. R ESULTS
TABLE II
The results using our image acquisition method are showed ACCURACY FOR FACE RECOGNITION AND E XECUTION TIME PER FRAME
in Fig. 1 and Fig. 2. FOR 19 PERSONS ON 2 EVENTS
The results that used KNN, Bayes, RF, MLP, DT, AB, and N° of persons Accuracy (%) Execution time (seconds)
14 93 0.58
SVM, with ResNet 34 for feature extraction and the images 5 100 0.53
from Smart Event Faces Database are Fig. 3 and Fig. 4.
accuracy for face recognition and execution time for the Smart [9] Wazwaz, Ayman A; Herbawi, Amir O; Teeti, Mohammad J; Hmeed,
Event Faces Database. Sajed Y, ”Raspberry Pi and computers-based face detection and recog-
nition system,” of 2018 4th International Conference on Computer and
Finally, the results on the 2 events in Table two showed an Technology Applications (ICCTA), Istambul, 2018.
[10] Chandu Gaddam, Sarath; Gaddam, Sarath Chandu; Ramesh, N V K,
accuracy of 94.73% counting the persons on all the events (19 ”Face Recognition Based Attendance Management System With Rasp-
persons of 20 were recognized) and approximately 0.5 seconds berry Pi 2 Using Eigen Faces Algorithm,” ARPN Journal of Engineering
to recognize a face on a frame in the streaming video. and Applied Sciences, vol. 11, nº 13, pp. 8107-8112, 2016.
[11] Vaidya, Bhaumik; Patel, Ankit; Panchal, Anand; Mehta, Rangat; Mehta,
VIII. C ONCLUSION Krish; Vaghasiya, Parth, ”Smart home automation with a unique door
monitoring system for old age people using Python, OpenCV, Android
In conclusion, we proposed an image acquisition method and Raspberry pi,” of International Conference on Intelligent Computing
to create the Smart Event Faces Database that showed better and Control Systems, Madurai, 2017.
illumination in the images from the smartphones than from [12] Jia-Jing Li; Shih-Chang Huang, ”The Implementation of the Visitor
Access Control System for the Senior Citizen Based on the LBP Face
the Raspberry Pi. Also, we measure the accuracy for face Recognition,” of International Conference on Fuzzy Theory and Its
recognition and execution time in the Smart Event Faces Applications, Pingtung, 2017.
Database using ResNet 34 for feature extraction and the [13] Viola, Paul; Jones, Michael, ”Rapid Object Detection using a Boosted
Cascade of Simple,” of Proceedings of the IEEE Computer Society
next classifiers: KNN, Decision Tree, Random Forest, MLP, Conference on Computer Vision and Pattern Recognition, Kauai, 2001.
Adaboost, Naı̈ve Bayes and SVM. The results showed that the [14] Kaiming He ; Xiangyu Zhang ; Shaoqing Ren ; Jian Sun, ”Deep
Smart Event Faces Database that used the image acquisition Residual Learning for Image Recognition,” of 2016 IEEE Conference
on Computer Vision and Pattern Recognition (CVPR), Las Vegas, 2016.
method achieved an accuracy for face recognition of more than [15] ”Raspberry Pi,” raspberry pi, [Online]. Available:
96% on KNN and SVM. In terms of execution time, KNN https://static.raspberrypi.org/files/product-briefs/Raspberry-Pi-Model-
and SVM had less than 1.5 seconds for classification. That Bplus-Product-Brief.pdf. [Last access: 20 November 2018].
[16] A. Geitgey, ”Face Recognition,” Adam Geitgey, 3 March 2017. [Online].
means the Smart Event Faces Database has excellent accuracy [Last access: 9 November 2018].
for face recognition and execution time for two classifiers.
Finally, we implemented an automatic attendance system using
Raspberry Pi, ResNet 34 and KNN to take assistance in 2
events with a total of 94.73% accuracy for face recognition
and 0.5 seconds approximately per frame in execution time.
This results proved that we implemented a fast and precise
automatic attendance system.
R EFERENCES
[1] Mohammad A. Haque; Kamal Nasrollahi; Thomas B. Moeslund, ”Real-
Time Acquisition of High Quality Face Sequences from an Active Pan-
Tilt-,” of 2013 10th IEEE International Conference on Advanced Video
and Signal Based Surveillance, Krakow, 2013.
[2] Gunawan, Teddy Surya; Gani, Muhammad Hamdan Hasan; Rahman,
Farah Diyana Abdul; Kartiwi, Mira, ”Development of Face Recognition
on Raspberry Pi for Security Enhancement of Smart Home System,”
Indonesian Journal of Electrical Engineering and Informatics, vol. 5, nº
4, pp. 317-325, 2017.
[3] Umm-e-Laila; Khan, Muzammil Ahmad; Shaikh, Muhammad Kashif;
bin Mazhar, Syed Annas; Mehboob, Khalid, ”Comparative analysis for
a real time face recognition system using raspberry Pi,” of 2017 IEEE
4th International Conference on Smart Instrumentation, Measurement
and Application (ICSIMA), Putrajaya, 2017.
[4] Abbas, Qaisar; Ibrahim, Mostafa E A; Arfan Jaffar, M, ”A compre-
hensive review of recent advances on deep vision systems,” Artificial
Intelligence Review, pp. 1-38, 11 May 2018.
[5] S. Das, ”CNN Architectures: LeNet, AlexNet, VGG, GoogLeNet,
ResNet and more . . . .,” Medium, 16 November 2017. [On-
line]. Available: https://medium.com/@sidereal/cnns-architectures-lenet-
alexnet-vgg-googlenet-resnet-and-more-666091488df5. [Last access: 22
September 2018].
[6] Kuicheng Lin; Xue Wang; Sujin Cui, Yuqi Tan, ”Heterogeneous Feature
Fusion-based Optimal Face,” of 2015 IEEE International Instrumentation
and Measurement Technology Conference (I2MTC) Proceedings, Pisa,
2015.
[7] Chen, Yong-Ping; Chen, Qi-Hui; Chou, Kuan-Yu; Wu, Ren-Hau, ”Low-
cost face recognition system based on extended local binary pattern,” of
2016 International Automatic Control Conference (CACS), Taichung,
2016.
[8] Sai, M Yashwanth; Yashwanth Sai, M; Vijai Chandra Prasad, R;
Niveditha, P R; Sasipraba, T; Vigneshwari, S; Gowri, S, ”Low cost
automated facial recognition system,” of 2017 Second International
Conference on Electrical, Computer and Communication Technologies
(ICECCT), Coimbatore, 2017.