Activity Detection of Elderly People Using Smartphone Accelerometer and Machine Learning Methods
Muhammad Imran Khan1, Azhar Imran1, Abdul Haleem Butt1, Ateeq Ur Rehman Butt2
1 Department of Creative Technologies, Faculty of Computing & AI, Air University, Islamabad
2 Department of Computer Science, National Textile University, Faisalabad
* Correspondence: Azhar Imran (azhar.imran@mail.au.edu.pk)
Citation | Khan. M. I, Imran. A, Butt. A. H and Butt. A. R, “Activity Detection of Elderly People Using Smartphone Accelerometer and Machine Learning Methods”. International Journal of Innovations in Science and Technology, Vol 3, Issue 4, pp: 186-197, 2021
Received | Nov 27, 2021; Revised | Dec 19, 2021 Accepted | Dec 27, 2021; Published | Dec 28, 2021.
Abstract
Elderly activity detection is one of the significant applications in machine learning. A supportive lifestyle can help older people with their daily activities to live their lives easier. But the current system is ineffective, expensive, and impossible to implement. Efficient and cost-effective modern systems are needed to address the problems of aged people and enable them to adopt effective strategies. Though smartphones are easily accessible nowadays, thus a portable and energy-efficient system can be developed using the available resources. This paper is supposed to establish elderly people's activity detection based on available resources in terms of robustness, privacy, and cost-effectiveness. We formulated a private dataset by capturing seven activities, including working, standing, walking, and talking, etc. Furthermore, we performed various preprocessing techniques such as activity labeling, class balancing, and concerning the number of instances. The proposed system describes how to identify and classify the daily activities of older people using a smartphone accelerometer to predict future activities. Experimental results indicate that the highest accuracy rate of 93.16% has been achieved by using the J48 Decision Tree algorithm. Apart from the proposed method, we analyzed the results by using various classifiers such as Naïve Bays (NB), Random Forest (RF), and Multilayer Perceptron (MLP). In the future, various other human activities like opening and closing the door, watching TV, and sleeping can also be considered for the evaluation of the proposed model.
Keywords: Machine Learning; Activity Detection; Elderly-People; Activity Recognition, and Accelerometer.
INTRODUCTION
Machine learning has become a very active research topic nowadays. The goal of machine learning is to improve computer programs. These programs expand themselves when new data arrives and may teach it to change. Multiple applications for machine learning are available such as face detection, face reorganization, image classifications, voice reorganization, etc. Smartphones have become popular all over the world with several integrated sensors. Smartphones have a wide range of sensors to record human interaction with our surroundings [1].Therefore, these devices assist in human activity recognition (HAR) [2].The increasing usage of smart home technologies, combined with machine learning techniques, can provide valuable insights into people’s behavior [3]. Human activity recognition (HAR) through sensors embedded in smartphones has allowed for the development of systems that are capable of detecting and monitoring human behavior [4]. The number of elderly people is increasing rapidly day-by-day and taking excellent care of them is becoming an enormous issue not only in developing countries but also in developed countries. Elderly people have some health issues that have to be resolved. Diabetes mellitus (DM) is the most common and serious chronic disease in the United States [7]. Many adults use drugs to manage chronic conditions such as heart disease, lung disease, arthritis, pain, and depression [8]. Human activity detection within smart homes is one of the bases of unobtrusive wellness monitoring of a rapidly aging population in developed countries [9].
Activity classification is a recent concept involving the use of technology to automatically recognize different activities and, in some cases, to collate this information into a continuous record [10]. Detection of adults' activities is a crucial task in the life of an adult because in this period of age, mostly old persons suffer due to some kind of disease and they need a caretaker for their health caring but in this modern and speedy age no one has much time to take care of an old one and cannot spare the whole day for this purpose. If the caretaker has a mechanism to alarm the time of the disaster, he can easily come near an old one, and take him to a hospital or take care of him during any critical situation. The use of dependencies can lead to elegant and well-performing models when a process is well understood [11]. Rapidly developing technology has made mobile and wireless devices part of daily life [12]. Machine learning techniques have widely been used to detect human activities but they mostly require infrastructure support, for example, installation of video cameras in the monitoring areas and the use of cameras is not the best technique in some cases, and some places, for example, bathroom camera is not good to capture the action of an old person. Smartphones can be used for Human Activity Recognition (HAR) through continuous monitoring of ADLs (Activity of daily life) [15, 18].
In our research work, we proposed a system using machine learning that detects the movement of elderly people using a smartphone accelerometer dataset. It will become a product which will be beneficial for elder people and very economical because we use the available resources to get data of elderly people. We are becoming statistics of aged people with the aid of the use of a cell phone accelerometer [19, 20], that is in their front pocket. Dataset has three axes, x, y, and z [16]. The x-axis represents the horizontal movement, the y-axis represents vertical movement, and the z-axis represents diagonal movement. After getting datasets, we processed the data and formulated it in a form in which many classifiers could be applied like: activity labeling, class balancing, and reducing the number of instances from huge data. Seven different activities can be detected. Different classifiers were applied on processed data, j48, nave based, MLP, and RF. By analyzing the dataset, results will be generated in the result set. The results of different activities are combined, and the maximum average accuracy of 93.16 is achieved through the Decision Tree J48 algorithm.
LITERATURE REVIEW
Activity detection of elderly people has gained worldwide attention over the last few years. There has been a lot of work done on early activity detection of elderly people using manual techniques. This study aims at activity detection of elderly people using machine learning algorithms. Sri Harsh et al. [1] perform analysis on smartphone data set by using machine learning algorithms. Some algorithm generates maximum accuracy in some kind of activities. Le et al. [2] work on fall detection by using mobile phone accelerometer data set, applying a random forest algorithm to get maximum accuracy. Kouta, et al. [3] detect the activities of elderly people by using the Internet of Things sensor and combining the classification and regression approaches. Montero Quispe et al. [4] work on mobile phone embedded sensor data and apply classification algorithm MBOSS, reduce the complexity of the computational process and generate features automatically. Anguita, et al. [5] used an SVM classification algorithm on mobile phone sensor data in the health care domain. Ravi, N et al. [6] distinguished in different activities to detect with the use of single accelerometer by mounted on the body of human being. And explain that short activities can be detected easily like opening and closing doors, etc. Chatterjee et al. build a monitoring system to track the activities of elderly people suffering from diabetes [7]. Wang et al. designed a model for elderly people to be aware of the current situation [8].
Ni et al. [9] describe the Elderly’s Independent Living in Smart Homes, several activities, and sensor based infrastructure surveys to provide Services. Assist to enhance the quality of life, prolong independent living and reduce caretaker’s time and minimize the healthcare cast in general, without losing the safety that continuous and unobtrusive monitoring provides. Preece et al. [10] explain their work in two phases, in the first one extract the feature of sensor date worn on the body, and the second phase applies advanced classification on data. Kasteren et al. [11] designed a wireless sensor network to detect the activities of elderly people applying the Morkv Model to recognize the number of activities. In the work of Özdemir, A. T., and Darshan, B. [12] machine learning techniques are used to recognize fall detection with wearable sensors. In elderly people fall is an area very risky factor in the health care domain. Vavoulas et al. [13] used a mobile phone accelerometer to get data and preprocess that data to detect falls and make a fall detection algorithm. Body-mounted and wearable devices are available to get data from elderly people. Casale et al. [14] perform a comparative study on the wearable accelerometer dataset and extract different features to apply a random forest classifier. Zia et al. [15] apply different classifiers on smartphone accelerometer data set to detect Activity of daily life and fall. Sayem et al. [16] used smartphone accelerometer data set to detect nursing activities, apply SVM, Random forest classifier to get maximum accuracy.
Mekruksavanich, S., and Jitpattanakul developed LSTM based framework to detect human activities [17]. They used a tri axes accelerometer and a tri-axis gyroscope for data gathering. Kadhum et al. [18] get the records by using a phone accelerometer and gyroscope records set to carry out extraordinary gadget learning algorithms to hit upon falls, the follow neural community, and SVM via the usage of WEKA tool. Bayat et al. [19] used the accelerometer records set of the phone positioned in a pent pocket to get the facts set and perform preprocessing on information and integrate three distinctive classifier effects. Another work on activity detection of elderly people was performed by Porwal et al. [20] to preprocess the smartphone data to detect human activities by using machine learning techniques.
Though, there are a significant amount of work has been done previously. The accurate detection of elderly people’s activities is a challenging problem. The proposed method employed machine learning-based methods such as decision tree, naïve bays, random forest, and multilayer perceptron for elderly people’s activity detection in order to assist them for a better quality of life.
MATERIAL AND METHODS
We used datasets to evaluate our primary model. We used the smartphone accelerometer to get the reading of three different axes. The smartphone is located in the front pocket of a person. To collect data, we used a tri-axial accelerometer in the Android phone to measure acceleration. Data from this smartphone accelerometer includes the acceleration along the x-axis, y-axis, and z-axis [14]. The X-axis represents the horizontal/sideways movement of the user (x-axis), the y-axis represents vertical movement upward/downward, and the z-axis represents diagonal movement. The activity Detection system cannot perform the classification task directly on raw acceleration data. Generally, the classification will be performed after an informative data representation is created in terms of feature vectors as depicted in Figure 1.
Figure 1. Dataset Directions
The schematic of the proposed framework is given in Figure 2. The overall framework comprised dataset gathering, preprocessing, feature extraction, and classification of seven activities. These phases are explained in the underlying section.
Labeling activity: J48 algorithm cannot perform on numeric data but in accelerometer dataset the consist on numeric data there are three attributes and one class in the dataset so the class consist on number activities detected against the attributes and activities were in numeric values like one, two, etc. we labeled the number of Activities by replacing the numbers to A, B, C, D, E, F, and G. So, number of activities labeled as an alphabetic type of data in Table 1.
Figure 2. The architecture of the proposed Model for Activity Detection of Elderly People
Dataset: We collected a dataset from a Smartphone accelerometer placed inthe front pocket. The datasetis collected from 15 participants performing 7 activities as shown in Table 1.
Table 1. Activity Labeling
Sr. No |
Label |
Activity |
1 |
A |
Working on Computer |
2 |
B |
Stand Up, Walking |
3 |
C |
Standing |
4 |
D |
Walking |
5 |
E |
Going up and down Stairs |
6 |
F |
Walking and Talking |
7 |
G |
Talking and Standing |
Class Balancing: In the accelerometer dataset, the number of instances of one class is very high from other class, therefore, classification cannot work on this kind of dataset, then we performed the procedure of class balancing on the data set and separated the number of activities one by one in a single file of a class number of instances of this class named as ‘YES’ and the same quantity of instances of other class are named as ‘NO’. Imbalance data is not good for different kinds of classification algorithms, and data balancing is used to overcome this problem. The tabular representation of class balancing is shown in Figure 3.
Figure 3. Class Balancing
There are many existing mechanisms for activity detection systems, but the major issues are the security and accuracy of the system. To improve the problem of accuracy and the efficiency of the system, a very common classification approach i.e. J48 is employed in our study. Proposed research work introduces a framework to develop a classifier based on data mining techniques. The testing procedure is performed on the publicly available Weka Tool by using the Decision Tree J48 algorithm. The experimental results and visualization tree is given in Figure 4, and Figure 5, respectively.
Figure 4. Weka tool Classification Summary
Figure 5. Tree Generated by Weka Tool
RESULT
The proposed study comprised of three major phases: first data gathering while using a smartphone accelerometer to get the reading of movement of person the accelerometer dataset consists of three axes, x, y, and z-axis the reading consist of the how many points body is up from the earth, x-axis consists on the vertical position of a body, y consist on the horizontal position of a body, and the z-axis contains the diagonal position of a body. Second, the various preprocessing techniques are implemented on the accelerometer dataset. In this phase, we concise the number of instances by getting the average value of every 52 instances because the dataset consists of 52 instances in one second. So, we got the one instance in one second by preprocessing the dataset, then we separated the classes and balanced the instance of every class. Thirdly, we employed various machine learning algorithms such as Naïve Bays, Random Forest, Multilayer Perceptron, and Decision Tree (J48) classifier for elderly people activities detection and performed comparison of these method by using various performance metrics i.e. accuracy, sensitivity, specificity, precision, and AUC as depicted in Table 3.
Table 2. Accuracy of Classifiers
Activities |
J48 |
Naïve Bays |
MLP |
RF |
A |
98.7 |
98.05 |
98.5 |
98.9 |
B |
92.1 |
81.5 |
68.4 |
84.21 |
C |
98.38 |
98.38 |
99.07 |
99.5 |
D |
83.5 |
77.91 |
85.4 |
84.92 |
E |
94.2 |
82.6 |
95.04 |
95.04 |
F |
96.19 |
95.23 |
94.2 |
95.23 |
G |
89.05 |
75 |
83.45 |
89.59 |
**The average accuracy of 93.16 is achieved by using Decision Tree J48.
Table 3. Performance Comparison of ML Methods
Classifier |
Sensitivity |
Specificity |
Precision |
AUC |
J48 |
97.88 |
98.8 |
98.9 |
99.1 |
Naïve Bays |
94.5 |
91.25 |
88.25 |
87.35 |
MLP |
97.5 |
96.9 |
98.35 |
97.25 |
RF |
87.5 |
86.5 |
84.5 |
85.75 |
DISCUSSION
To attain maximum accuracy, we performed different preprocessing steps on our dataset and then applied different classifiers on the dataset for better classification performance. There isa total of seven files are locally stored and named from A to G. We stored the number of instances of activity
‘A’ and stored the equal number of instances of other activities and named as ‘YES’ for activity ‘A’ instances and the rest of the instances of activities are termed as ‘NO’. In the second file, we store the number of instances of B activity and store the same number of instances of other activity, class of B activity named YES and other to NO. In the third file, we store the number of instances of C activity and store the same number of instances of other activity, class of C activity named YES and other to NO. In the fourth file, we stored the number of instances of D activity and stored the same number of instances of other activity, class of D activity named ‘Yes’ and other to ‘No’. In the fifth file, we stored the number of instances of E activity and stored the same number of instances of other activity, class of E activity named YES and other to NO. In the sixth file, we stored the number of instances of F activity and stored the same number of instances of other activity, class of F activity named YES and other to NO. In the seventh file, we stored the number of instances of G activity and stored the same number of instances of other activity, class of A activity named YES and other to NO. The accuracy of the different classifiers is illustrated in Figure 6.
Figure 6. Accuracy graph of various ML methods for elderly people activity detection
Beyond the accuracy measure, machine learning methods are also evaluated using various statistical measures such as sensitivity, specificity, precision, and area under the curve (AUC), respectively. The statistical diagram of these performance evaluation results is illustrated in Figure 7. It can be concluded that the decision tree algorithm (J48) has outperformed the baseline methods for elderly people's activity detection.
Figure 7. Performance comparison of various ML methods for elderly people activity detection
CONCLUSION
With the advances in technology, sensors embedded in handheld devices have initiated a ground to develop a system for activity detection of elderly people. However, the traditional systems have been affected by the major ingesting of computational resources such as processing units, and memory, etc. Thus, it is required to efficiently detect human activities to provide them aid at the earliest. Moreover, most of the existing human activity detection systems are heavily dependent on the subject’s expertise and are expensive. This paper proposes a novel method for activity detection of elderly people using state-of-the-art machine learning methods. The experimental results indicate that the proposed method increases the efficiency of human activity recognition (HAR) and also maintains accuracy. In the future, we intended to implement deep learning algorithms, add more activities, and use various other sensors for activity detection.
Acknowledgement. The authors would like to thank the Department of Creative Technology, Air University Islamabad for providing a lab to work in a comfortable environment.
Author’s Contribution. M. Imran conceived results. A. Imran wrote the manuscript. A.H. Butt revised the manuscript. A.R. Butt improved the methodology and conclusion section.
Conflict of interest. The authors declare that there is no conflict of interest.
Project details. Nil
REFERENCES
[1] Sri Harsha, N. C., Anudeep, Y., Vikash, K., & Ratnam, D. V. “Performance Analysis of Machine Learning Algorithms for Smartphone-Based Human Activity Recognition”“Wireless Personal Communications"2021, 121(1), 381-398.
[2] Le, H. L., Nguyen, D. N., & Nguyen, H. N. “The Novel Method of Pedestrian Fall Detection Based on PSO and RF Using Accelerometer Data”“International Conference on System Science and Engineering (ICSSE)” 2021, 111-115.
[3] Koutli, M., Theologou, N., Tryferidis, A., & Tzovaras, D.“Abnormal Behavior Detection for elderly people living alone leveraging IoT sensors”“IEEE 19th International Conference on Bioinformatics and Bioengineering (BIBE)”2019, 922-926.
[4] Montero Quispe, K. G., Sousa Lima, W., Macêdo Batista, D., & Souto, E. “MBOSS: A symbolic representation of human activity recognition using mobile sensors”“Sensors” 2018, 18(12), 4354.
[5] Anguita, D., Ghio, A., Oneto, L., Parra, X., & Reyes-Ortiz, J. L. “Human activity recognition on smartphones using a multiclass hardware-friendly support vector machine”“International workshop on ambient assisted living” 2012, 216-223.
[6] Ravi, N., Dandekar, N., Mysore, P., & Littman, M. L. “Activity recognition from accelerometer data”“Aaai” 2005, Vol. 5, 1541-1546.
[7] Chatterjee, S., Dutta, K., Xie, H., Byun, J., Pottathil, A., & Moore, M. “Persuasive and pervasive sensing: A new frontier to monitor, track and assist older adults suffering from type-2 diabetes”“46th Hawaii international conference on system sciences” 2013, 2636-2645.
[8] Wang, J., Cheng, Z., Zhang, M., Zhou, Y., & Jing, L.“Design of a situation-aware system for abnormal activity detection of elderly people”“In International Conference on Active Media Technology” 2012, 561-571.
[9] Ni, Q., Garcia Hernando, A. B., la Cruz, D., & Pau, I. “The elderly’s independent living in smart homes: A characterization of activities and sensing infrastructure survey to facilitate services development”“Sensors” 2015, 15(5), 11312-11362.
[10] Preece, S. J., Goulermas, J. Y., Kenney, L. P., Howard, D., Meijer, K., & Crompton, R.“Activity identification using body-mounted sensors—a review of classification techniques”“Physiological measurement” 2009, 30(4), R1.
[11] Van Kasteren, T. L. M., Englebienne, G., & Kröse, B. J.“An activity monitoring system for elderly care using generative and discriminative models”“Personal and ubiquitous computing”2010, 14(6), 489-498.
[12] Özdemir, A. T., & Barshan, B.“Detecting falls with wearable sensors using machine learning techniques”“Sensors”2014, 14(6), 10691-10708.
[13] Vavoulas, G., Pediaditis, M., Spanakis, E. G., & Tsiknakis, M.“The MobiFall dataset: An initial evaluation of fall detection algorithms using smartphones”“In 13th IEEE International Conference on Bioinformatics and BioEngineering” 2013, 1-4.
[14] Casale, P., Pujol, O., & Radeva, P. “Human activity recognition from accelerometer data using a wearable device”“In Iberian conference on pattern recognition and image analysis” 2011, 289-296.
[15] Zia, S., Khan, A. N., Zaidi, K. S., & Ali, S. E. “Detection of Generalized Tonic-Clonic Seizures and fall in Unconstraint Environment Using Smartphone Accelerometer”“IEEE Access” 2021, 9, 39432-39443.
[16] Sayem, F. R., Sheikh, M. M., & Ahad, M. A. R. “Feature-based Method for Nurse Care Complex Activity Recognition from Accelerometer Sensor”“In Adjunct Proceedings of the 2021 ACM International Joint Conference on Pervasive and Ubiquitous Computing and Proceedings of the 2021 ACM International Symposium on Wearable Computers” 2021, 446-451.
[17] Mekruksavanich, S., & Jitpattanakul, A.“Lstm networks using smartphone data for sensor-based human activity recognition in smart homes”“Sensors” 2021, 21(5), 1636.
[18] Kadhum, A. A., Al-Libawy, H., & Hussein, E. A. “An accurate fall detection system for elderly people using smartphone inertial sensors”“Journal of Physics Conference Series” 2020, Vol. 1530, No. 1, 012102.
[19] Bayat, A., Pomplun, M., & Tran, D. A.“A study on human activity recognition using accelerometer data from smartphones”“Procedia Computer Science” 2014, 34, 450-457.
[20] Porwal, S., Singh, S., Yadav, N., & Garg, D. “Review Paper of Human Activity Recognition using Smartphone”“5th International Conference on Trends in Electronics and Informatics (ICOEI)” 2021, 939-946.