OVIDIUS University of Constant a [616593]
Ministry of National Education
"OVIDIUS" University of Constant a
Faculty of Mathematics and Computer Science
Degree Program: Computer Science
Home Assistant for Elderly People
Scientic Adviser:
Conf. dr. Pelican Elena
Student: [anonimizat] a
2018
Abstract
Indiferent de varst a, foarte multe persoane sufer a de pierderi de memorie, severe
sau mai put in severe. Aceasta problem a este mult mai ^ nt^ alnit a la persoanele ^ naintate
^ n v^ arst a. Un studiu [1] f acut ^ n 2017 arat a c a, mondial, num arul persoanelor care au
Alzheimer sau o dement a asociat a este estimat la 44 de milioane. Doar 1 din 4 persoane
bolnave de Alzheimer au fost diagnosticate. Mai mult de unul din 6 ^ ngrijitor ai bolii
Alzheimer si dement iei au trebuit s a renunt e la munc a ^ n ^ ntregime e pentru a deveni
un ^ ngrijitor ^ n primul r^ and, e pentru c a ^ ndatoririle au devenit prea ^ mpov ar atoare.
Unul dn 3 ^ ngrijitori are 65 de ani sau mai mult. ^Intre 200 si 2015 decesurile din
cauza bolilor de inim a au sc azut cu 11% ^ n timp ce cele de Alzheimer au crescut cu
123%. Aceasta crunt a boal a omoar a mai mult dec^ a cancerul de s^ an si cel de prostat a
combinat. Aceast a lucrare are ca scop u surarea viet ii pacient ilor bolnavi de Alzheimer
si nu numai. Pentru crearea aplicat iei am folosit elemente din Machine Learning si
sisteme de gestiune a bazelor de date.
No matter the age, many people suers from memory loss, severe or not. This
problem is much more common to older people. A 2017 study [1] shows that, worldwide,
the number of persons who suers from Alzheimer or a related dementia is estimated
to 44 millions. Just 1 in 4 people who suers from Alzheimer have been diagnosed.
More that 1 in 6 caretakers of Alzheimer and dementia had to give entirely up work,
either to be a caretaker or beacuse it was to burdensome. On in 3 caretakers is 65 or
older. Between 2000 and 2015 deaths from heart diseases have decreased by 11%, while
deaths from Alzheimer's disease have increased by 123%. This cruel disease kills more
than breast and prostate cancer combined. The application was built using elements
from Machine Learning and database management systems.
Outline
Outline ii
List of Figures iii
List of Tables 1
1 Introduction 2
2 Content 4
2.1 Reminder . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.2 Chatbot . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
2.3 Face Recognition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
3 Application 12
4 Conclusions 14
4.1 Future works . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14
References 15
ii
List of Figures
1.1 Flowchart of the algorithm of the Eigenfaces method . . . . . . . . . . . . 2
iii
List of Tables
1.1 Comparison of some work related to face recognition . . . . . . . . . . 3
1
Chapter 1
Introduction
This idea came to life from the desire of easing the lives of elderly people. How
will it ease their lives? Simple! This application is designed to the needs of the
elderly,having features that will help them throughout the day.
This paper stands as foundation for the mobile application that I named "Aletheia"
and has as purpose helping the elderly people remember events, activities, details or in
extreme cases even people. Because this disease it is one that needs lots of attention
I integrated a chatbot to socialize with the users or help them whenever they are in
need and no one is around.
Figure 1.1 : Flowchart of the algorithm of the Eigenfaces method
2
Introduction Introduction
Method Number of images in training set Success rate References
Principal Component Analysis 400 79.65% ref1
PCA + Relevant Component Analysis 400 92.34% ref1
Independent Component Analysis 170 tah function – 69.40% ref2
40 Gauss function – 81.35% ref2
Hidden Markov Model 200 84% ref3
Active Shape Model 100 78.12 – 92.05% ref4, ref5
Wavelet Transform 100 80 – 91% ref6
Support Vector Machine – 85-92.1% ref7,ref8
Neural Networks – 93.7% ref9
Eigenfaces Method 70 92-100% ref 10
Table 1.1 : Comparison of some work related to face recognition
This paper is structured in 4 chapers:
.Chapter 1 – Introduction: this chapter, as the name suggests, is an introduction
for the chosen theme and application.
.Chapter 2 – Content: this chapter presents the technologies that I used for the
application
.Chapter 3 – Application: this chapter presents the mobile application, its features
and a small "how to use it" guide, although I made sure that it is user friendly.
.Chapter 4 – Conclusions : contains nal conclusions and som future works.
3
Chapter 2
Content
The application was build using [2]. It is written in java.
2.1 Reminder
For this feature I used the SqLite library, two recievers and a service. Using the
Sqlite library the reminder creates the "Aletheia" database and a table that will store
all the necessary informations for reminders, such as: the date, time, name of the
reminder, repetition, type of repetition and repetition interval.
For recieving the notication I used BroadcastReciever in combination with Wake-
fulBroadcastReciever and IntentService. The last two are used for recieving notication
even if the user is no longer in the application. Because the WakefulBroadcastReciever
is deprecated for teh latter versions I had to use it just for versions below API 22
(Android Oreo), so for the versions above API 22, I used the IntentService.
2.2 Chatbot
For this feature I used the Bot and Chat libraries. The dictionary of the chatbot
is built using AIML les and for the exchange between the bot and the human I used
an Adapter. Below is an example of the chatbot dictionary le:
4
Content Face Recognition
2.3 Face Recognition
For this feature I used the [5] for the integration of the Eigenfaces algorithm. I
used the algorithm from [7]. PCA (Principal Component Analysis) is a method of
identifying patterns in data. We use PCA to obtain a set of eigenfaces. For a dataset
with N images, each image must have the same resolution
M=n1xn2
and is transformed into a vector
i
of dimmensions M x 1.
Then it is calculated the mean vector
'i= i ;i=1;N
which is substraced from all the vectors that forms the dataset. That means that the
data is "centered".
The rst singular image is dened by the principal singurlars vectors, looks like the
mean vector. From here we conclude that there is no benet from substracting the
mean vector from all the others vectors.
The PCA algorithm is applied to the vectors set of big dimmensions
'1;'2;:::;' N
. A set of orthonomal vector
u1;u2;:::;u N
which will best describe the patterns from the dataset is sought for.
Let A:m x n be a centered data matrix, where each column has random values of
mean 0.
Let SVD decomposition for A,
A=UVT
.
The right singular vectors
vi
are named principal components directions.
The vector
z1=Av1=1u1
has the biggest variation from all the liniar normalized combinations belonging to the
column A:
var(z1) =var(Av1) =!2
1
m
5
Content Face Recognition
We remind that for a vector/sample x of length n, we have
var(x) =1
nnX
i=1(xi x)2
, where
x
is the mean of the vector x.
Finding the maximum varience vectors is equivalent, in liniar algebra terms, with
maximization of Rayleight coecients
2
1= max
v6=0vTATAv
vTv=kAvk2
kvk2
,
v1=argmax
v6=0kAvk2
kvk2
The normalized variable
ui=1
1Av1
is called the rst principal component of A.
Then, we want to determine the vector with the second biggest varience wich is
perpendicular to the rst vector. This is obtain by calculating the biggest varience of
the "de
ated" matrix,
A A 1u1vT
1
and so on…
We will explain the pick of
ukand k
. From the SVD decomposition of the matrix A we have
A=UVT
, where A is of dimensions N x N, and
=diag(1;2;::::; r;0;:::::0)
with
1:::r>0
6
Content Face Recognition
, r = rang(A),
Let
u1;u2;:::u N
a subspace of U of dimmension N. Then each vector
'i
can be written as:
'i=fi1u1+fi2u2+:::+fiNuN;i=1;N
. We obtain the relation:
fij='T
iuj=<uj;'i>
We know that for a symmetric and positive-dened matrix B, we have
(B) =1;::::; n[0;1);minkxk2<Bx;x>maxkxk2and max
= max
kxk6=0<Bx;x>
kxk2= max
kxk26=0xTBx
kxk2
.
But
max(AAT) =2
1;where 1
is the biggest singular value of the matrix A.We have
wTAATw= (ATw)T(ATw) =kATwk2=NX
i=1j'T
1wj2
So we obtain:
max
w6=0wT(AAT)w
wTw= max
kwk=1wT(AAT)w= max
kwk=1NX
i=1j'T
iwj2
. So we are looking for
max
kwk=1NX
i=1j'T
iwj2
.
We have:
AAT=UVTVTUT=UTUT
, using this we obtain:
wT(AAT)w
wTw=xTTx
xtx=1
1×1
1+2
2×2
2+:::+r
rxr
r
x2
1+x2
2+:::+x2
N
.
7
Content Face Recognition
We suppose that
12:::r
and we obtain:
max
x6=1
1×1
1+2
2×2
2+:::+r
rxr
r
x2
1+x2
2+:::+x2
N=2
1=1
where
1
is the biggest eigen value of A. So we have x with
x1= 1andx i= 0;i= 2;::::;N
. Then
w=Ux=u1;
where is the eigen vector for the matrix
AAT;
corresponding to
1:
For the second principal component we use the same reasoning. We are searching
for
max
kwk=1;wTu1=0NX
i=1j'Twj2
. Analogous, we obtain:
max
w6=0;wTu1=0wT(AAT)w
wTw= max
x6=0;xTUTu1=01
1×1
1+2
2×2
2+:::+r
rxr
r
x2
1+x2
2+:::+x2
N
= max
x6=0;x1=01
1×1
1+2
2×2
2+:::+r
rxr
r
x2
1+x2
2+:::+x2
N=2
2=2:
So we have x with
x2= 1andx i= 0
for i = 1,3,…,N and
w=Ux=u2:
Continuing with the same reasoning as before we obtain
u3;u4;:::;u N:
8
Content Face Recognition
The dimmension of the covarience matrix C is M x M, where M is the resolution of
one image. Because in practice the number M is very big, the computational eort to
determine M eigen values and M eiegn vectors for the matrix C este imense. In this
case we want the reduction of the dimmension and of the computational volume.
Let
L=ATA;
a matrix of the dimmension N x N. Usually, N – the number of images in the dataset
is much smaller that the dimmension of a vector M, and it is much easier to compute
N eigen values and N eigen vectors for a matrix of dimmesion N x N.
For the matrix L we conssider the eigen vectors
vi;Lvi=ivi:
So
(ATA)vi=ivi$A(ATA)vi=Aivi$(AAT)Avi=iAvi:
So we have
(AATAvi=iAvi;
that means that
Avi
is eigen vector for the matrix C.
We are searching for N eigen vectors,
vi;
for the matrix L. Of those N eigen vectors obtained, we keep nly the rst k, correspond-
ing to the biggest k eiegn values, which are enough to characterize the initial data set.
The other N – k vectors, corresponding to the smallest eigen values are eliminated
because the information is not semincative. So the base of the orthonormat vectors
from
RM:u1;u2;:::;u N
(this will be used to obtain the images/vectors) will be truncated to
u1;u2;:::;u kwithK <N
To identify a new image
9
Content Face Recognition
, being represented by the eigen vectors, we have:
!i=uT
i( );i= 1 :k:
The coecients
!i
forms the vector
T= [!1;!2;::::;! k]:
The vector
describes the contributtion of each eiegn faces in the representation of the image
and is used for classifying the image
:
The Eigenfaces algorithm
Step1: All images are transformed into vectors:
1; 2;:::; N
Step2: Then it is calculated the mean vector
=1
NNX
i=1 i
Step3: The mean vector is subtracted from all the vectors from dataset:
'i= i ;i=1;N
Step4: We obtain the covariance matrix:
C=1
NNX
i=1'i'T
i=1
NAAT
10
Content Face Recognition
Step5:We obtain the eigen vectors
ui=1;N
of the matrix C and we keep the rst k vectors, which correspond to the biggest k eigen
values.
Step6: We then obtain the vector:
T
i= [!i
1;!i
2;:::;!i
k]
, with
'i'^'i=kX
j=1!i
jui
j
Step7: Being given an image
, it is normalized:
'=
Step8:
is projected on the space of eigen vectors:
^'i=kX
j=1!juj
Step9:
^'
is represented as
T
i= [!1;!2;:::;! k]
Step10: We are searching for a
i021;:::;N
that satisfy
k i0k= min
1iNk ik
11
Chapter 3
Application
I gave this application the name of "Aletheia", which is a greek word that can be
translasted as truth or disclosure. But there is also a literal meaning to the word, the
state of not being hidden or being evident.
The reason why I chose this word was because, being the oposite of the word
lethe that can be translated to forgetfulness, oblivion or concealment, I believe that it
captures the essence of what this application is built for.
General
The minimum sdk version for the application is 15, the target version is 22.
For the design of the application I used icons from [4] and som styling for the buttons
and datetimepicker from [3] and [6].
Reminder
.a date picker, so the user can choose the data of a certain event or activity
.a time picker, so the user can choose the time of the said activity or event
.a repeat function, so the user can choose if the activity he is creating is a repeating
one or not
.a repetition interval, so the user can choose the interval of the repeating activity
.the type of repetition, e.g hourly, daily, weekly etc.
Chatbot
.the list layout that allows the conversation to be seen
.an adapter that helps the interaction between the bot and the user
.the dictionary of the bot
Face recognition
12
Application Application
.you can take a picture or you can choose one from the gallery
.you can add persons to the "visitors" group or you can create a new group
.the identication of the person
General
13
Chapter 4
Conclusions
4.1 Future works
In the future I plan to integrae
.speech recognition so the user can communicate easily with the chatbot without
needing to write. I plan to integrate both speech-to-text and text-to-speech so it
will make a more enjoyable communication between the man and machine.
.google maps so that the users can know the path back home, or to the doctor
or to the store, or anywhere else. This feature will have a table that contains
some crucial information such as: the home address, the doctor address, the
store address, the park address. With this data I wil draw the minimum distance
between two points such as: the user wants to go to the store from home, he will
select the destination location and the app will shortly show the most favorable
route to the destination from the current location.
.a medical log so that if the user knows what pills they have alergies to, etc.
14
References
[1] 2017 alzheimer's statistics.
[2] Android studio.
[3] Getbase
oatingactionbutton.
[4] Material design icons.
[5] Opencv library.
[6] Wdualler material datetime picker.
[7] Elena Pelican si L acr amioara Lit a. Algoritmi pentru recunoa sterea fet elor . MATRIX
ROM BUCURES TI, 2015.
15
Copyright Notice
© Licențiada.org respectă drepturile de proprietate intelectuală și așteaptă ca toți utilizatorii să facă același lucru. Dacă consideri că un conținut de pe site încalcă drepturile tale de autor, te rugăm să trimiți o notificare DMCA.
Acest articol: OVIDIUS University of Constant a [616593] (ID: 616593)
Dacă considerați că acest conținut vă încalcă drepturile de autor, vă rugăm să depuneți o cerere pe pagina noastră Copyright Takedown.
