Full text
ACTIVITY RECOGNITION IN MENTAL HEALTH MONITORING USING MULTI-CHANNEL DATA COLLECTION AND NEURAL NETWORK Sahibzada Saadoon Hammad
ACTIVITY RECOGNITION IN MENTAL HEALTH MONITORING USING MULTI-CHANNEL DATA COLLECTION AND NEURAL NETWORK Dissertation supervised by: Sven Casteleyn, PhD Associate Professor, Institute of New Imaging Technologies (INIT), Universitat Jaume I (UJI), Castellon de la Plana, Spain Co-supervised by: Carlos Granell, PhD Associate Professor, Institute of New Imaging Technologies (INIT), Universitat Jaume I (UJI), Castellon de la Plana, Spain Co-supervised by: Roberto Henriques, PhD Assistant Professor, Information Management School (NOVA IMS), Nova University, Lisbon Portugal February 21, 2021
AC K N O W L E D G E M E N T S I would like to express my gratitude to my Supervisor Dr. Sven Casteleyn for his guidance, support, inspiration and motivation. I am thankful for the belief and confidence he put in me. I have learned a lot from him and it has been an immense pleasure and privilege to work under his supervision. I am equally thankful to my co-supervisor Dr. Carlos Granell for his valuable suggestions and continous appreciation. I am grateful to Dr. Pablo Henriques for providing critical feedback and helpful comments. I want to extend my gratitude to Miguel Matey Sanz for his time, availability, help and valuable input. I would like to express my gratitude to the Coordinators of this program for helping me in administrative issues. I am thankful to Erasmus Mundus Program for giving me the opportunity to study in this program which helped in my personality growth. I am grateful to my friends and class fellows with beautiful diverse backgrounds whom I spent time with during my degree. Finally, last but not the least, I present my sincere thanks to my family in Pakistan for their unparalleled love, support, motivation and prayers. iii
ACTIVITY RECOGNITION IN MENTAL HEALTH MONITORING USING MULTI-CHANNEL DATA COLLECTION AND NEURAL NETWORK ABSTRACT Ecological momentary assessment (EMA) methods can be used to extract context related information by studying a subject’s behaviour in an environment in real-time. In mental health EMA can be used to assess patients with mental disorders by deriving contextual information from data and provide psychological interventions based on the behaviour of the person. With the advancements in technology smart devices such as mobile phone and smartwatch can be used to collect EMA data. Such a contextual information system is used in SyMptOMS, which uses accelerometer data from smartphone for activity recognition of the patient. Monitoring patients with mental disorders can be useful and psychological interventions can be provided in real time to control their behavior. In this research study, we aim to investigate the effect of multi-channel data on the accuracy of human activity recognition using neural network model by predicting activities based on data from smartphone and smartwatch accelerometer sensors. In addition to this the study investigates model performance for similar activities such as SITTING and LYING DOWN. Tri-axial accelerometer data is collected at the same time from smartphone and smartwatch using a data collection application. Features are extracted from the raw data and then used as input to a neural network. The model is trained for single data input from smartphone and smartwatch as well the data from sensor fusion. The performance of the model is evaluated by using test samples from collected data. Results show that model with multi-channel data achieves a higher accuracy of activity recognition than the model with only single-channel data source.
KEYWORDS Activity Recognition Data Fusion Ecological Momentary Assessment Mental Health Neural Network WearOS
INDEX OF THE TEXT ACKNOWLEDGMENTS iii ABSTRACT v KEYWORDS vi INDEX OF FIGURES ix INDEX OF TABLES xi Acronyms xiii 1 Introduction 1 1.1 Background ........................... 1 1.2 Symptoms Project ....................... 2 1.3 Aims and Objectives ...................... 3 1.4 Methodological Approach ................... 3 1.5 Thesis Structure ........................ 3 2 Literature Review 5 2.1 Smartphones as tools for Ubiquitous Computing ..... 5 2.2 Ecological Momentary Assessment and Psychological Interventions ........................... 6 2.3 Human Activity Recognition ................. 7 3 Tools and Technologies 9 3.1 Android Development ..................... 9 3.1.1 Wear OS Application .................. 10 3.1.2 Smartphone and Smartwatch Sensors ....... 10 3.1.3 Message Client ..................... 10 3.1.4 Data Client ....................... 11 3.2 Data Processing and Machine Learning Tools ....... 11 vii
INDEX OF THE TEXT 3.2.1 Python .......................... 11 3.2.2 Libraries ......................... 11 4 Methodology 13 4.1 Data Collection ......................... 13 4.2 Data Processing ........................ 16 4.2.1 Data Cleaning ...................... 17 4.2.2 Feature Extraction ................... 19 4.2.3 Selected features .................... 20 4.2.4 Combining Sensor Data ................ 22 5 Experimental Design 23 5.1 Experimental Design ...................... 23 5.2 Machine Learning and Model Architecture ......... 24 6 Results and Evaluation 27 6.1 Evaluation of Smartphone sensor data ML Model ..... 28 6.2 Evaluation of Smartwatch sensor data ML Model ..... 29 6.3 Evaluation of Data Fusion ML Model ............ 30 7 Conclusion 33 7.1 Discussion ........................... 33 7.2 Research Objectives and their solutions .......... 34 7.3 Limitations ........................... 35 7.4 Future Work .......................... 35 Bibliography 37 viii
INDEX OF FIGURES 4.1 Data Collection Workflow ..................... 14 4.2 Data Collection Application User Interface ........... 15 4.3 Smartphone Coordinate Axis [43] ................ 16 4.4 Data Preparation Workflow .................... 17 4.5 Data Matching based on timestamp and unique values . . . 20 4.6 Feature Extraction Techniques [34] ............... 21 5.1 Training, Test and Validation Data Split ............ 24 ix
CHAPTER 1. INTRODUCTION patterns by collecting context related information from smartphone sensors. Use of smartphone sensors such as GPS with EMA data have been found to evaluate depression compared to clinical methods [5]. Human activity recognition is a domain which has been used to detect and monitor different activities performed by a person in daily life [6]. These human activities have been recognized by using body worn sensors such as accelerometer and gyroscope to detect and monitor human falls [7]. Smartphone sensors such as accelerometer has been used to classify and differentiate between several physical activities such as walking, running, driving and cycling [8]. In mental health, activity recognition is used to monitor and detect activities and can in turn be a part of providing psychological interventions in real time. 1.2 Symptoms Project SyMptOMS 1 is a research project by GeoSpatial Technologies Research Lab (GEOTEC) and Laboratory of Psychology and Technology (LABPSITEC) which aims to develop effective solutions for therapists to help patients with mental health problems. The project studies and analyzes the use of smartphones and wearables such as smartwatch for application in Psychology. SyMptOMS is a system of different components based on mobile and Web-based application. Mobile application is used for data collection and to provide psychological interventions. The web-based application is composed of different components to configure, collect and visualize patient’s data based on the type and nature of mental health disorder. In previous years location-based services have been used to define places of interest for patients. Dynamic alerts based on location of user through psychological interventions are sent to patient’s mobile phone application to improve behavior [9][10][11]. Recently, a context-based activity recognition system has been designed to monitor patients in their day-to-day activities. This system utilizes smartphone accelerometer sensor data to perform activity recognition [12]. The system also enables to provide context-related activity recognition in the context of Agoraphobia patient. 1http://geotec.uji.es/projects/symptoms/ 2
1.3. AIMS AND OBJECTIVES 1.3 Aims and Objectives The aim of this work is to add increased functionality to the existing activity recognition system by using sensor data from another source to improve activity detection for more number of activities. The objectives of this study are the following: • To integrate multi-channel data collection in SyMptOMS to improve accuracy of the activity recognition • To add the detection of new activities to the existing system • To compare the activity detection accuracy using single-channel and multi-channel data 1.4 Methodological Approach The methodological approach to accomplish the research objectives is following: • Explorative and thorough literature review to understand the problem in context of activity recognition and mental health, and identify the techniques useful to carry out this research • Identify technologies and develop software applications to simultaneously collect data multi-channel data to extend the already existing activity detection system • Implementation of software development methods for data collection and processing • Experimental setup and selection of model parameters for machine learning • Model performance and evaluation of the results from neural network 1.5 Thesis Structure The structure of this thesis is the following: 3
CHAPTER 1. INTRODUCTION • Chapter one comprises of contextual background, overview of SyMptOMS project, aims and objectives, brief methodology • Chapter two focuses on the related work in EMA, applications in mental health, the use of psychological intervention with the advancement of technologies and activity recognition using mobile phones and sensors. • Chapter three gives a short description of the tools and technologies used in the project. • Chapter four discusses data collection workflow, data processing. • Chapter five consists of the experimental design and the neural network architecture for training and prediction of activities • Chapter six provides description about results and evaluation of neural network model to detect activities • Chapter seven includes discussion and conclusion of work, answer to research objectives and way forward of the work 4
CHAPTER 2 LI T E R AT U R E RE V I E W This chapter provides details about the related work. First section discusses the use of mobile phone in ubiquitous computing. The second section of the chapter summarises literature about Ecological Momentary Assessment (EMA) methods in behavioral and mental health and the use of Ecological Momentary Interventions (EMI) using smart devices. The last section is about human activity recognition and the use of body worn sensors to mobile sensors and the different methods and classification techniques applied in those studies. 2.1 Smartphones as tools for Ubiquitous Computing Smartphones are widely used globally and users with smartphones contribute to more 70 percent of total mobile phone subscription globally [13]. A study reports that by 2025 there will be 5 billion smartphone users with state of the art technical capabilities far better than the current smartphones [1]. Smartphones have robust technical capabilities as they come with good computational powers. Mobiles are now less costly and are more advanced technologically. Computational capabilities of a mobile phone which is easy to carry makes it more advanced than a regular desktop computer [14]. The presence of different sensors in mobile phones such as GPS, accelerometer, gyroscope and other 5
CHAPTER 2. LITERATURE REVIEW sensor make them a handy tool to be used for application in the field of mHealth. This increasing trend of mobile phone users makes smartphones a potential tool for medical health care systems [15]. 2.2 Ecological Momentary Assessment and Psychological Interventions In clinical psychology, therapist rely on retrospective self reports to assess every day behavior of patients by asking questions about their state e.g how depressed they were, how many anxiety and panic attacks they experienced. These retrospective reports have their limitations as they are not in real time and do not represent the phenomenon occurring in real time. In behavioural research, EMA is a method to monitor and study behavior of subject in real world and real time to assess behavior patterns and to extract context-related information. In EMA data is collected in real time and it increases the ecological validity compared to clinical methods [3]. Smoking behavior of smokers after quitting has been monitored using EMA by asking them to record their cravings on the palm-top computers. [16]. EMA data collected with cellphones for cocaine addicted patients by using automated phone call interviews has usefulness in treatment of such patients [17]. To examine and assess the effect COVID-19 pandemic on mental health such as stress levels, depressive symptoms and loneliness using EMA survey on 80 university students in a recent study have been carried out [18]. Similar works with the use of smartphones to assist in treatment of mental disorders, drug has been used in a variety of works [14][19] [20]. Use of technology such as as mobile devices and palmtop computers to convey EMI are proven to be advantageous for both therapists and patients. Easy to carry and portable electronic devices makes it easy to deliver EMI to patients at any time without the need of visiting the clinic. EMI are provided to patients in real time and the patients have the time to apply these interventions in actual experience and adjust their behavior [21]. Applications of smartphone based systems such as sending text messages to patients are used as psychological interventions. Mobile phones are used to send text messages to patients with 6
2.3. HUMAN ACTIVITY RECOGNITION mental disorder treatment to improve their behavior. [14]. Participants provided with EMI to increase physical activity through palmtop computers reported a higher physical activity as compared to those participants with clinical instructions [22]. 2.3 Human Activity Recognition Human activity recognition has been in use for a long time now in different domains such fitness tracking, health monitoring, fall detection and home/work automation [23]. In the early research studies, heavy devices were used to collect data for human activity detection which does not suit real world scenario and seems unrealistic for practical use. Use of mobile devices makes it easier to collect data and can be used in daily life for activity detection [24]. Research studies on activity recognition have used external sensors and smartphone at different parts of the body for data collection and compared the results. Li and Stankovic used accelerometer and gyroscope to derive posture-information and proposed fast fall detection system [25]. For example previous studies used sensors at thigh, arm and chest position and some other used hip, ankle to see the results in terms of accuracy for activity recognition [26] [27]. Nisham and Nikhal used a tri-axial accelerometer by placing it near the pelvic region to detect different activities [28]. Five bi-axial accelerometers are used and placed at different parts of the body i.e hip, wrist, upper arm, ankle and thigh to monitor 20 different human activities. The accelerometer at thigh position indicated better accuracy of activity detection [29]. A number of other studies have also shown to use the mobile phone in the pocket for activity detection and achieved good activity recognition results [24] [30]. The techniques for feature extraction are time domain, frequency domain and discrete representation domain. In most of the studies, activity recognition is considered as a supervised machine learning problem and generally it consist of four stages which includes pre-processing, feature extraction, model training and classification. Activity classification is performed on extracted features from raw accelerometer data [31] [32]. Window overlapping technique has been used for features extraction [33]. 7
CHAPTER 2. LITERATURE REVIEW In a comparative review of features extraction techniques, Figo has compared the computational cost and storage capacity of these techniques [34]. The frequency domain techniques has overall a higher cost than the remaining two techniques. Time domain techniques has the lowest computational cost and storage requirement. Time domain techniques have also proved to yield high activity recognition accuracy [35]. There are a number of classification techniques used in activity recognition depending upon the context in which it is used. Simple heuristic classifiers have been investigated for activity classification [36]. Khan and Lee have used augmented auto-regressive model co-efficient and artificial neural nets for activity recognition using accelerometer data [37]. Ermes and PÄrkkÄ used four different classifiers automatically generated decision tree, custom decision tree, artificial neural network (ANN) and hybrid model for detection of sports and daily activities using wearable sensors [38]. Similarly, Multi-layer Perceptron (MLP) Neural Networks (NNs) has been used classify walking patterns using time-frequency features from tri-axial accelerometer data [39]. Multi-layer Perceptron (MLP) provides best results compared to DT and SVM classifiers [40]. 8
CHAPTER 3 TO O L S A N D TE C H N O L O G I E S This chapter provides details about the tools and technologies used to develop this research project. The first section of the chapter summarises the Android-based development, the access to sensors and the main classes and API methods of Android Studio which are relevant to the development of this thesis. The last part demonstrates the use of Python language and respective libraries for data processing and machine learning. 3.1 Android Development Smartphones are mainly divided into two major operating systems (OS) i.e. Android, iOS. Android development is the process of developing mobile applications for Android operating system [41]. The applications developed in this project are android based hence android development environment has been used. Android applications are written in Java, Kotlin and C++ programming languages mainly. Android Studio, an Integrated Development Environment (IDE) has been used for application development. The development code of applications for this project is written in Java which is an object-oriented language based on class implementation. 9
CHAPTER 3. TOOLS AND TECHNOLOGIES 3.1.1 Wear OS Application WearOS is an android operating system used in wearable such as smartwatches. Wear OS by Google allows developers to develop applications that can be used on smartwatches. Wear OS applications can be developed to access smartwatch resources like sensors to get valuable information [42]. A WearOS app can be standalone i.e. it can be developed and used independently of a handheld device or it can be used with a mobile phone. In this study project, the WearOS application for collecting data is not a standalone application rather it is used with a mobile phone application. 3.1.2 Smartphone and Smartwatch Sensors Smartphones are now equipped with built-in sensors that can be used to collect information about the mobile device or the surroundings [43]. Android operating system devices have categorically three type of sensors which are as follows: • Motion Sensors: These can be used to detect the motion of mobile device and changes in motion. Accelerometer, gyroscope and gravity are categorized as motion sensors. • Environmental Sensors: These sensors give information about the surrounding environmental variables. Examples includes temperature, humidity sensors. • Position Sensors: These sensors are used to compute the device position. Magnetometers and orientation sensor are examples of such sensors. 3.1.3 Message Client Message Client is an abstract class of the Google APIs for android which is used to send message to connected nodes in a network. Nodes in a network are the devices connected to each other. The Message Client API can be used send message to a node to start a certain activity. From android documentation [44] Message client methods can attach the following to them: • An arbitrary payload not more than 100Kb (optional) 10
3.2. DATA PROCESSING AND MACHINE LEARNING TOOLS • A message path to the target node which can be used to identify/perform an action 3.1.4 Data Client Data Client is a public abstract class of the Google API for android, similar to Message Client class. It allows to sync and send data items across devices in the network. A data item can be defined as a link to sync items between a smartphones and wearable devices such as smartwatch. A data item can also be used to send large files such as media which can be attached to a data item as an Asset and it can be received at the target node. The use of sending Asset is important to the application development in this research as it will be used to send smartwatch data files to smartphone as described in Section 4.1. 3.2 Data Processing and Machine Learning Tools 3.2.1 Python Python is a high-level, object oriented programming language which is used in data science, tasks automation, web development and in applications of artificial neural networks. Python is an easy to learn language due to its easy syntax, readability and scale-ability. Python provides many complete built-in packages and modules which makes it easier for its users to reuse the code for different projects [45]. 3.2.2 Libraries • Pandas is a fast and reliable python library which is used for data science and data analytics. Pandas has simple built-in functions which can be used for a range of task from data cleaning to data analytics [46]. • Sci-kit learn is a machine learning library in python built on NumPy, matplotlib and Scipy which is an efficient tool used in predictive analysis [47]. 11
CHAPTER 4. METHODOLOGY values may misrepresent the actual activity, the following step has been used using pandas library to discard noise values. • Removal of first 500 values • Removal of last 500 values As there are 50 records per second which mean that data records for first and last 10 seconds are removed from the data given by the pandas command: df_clean=df_data.iloc[500:-500] 4.2.1.2 Data Matching The raw collected data from both sources needs to be matched together for the following reasons: • Collected raw data from both sources has different timestamp values due to the fact that both devices are running separately on different systems but collecting data simultaneously. This creates a timestamp difference in milliseconds. • The communication between mobile and smartwatch depends on Bluetooth. As described in 4.1 the time to receive message by the target node (smartwatch) creates a time lag which results in delayed data collection on smartwatch. • The sampling rate of 50 Hz is not always the same during data collection. This is justified according to Android documentation [49] which states that the sampling rate is just an indication to the system to collect data at a certain frequency but it is possible that the sensor events may be received at a faster or slower rate. In our data the sampling rate ranges from 49 Hz to 51 Hz for smartphone and 50 Hz to 54 Hz for smartwatch. To solve the problems stated above, it is important to devise a solution which ensures that data records from both devices are matched together based on their timestamp in seconds and the sampling rate for both devices is made equal. We applied the following techniques to achieve this in the order of the problems stated above: 18
4.2. DATA PROCESSING • The timestamps values from unix timestamp format are first converted to datetime format. Afterwards milliseconds part is discarded from the timestamp which is helpful in the next steps. 4.2.1.2 shows the process for one second only. timestamp x . z 1609869226004 1.619 .−9.77 1609869226022 1.622 .−9.77 1609869226041 1.624 .−9.782 . . . . . . . . 1609868220644 1.607 .−9.804 ⇒ timestamp x y z 5:53:46 1.619 .−9.77 5:53:46 1.622 .−9.77 5:53:46 1.624 .−9.782 . . . . . . . . 5:53:46 1.607 .−9.804 • To remove the time lag between the data sources, the starting and ending timestamps of both sources are compared. Those records at the beginning and end of two datasets which do not match with each other are discarded. • The last step involves creating unique values against each second ranging from 1-54 depending on the number of records received by the system for each second. The next step is to compare the two data sources based on two columns i.e ’newtime’ and ’uv’ . Only matching records based on timestamp and uniques values are used. Here newtime and uv refers to the time in datetime format and unique values respectively. This step is important for later stages of data fusion. The process for sample data is shown in Figure 4.5 4.2.2 Feature Extraction Before the data can be used for activity detection it is important to extract features from raw data. These extraction features techniques can be categorized into three major domains: the time domain, the frequency domain and discrete representation domain [34]. Each domain is further is classified in different classes as show in Figure 4.6. In the time domain different statistical and mathematical techniques are used to extract features such as mean, median, mode, variance, std deviation. Frequency domain features are related to periodicity and repetitiveness of the sensor signal and include techniques like Fourier 19
CHAPTER 4. METHODOLOGY Figure 4.5: Data Matching based on timestamp and unique values transformations and wavelet transformations etc. Some features as result of frequency domain are spectral energy, entropy, dominant frequency. Discrete domain techniques involves reconstruction of data signals into discrete symbols. In this study we have used time domain techniques to extract features from raw accelerometer data. The features from raw data are extracted by using the window overlapping technique. Using this technique the data is divided into a subset of smaller data sets and features are computed on an overlapping window to reduce data loss at the end of the of window [30]. 4.2.3 Selected features In previous studies different kind of features have been extracted from raw data depending on the type and the context of activity recognition. For example in the study [50] Median, Mode and Correlation between x and z are ranked among the top 5 features for activity recognition. In [51] Median, Mode, Average, RMS and Standard deviation are identified as the top ranked discriminative features for activity recognition. Difference between the maximum and minimum of signal have been 20
4.2. DATA PROCESSING Figure 4.6: Feature Extraction Techniques [34] used to discriminate between walking and running [52]. The root mean square (RMS) of accelereometer signal has been used to detect activity patterns [53]. The features selected for this study based on literature review are given in the Table 4.1 Table 4.1: Number of samples for each activity from collected data Feature Description Mean The mean of the signal over window Median The median of the signal over window Maximum The maximum across the signal over the window Minimum The minimum across the signal over the window Standard Deviation Dispersion of the signal from its mean Root Mean Square quadratic mean of the values of signal Range Difference between max and min of signal over window Difference Mean difference between two continous signals Zero crossing No. of times a signal cross a certain value Pitch Rotation of device across y and z-axis Roll Rotation of device across x and z-axis The Feature Vector after extraction of features from raw data consists of 29 extracted features. 9 out of 11 features are extracted for all the three axis i.e x-axis, y-axis and z-axis. Pitch and roll are the angular features which represent the rotation of device along two axis and is computed as an angle. The equations for computing these are 21
CHAPTER 4. METHODOLOGY given by [35]. β=180 π·arctan(y/g, z/g)(4.1) α=180 π·arctan(x/g, z/g)(4.2) β and α represent pitch and roll respectively where as g is the gravitation acceleration whose value is 9.81 m/s2. 4.2.4 Combining Sensor Data There are three neural network based on the type of data used as input. The two datasets from smartphone and smartwatch are used separately. The input to third model is based on the fusion of this data. Similar to [54] features from the two datasets are extracted independently and then concatenated together to obtain a combined feature vector. 22
CHAPTER 5 EX P E R I M E N TA L DE S I G N This chapter discusses details about the experimental setup, the amount of data collected and machine learning model configuration. 5.1 Experimental Design This section describes the implementation of the methods discussed in above sections. Data is collected for eight activities specified in Section 4.1 for approximately 28-35 minutes. Features are extracted from data after pre-processing. These features are calculated with a overlapping window of 1 second with time shift of 0.5 seconds. Data samples after feature extraction for each activity are given in the Table 5.1 Table 5.1: Number of samples for each activity from collected data Activity Type No. of samples LIE-STAND (LS) 3162 SIT-STAND (SS) 4491 LYING DOWN (LD) 4383 RUN (R) 2904 SIT NORMAL (SN) 4933 SIT FEAR (SF) 4173 STILL (ST) 4276 WALK (W) 3904 These extracted features are used an input data for to train the neural network model. The data has been split into train, test and 23
CHAPTER 5. EXPERIMENTAL DESIGN validation set using the sci-kit built-in function. Initially the samples are divided into 75-25 percent training and testing data respectively. The training data is further split into 80-20 percent for training and validation. The validation data is important as it is used to evaluate the model fit to fine-tune the parameters of the model to improve model performance. Figure 5.1: Training, Test and Validation Data Split 5.2 Machine Learning and Model Architecture The model architecture used in this work is similar to one proposed in previous similar study by [12] for single data input. A short summary of the model architecture is given below: Table 5.2: Model Architecture Input Units 29 (Single) and 58 (Fusion) Hidden Layer 1 Rectified Linear Units (ReLU) 512 Output Units 8 The parameters chosen for training data are given in the Table 5.3. • Learning rate: It is a tuning parameter which indicates the step size over each iteration • Decay: It determines the rate at which the learning rate is reduced • Momentum: The rate at which the learning rate is increased in a neural network. 24
5.2. MACHINE LEARNING AND MODEL ARCHITECTURE • Batch size: It refers to number of training samples used in one cycle of the learning phase • Epoch: The number of cycles data samples have to complete for training. Table 5.3: Model Configuration Learning Rate 0.001 Decay 1e-6 Momentum 0.09 Loss Function Categorical Cross Entropy Batch size 50 Epoch 20 25
CHAPTER 6 RE S U L T S A N D EVA L U A T I O N This chapter discusses detailed analysis of the results and performance of models described in Chapter 4. It follows a section-wise discussion of the smartphone, smartwatch and fused data model. The last part of the chapter provides a summary of the results. Using the training data described in Section 5.1 the neural network has been trained with 19334 training samples of eight activities. To evaluate the performance of model 8056 samples from testing data are used. The the details for number of samples in both training and test dataset are given in the Table 6.1: Table 6.1: Number of samples in Train and Test dataset Activity Type No. of training samples No. of test samples LIE-STAND (LS) 1886 790 SIT-STAND (SS) 2706 1123 LYING DOWN (LD) 2614 1096 RUN (R) 1753 726 SIT NORMAL (SN) 2914 1233 SIT FEAR (SF) 2508 1043 STILL (ST) 2622 1069 WALK (W) 2331 976 Model performance is evaluated by the overall accuracy metrics namely precision, recall and F1-score. A high precision value show a lower number of false positives (FP) while a high recall values shows 27
CHAPTER 7. CONCLUSION the type of activities are walking, sitting, standing and driving. The first there activities can be easily distinguished by our model using only mobile data. Secondly, in the above literature extracted features from raw data are arithmetic mean (AM) and standard deviation (STD) only and different evaluation metrics are used to assess the performance of the model. In our work we have suggested more similar activities like LYING DOWN and SITTING which are very identical to each other due to the stationary state, also we have added two transition-state activities i.e SIT-STAND and LIE-STAND to detection system. The results from model for the newly included activities using fusion data are good compared to using a single source of data. 7.2 Research Objectives and their solutions Objective 1: Integrate multi-channel data collection to improve accuracy of the activity recognition Solution 1: The first objective in this work in achieved by collecting data by adding a new source of data i.e the smartwatch data by developing a Wear OS application and integrating it with the Android application. This allows up to collect sensor data simultaneously. Objective 2: To add the detection of new activities to the existing system Solution 2: Three new activities ’LYING DOWN’(LD), ’LIE-STAND’ (LS) and ’SIT-STAND’ (SS) have been added to be detected by the system. Smartphone data used separately is unable to detect between SIT NORMAL (SN) and LYING DOWN (LD), therefore, the addition of smartwatch collected data adds a solution to detect these two very similar activities. Two transition activities ’LS’ and ’SS’ have also been added. Objective 3: To compare the activity detection accuracy using singlechannel and multi-channel data Solution 3: Comparison of single-channel and multi-channel data shows that the results obtained by combining data from two sensors are very good in terms of accuracy as compared to when only one source of data is used to detect these activities. 34
7.3. LIMITATIONS 7.3 Limitations Due to time limitations, the model performance is calculated only on test data. A better idea is to use this neural network embedded in a mobile application. This embedded model can then provide activity recognition in real-time when the user is performing activities. 7.4 Future Work In the above section, it has been discussed that in future we assess the model performance by implementing this neural network in a mobile application and perform our daily routine and then the model shall be able to perform activity recognition. The number of extracted features used in this study can be reduced to a low number of features by keeping only significant features contributing to the performance of the model. Dimensionality reduction techniques such as PCA can be used further. This will save computational cost in training and testing. Another way forward from this research is to develop a more robust system for a higher number of activities using multi-channel data based on psychological contexts. Additional data stream from smartphone or smartwatch can be added to provide contextual information of the user with better understanding of the scenario e.g. addition of heart beat data can help us in extracting better and enriched information. 35
BI B L I O G R A P H Y [1] G. Miller. “The Smartphone Psychology Manifesto.” In: Perspectives on Psychological Science 7.3 (2012), pp. 221–237. I S S N : 17456916. D O I:10.1177/1745691612441215. [2] J. E. Bardram, M. Frost, K. Szántó, M. Faurholt-Jepsen, M. Vinberg, and L. V. Kessing. “Designing mobile health technology for bipolar disorder: A field trial of the MONARCA system.” In: Conference on Human Factors in Computing Systems - Proceedings (2013), pp. 2627–2636. D O I:10.1145/2470654.2481364. [3] S. Shiffman, A. A. Stone, and M. R. Hufford. “Ecological Momentary Assessment.” In: Annual Review of Clinical Psychology 4.1 (2008), pp. 1–32. I S S N : 1548-5943. D O I :10.1146/annurev. clinpsy.3.022806.091415. [4] T. R. Kirchner and S. Shiffman. “Spatio-temporal determinants of mental health and well-being: advances in geographically-explicit ecological momentary assessment (GEMA).” In: Social Psychiatry and Psychiatric Epidemiology 51.9 (2016), pp. 1211–1223. I S S N : 09337954. D O I:10.1007/s00127-016-1277-5. [5] S. Saeb, Mi Zhang, M. Kwasny, C. J. Karr, K. Kording, and D. C. Mohr. “The relationship between clinical, momentary, and sensor-based assessment of depression.” In: 2015 9th International Conference on Pervasive Computing Technologies for Healthcare (PervasiveHealth) . 2015, pp. 229–232. D O I :10.4108/icst. pervasivehealth.2015.259034. [6] M. A. R. Ahad, J. K. Tan, H. S. Kim, and S. Ishikawa. “Human activity recognition: Various paradigms.” In: 2008 International Conference on Control, Automation and Systems . 2008, pp. 1896– 1901. D O I:10.1109/ICCAS.2008.4694407. 37
BIBLIOGRAPHY [7] Q. Li, J. A. Stankovic, M. A. Hanson, A. T. Barth, J. Lach, and G. Zhou. “Accurate, Fast Fall Detection Using Gyroscopes and Accelerometer-Derived Posture Information.” In: 2009 Sixth International Workshop on Wearable and Implantable Body Sensor Networks. 2009, pp. 138–143. D O I:10.1109/BSN.2009.46. [8] A. Anjum and M. U. Ilyas. “Activity recognition using smartphone sensors.” In: 2013 IEEE 10th Consumer Communications and Networking Conference (CCNC) . 2013, pp. 914–919. D O I : 10.1109/CCNC.2013.6488584. [9] D. Iskandaryan. Visualization and Visual Analytics Of Geospatial Data For Psychological Treatment . Tech. rep. 2018. U R L :http: //repositori.uji.es/xmlui/handle/10234/173976. [10] F. G. Gebreegziabiher. Connecting addicted patients and therapists based on GPS for providing context-aware notification . Tech. rep. 2019. U R L :http://repositori.uji.es/xmlui/handle/10234/ 182271. [11] Meles Alema. Using Location-Based Services to Improve Mental Health Interventions . Tech. rep. 2020. U R L :http://repositori.uji. es/xmlui/handle/10234/187010. [12] M. M. Sanz. “Mejoras en el reconocimiento de actividades con redes neuronales para terapias de salud mental.” In: Universitat Jaume I (2020). [13] Ericsson. “Ericsson Mobility Report.” In: Mobility Report November (2019). [14] F. Gravenhorst, A. Muaremi, J. Bardram, A. Grünerbl, O. Mayora, G. Wurzer, M. Frost, V. Osmani, B. Arnrich, P. Lukowicz, and G. Tröster. “Mobile phones as medical devices in mental disorder treatment: an overview.” In: Personal and Ubiquitous Computing 19.2 (2015), pp. 335–353. I S S N : 16174909. D O I :10.1007/ s00779-014-0829-5. [15] B. Arnrich, O. Mayora, J. Bardram, and G. Tröster. “Pervasive healthcare paving the way for a pervasive, user-centered and preventive healthcare model.” In: Methods of Information in Medicine 49.1 (2010), pp. 67–73. I S S N : 00261270. D O I :10.3414/ME09- 02-0044. 38
BIBLIOGRAPHY [16] S. Shiffman. “Dynamic influences on smoking relapse process.” In: Journal of Personality 73.6 (2005), pp. 1715–1748. I S S N : 00223506. D O I:10.1111/j.0022-3506.2005.00364.x. [17] M. J. Freedman, K. M. Lester, C. McNamara, J. B. Milby, and J. E. Schumacher. “Cell phones for ecological momentary assessment with cocaine-addicted homeless patients in treatment.” In: Journal of Substance Abuse Treatment 30.2 (2006), pp. 105–111. I S S N: 07405472. D O I:10.1016/j.jsat.2005.10.005. [18] E. Fried, F. Papanikolaou, and S. Epskamp. “Mental Health and Social Contact During the COVID-19 Pandemic: An Ecological Momentary Assessment Study.” In: (2020), pp. 1–16. D O I :10. 31234/osf.io/36xkp. [19] D. De Beurs, O. Kirtley, A. Kerkhof, G. Portzky, and R. C. O’Connor. “The role of mobile phone technology in understanding and preventing suicidal behavior.” In: Crisis 36.2 (2015), pp. 79–82. I S S N : 21512396. D O I:10.1027/0227-5910/a000316. [20] K. E. Heron, R. S. Everhart, S. M. McHale, and J. M. Smyth. “Using Mobile-Technology-Based Ecological Momentary Assessment (EMA) Methods With Youth: A Systematic Review and Recommendations.” In: Journal of Pediatric Psychology 42.10 (May 2017), pp. 1087–1107. I S S N : 0146-8693. D O I :10.1093/jpepsy/jsx078. eprint: https://academic.oup.com/jpepsy/article-pdf/42/10/ 1087/21299857/jsx078.pdf. U R L :https://doi.org/10.1093/ jpepsy/jsx078. [21] K. E. Heron and J. M. Smyth. “Ecological momentary interventions: Incorporating mobile technology into psychosocial and health behaviour treatments.” In: British Journal of Health Psychology 15.1 (2010), pp. 1–39. I S S N : 1359107X. D O I :10.1348/ 135910709X466063. [22] A. C. King, D. K. Ahn, B. M. Oliveira, A. A. Atienza, C. M. Castro, and C. D. Gardner. “Promoting Physical Activity Through Hand- Held Computer Technology.” In: American Journal of Preventive Medicine 34.2 (2008), pp. 138–142. I S S N : 07493797. D O I :10. 1016/j.amepre.2007.09.025. 39
BIBLIOGRAPHY [23] J. W. Lockhart, T. Pulickal, and G. M. Weiss. “Applications of mobile activity recognition.” In: UbiComp’12 - Proceedings of the 2012 ACM Conference on Ubiquitous Computing (2012), pp. 1054– 1058. D O I:10.1145/2370216.2370441. [24] F. Ramos, A. Moreira, A. Costa, R. Rolim, H. Almeida, and A. Perkusich. “Combining smartphone and smartwatch sensor data in activity recognition approaches: An experimental evaluation.” In: Proceedings of the International Conference on Software Engineering and Knowledge Engineering, SEKE 2016-January (2016), pp. 267–272. I S S N: 23259086. D O I:10.18293/SEKE2016-040. [25] Q. Li, J. A. Stankovic, M. A. Hanson, A. T. Barth, J. Lach, and G. Zhou. “Accurate, Fast Fall Detection Using Gyroscopes and Accelerometer-Derived Posture Information.” In: 2009 Sixth International Workshop on Wearable and Implantable Body Sensor Networks. 2009, pp. 138–143. D O I:10.1109/BSN.2009.46. [26] H. Ghasemzadeh and R. Jafari. “Physical Movement Monitoring Using Body Sensor Networks: A Phonological Approach to Construct Spatial Decision Trees.” In: IEEE Transactions on Industrial Informatics 7.1 (2011), pp. 66–77. D O I :10.1109/TII.2010. 2089990. [27] U. Maurer, A. Smailagic, D. P. Siewiorek, and M. Deisher. “Activity recognition and monitoring using multiple sensors on different body positions.” In: International Workshop on Wearable and Implantable Body Sensor Networks (BSN’06) . 2006, 4 pp.–116. D O I : 10.1109/BSN.2006.6. [28] M. L. L. Nishkam Ravi,Nikhil Dandekar ,Preetham Mysore. “Activity recognition from accelerometer data.” In: Lecture Notes in Networks and Systems 43 (2019), pp. 317–329. I S S N : 23673389. D O I:10.1007/978-981-13-2514-4_27. [29] L. Bao and S. S. Intille. “Activity Recognition from User-Annotated Acceleration Data.” In: Pervasive Computing . Ed. by A. Ferscha and F. Mattern. Berlin, Heidelberg: Springer Berlin Heidelberg, 2004, pp. 1–17. I S B N: 978-3-540-24646-6. 40
BIBLIOGRAPHY [30] A. Bayat, M. Pomplun, and D. A. Tran. “A Study on Human Activity Recognition Using Accelerometer Data from Smartphones.” In: Procedia Computer Science 34 (2014). The 9th International Conference on Future Networks and Communications (FNC’14)/The 11th International Conference on Mobile Systems and Pervasive Computing (MobiSPC’14)/Affiliated Workshops, pp. 450 –457. I S S N : 1877-0509. D O I :https://doi.org/10.1016/j.procs.2014.07. 009. U R L :http://www.sciencedirect.com/science/article/pii/ S1877050914008643. [31] J. Wannenburg and R. Malekian. “Physical Activity Recognition From Smartphone Accelerometer Data for User Context Awareness Sensing.” In: IEEE Transactions on Systems, Man, and Cybernetics: Systems 47.12 (2017), pp. 3142–3149. D O I :10.1109/ TSMC.2016.2562509. [32] A. Kansiz, M. A. Guvensan, and H. Irem. “Selection of Time- Domain Features for Fall Detection Based on Supervised Learning.” In: [33] P. Casale, O. Pujol, and P. Radeva. “Human Activity Recognition from Accelerometer Data Using a Wearable Device.” In: Pattern Recognition and Image Analysis . Ed. by J. Vitrià, J. M. Sanches, and M. Hernández. Berlin, Heidelberg: Springer Berlin Heidelberg, 2011, pp. 289–296. I S B N: 978-3-642-21257-4. [34] D. Figo, P. C. Diniz, D. R. Ferreira, and J. M. Cardoso. “Preprocessing techniques for context recognition from accelerometer data.” In: Personal and Ubiquitous Computing 14.7 (2010), pp. 645–662. I S S N : 16174909. D O I :10.1007/s00779- 010- 0293-9. [35] D. Coskun, O. D. Incel, and A. Ozgovde. “Phone position/placement detection using accelerometer:Impact on activity recognition.” In: 2015 IEEE Tenth International Conference on Intelligent Sensors, Sensor Networks and Information Processing (ISSNIP). 2015, pp. 1–6. D O I:10.1109/ISSNIP.2015.7106915. [36] F Foerster, M Smeja, and J Fahrenberg. “Detection of posture and motion by accelerometry: a validation study in ambulatory monitoring.” In: Computers in Human Behavior 15.5 (1999), pp. 571– 583. I S S N : 0747-5632. D O I :https://doi.org/10.1016/S0747- 41
BIBLIOGRAPHY 5632(99 ) 00037 - 0. U R L :https : / / www . sciencedirect . com / science/article/pii/S0747563299000370. [37] A. M. Khan, Y. K. Lee, and T. Kim. “Accelerometer signal-based human activity recognition using augmented autoregressive model coefficients and artificial neural nets.” In: 2008 30th Annual International Conference of the IEEE Engineering in Medicine and Biology Society . 2008, pp. 5172–5175. D O I :10.1109/IEMBS. 2008.4650379. [38] M. Ermes, J. PÄrkkÄ, J. MÄntyjÄrvi, and I. Korhonen. “Detection of Daily Activities and Sports With Wearable Sensors in Controlled and Uncontrolled Conditions.” In: IEEE Transactions on Information Technology in Biomedicine 12.1 (2008), pp. 20–26. D O I : 10.1109/TITB.2007.899496. [39] N. Wang, E. Ambikairajah, N. H. Lovell, and B. G. Celler. “Accelerometry Based Classification of Walking Patterns Using Timefrequency Analysis.” In: 2007 29th Annual International Conference of the IEEE Engineering in Medicine and Biology Society . 2007, pp. 4899–4902. D O I:10.1109/IEMBS.2007.4353438. [40] A. S. A. Sukor, A. Zakaria, and N. A. Rahim. “Activity recognition using accelerometer sensor and machine learning classifiers.” In: 2018 IEEE 14th International Colloquium on Signal Processing Its Applications (CSPA) . 2018, pp. 233–238. D O I :10.1109/CSPA. 2018.8368718. [41] Android Developers. Meet Android Studio | Android Developers . 2018. U R L :https://developer.android.com/studio/intro/ (visited on 01/22/2021). [42] Android Developers. Create and run a wearable app | Android Developers . U R L :https : / / developer. android . com / training / wearables/apps/creating (visited on 01/22/2021). [43] Android Developers. Sensors Overview | Android Developers . U R L :https://developer.android.com/guide/topics/sensors/ sensors{\_}overview (visited on 01/22/2021). [44] Android Developers. Send and receive messages on Wear | Android Developers . U R L :https://developer.android.com/training/ wearables/data-layer/messages (visited on 01/22/2021). 42
BIBLIOGRAPHY [45] Python Software Foundation. What is Python? Executive Summary | Python.org . U R L :https://www.python.org/doc/essays/ blurb/ (visited on 01/22/2021). [46] W. A. McKinney. Pandas : a Python Data Analysis Library . 2009. U R L:https://pandas.pydata.org/ (visited on 02/15/2021). [47] P. Virtanen et al. “SciPy 1.0: fundamental algorithms for scientific computing in Python.” In: Nature Methods 17.3 (2020), pp. 261– 272. I S S N : 15487105. D O I :10.1038/s41592- 019- 0686- 2. arXiv: 1907.10121. [48] Keras SIG. About Keras . 2020. U R L :https://keras.io/about/ (visited on 02/15/2021). [49] Android Developers. SensorManager | Android Developers . 2016. U R L :https://developer.android.com/reference/android/hardware/ SensorManager{\%}0Ahttps://developer.android.com/reference/ android/hardware/SensorManager{\#}getOrientation(float[],float[]) (visited on 01/26/2021). [50] O. Politi, I. Mporas, and V. Megalooikonomou. “Comparative Evaluation of Feature Extraction Methods for Human Motion Detection.” In: Artificial Intelligence Applications and Innovations . Ed. by L. Iliadis, I. Maglogiannis, H. Papadopoulos, S. Sioutas, and C. Makris. Berlin, Heidelberg: Springer Berlin Heidelberg, 2014, pp. 146–154. I S B N: 978-3-662-44722-2. [51] P. Casale, O. Pujol, and P. Radeva. “Human Activity Recognition from Accelerometer Data Using a Wearable Device.” In: Pattern Recognition and Image Analysis . Ed. by J. Vitrià, J. M. Sanches, and M. Hernández. Berlin, Heidelberg: Springer Berlin Heidelberg, 2011, pp. 289–296. I S B N: 978-3-642-21257-4. [52] J. Farringdon, A. J. Moore, N. Tilbury, J. Church, and P. D. Biemond. “Wearable sensor badge and sensor jacket for context awareness.” In: Digest of Papers. Third International Symposium on Wearable Computers . 1999, pp. 107–113. D O I :10.1109/ ISWC.1999.806681. 43