<<

Annals of Advanced Biomedical MEDWIN PUBLISHERS ISSN: 2641-9459 Committed to Create Value for Researchers

Smartphone and for Human Activity Recognition

Esra’a Alshawwa, Mousa Al Zanina, Mohammed Ibbini and Mashhour M Bani Amer* Research Article Volume 4 Issue 1 Department of Biomedical Engineering, Jordan University of and Technology, Jordan Received Date: March 24, 2021 Published Date: May 04, 2021 *Corresponding author: Mashhour M Bani Amer, Department of Biomedical Engineering, DOI: 10.23880/aabsc-16000159 Jordan University of Science and Technology, Irbid, Jordan, : [email protected]

Abstract

Human activity recognition (HAR) systems are developed as aspect of a model to allow continual assessment of human behaviors in IoT environments in the areas of ambient assisted living, sports injury detection, elderly care, rehabilitation, and

entertainment and close . are already used to recognize activity. Most of the research done in this field system, to promote the process of classifying raw data from to human activities. solve this placed a restriction on fixing the smartphone securely in a certain location on the human body, along with the machine learning limitation by placing them in a consistent position, which becomes steady and precisely sensitive to body movements. For this

experiment, we evaluate both the and the on the smartphone and the smartwatch, and decide which sensors hybrid does superiorly. Five daily physical human activities are evaluated using five classifiers from WEKA, in addition to Artificial Neural Network (ANN), K- Nearest Neighbor (KNN), and Support Vector Machine (SVM) algorithms built- The results showed that the accelerometer sensors combination has the highest accuracy among other combinations and in MATLAB 2018a. We used confusion and random simulation to compare the accuracy and efficiency of those models.

Keywords:achieved an overall accuracy of 97.7% using SVM that gives the best performance among all other classifiers.

Accelerometer; Gyroscope Sensor; Human Activity Recognition; KNN; ANN; SVM Abbreviations: HAR: Human Activity Recognition; monitoring [2,3], assistance applications, emergency services, and transportation assistance services [4]. It is predicted that smart environments, which communicate WEKA: Waikato Environment for Knowledge Analysis; ANN: Artificial Neural Network; KNN: K- Nearest Neighbor; will be a correlative fraction of everyday life in the short term. SVM: Support Vector Machine; DCT: Discrete Cosine with the disabled or elderly according to their specific needs, ;Transformation; MP: Multilayer PCA: Principal Perceptron; Component RF: Random Analysis; Forest; SMA: LR: LogisticSignal MagnitudeRegression. Area; WISDM: Sensor Data TheGiven economic that the consequencesglobal rise in theof international older people senilityratio is canfirmly be mitigatedsignificant, by the encouraging aging in place the has overages been of extreme to remain significance. energetic Introduction and stable in their homes for long years, where living free is more normal and restful [5]. Unfortunately, increasing Human Activity Recognition (HAR) is the challenge of recognizing a physical activity conducted within a given environment by an individual based on a trace of toelderly manage population health by makesoneself itin infeasiblecooperation for with all healthcare homes of movement. HAR in an automated way is in many professionalselderly people is to unavoidable. assign a human caretaker, where the need ambient intelligence applications such as smart homes [1],

Smartphone and Smartwatch for Human Activity Recognition Ann Adv Biomed Sci 2 Annals of Advanced Biomedical Sciences

The smartphone has recently become an integral part of human regular activities and is turning into an increasingly sophisticated system with rising processing framework is outlined in Section III, the outcomes of the experiments are given in Section IV, and Section V sums up as 25% of people used a smartphone in 2015, and held our conclusionLiterature and Review explores scopes of future research. theircapacity, phone network wherever functionality they went and [6]. sensingIt also includes abilities. a Manylarge range of hardware sensors such as accelerometer, gyroscope, , , temperature, humidity, light sensor, connections and various mobile apps, smartphones and GPS receiver. Mobile health technology is the interchange haveWith become ever an integral greater part computing of our daily capabilities, lives, as described flexible of eHealth and [7]. Smartphone sensors above. Furthermore, even cheaper smartphones have a variety of sensors (accelerometer, GPS, and gyroscope, etc.) that allow human activities to be detected using a have turned into a data source to track different human smartphone. Oscar Lara and Miguel [9] Lobrador introduce thesebehaviors, behaviors for example, can be physicalused to activitiesmonitor consumersuch as running, safety walking, walking upstairs, and downstairs. The analysis of the researchWaikato Environmentcommunity of for machine Knowledge learning. Analysis This provides(WEKA), smartphoneand supply health to the care human services body on in time. order The to key get constraint the best enforcementswhich is definitely of many the learningmost well algorithms recognized and resource enables within them performanceimposed by thefrom current the raw systemsdata of the is tosmartphone firmly attach sensors. the to be readily tested for a dataset using, among others, cross- In reality, this is not a practical solution, because the user often needs to serve for calling, using the internet, social HAR. validation and random break. Therefore, it helps in solving in various places and then being subjected to dramatic movements.media, etc. on This the technique mobile, which involves means the readingskeeping thecontrolled device what we have employed in this project. Zhenyu and Lianwen by inertial sensors on the device, which could then display [10]Most describe articles a high-precision use extractions HAR of method features that different uses discrete from incorrect results. Smartwatches that are worn in a consistent

cosine transformation (DCT), Principal Component Analysis location [8], tackle this restriction. used(PCA), and Support Vector Machine (SVM) to distinguish smartwatch is to hold the smartwatch sensors (accelerometer various individual activities. Vollmer C, et al. [11] have and Thegyroscope key technologicalcoordinates) in justificationa location that for is usingstable and the [12] toShift-invariant identify Sparse Coding Algorithm for activity critical to movements of the human body. In other words, running,recognition. and SVM algorithm was implemented by Cho J, et al. measuring walking, moving up stairs, moving down stairs, generalized and distinct features to be utilized for outcomes motionless. The characteristics picked from the thatthe aforementionedare more reliable smartwatch in the system sensors of recognition can fit outof human more system magnitude data were area standard (SMA). deviation Additionally, of Y-axis, the activity. Y-axis correlation, Z-axis correlation, Y-axis autoregressive fitting and signal et al. [13] suggested a gait-based Advances in machine and deep learning techniques for mean, standard deviation, and pitch skew were chosen selecting features besides the addition of a variety of sensors waveletfor classification. transformation Boyle, was used to obtain characteristics will move the limits of recognition of human behavior to method for the identification of walking carried behaviors. out using The challenges by collecting and preprocessing available to the frommining raw was data, also and used the to identifyclassification and classify was HAR using some deeper epistemological levels. This project tackles the above the K-Nearest Neighbors (KNN) algorithm. Functions,WEKA Lazy, data Meta, Mi, Misc, Rules, and Trees) [14]. Some datasets were recognizepublic benchmark daily life activities.data, after Our which project we use describes machine the learning activity generatedof the classifier by researchers, algorithms submitted,(such as Bayes, and used by others and deep learning to predict and accurately and efficiently Data Mining) is a Fordham University published dataset, which includes recognition task and the procedure for performing this task acrossdata gathered the world. under WISDM controlled (Wireless and laboratory Sensor conditions using different machine learning algorithms including WEKA [15]. Only the accelerometer installed in the is data mining, artificial neural network (ANN), K-nearest used to collect data. The sampling rate is 20Hz and the total andneighbor descending), (KNN), andsitting, support and standing. vector machine (SVM), where we consider five activities: walking, jogging, stairs (ascending The remainder of the article is constructed as follows. instance count is 1,098,207. There are six features (user Section II introduces a literature review of human activity index, type of activity, time stamp, x, y and z-accelerations). recognition. The methodology proposed for the built (11.2%),The collection downstairs task involves (9.1%), twenty-nine sitting (5.5%), subjects. and Sixstanding tasks are classified (walking (38.6%), jogging (31.2%), upstairs

Mashhour M Bani Amer, et al. Smartphone and Smartwatch for Human Activity Copyright© Mashhour M Bani Amer, et al. Recognition. Ann Adv Biomed Sci 2021, 4(1): 000159. 3 Annals of Advanced Biomedical Sciences

(4.4%)). Time-domain characteristics are elicited from generalization with reduced computing time for smartphone the raw time series data in the publisher’s research, such and wearable sensor integration. as the average value, standard deviation, average absolute Studies have provided insight into techniques, which binned distribution. In a comparative study Maguire and difference, average resulting acceleration, peak time, and human potential using deep learning techniques to solve therequire above automatic problems extraction [24]. This of technique attributes is witha novel minimal path Frisby [16] used Weka Toolkit for behavior detection to of machine learning, which constitutes high-level data compare the output between KNN and J48 / C4.5. We also found that KNN achieves greater overall performance by of human activity. It involves several layers of neural using 10-fold cross-validation in various experiment . attributes. It has been a significant stream in recognition incorporation strategies that integrate various sensor styles or algorithmsRecently, severalto enhance studies validity, have reliability, suggested draw knowledge trust andnetworks, object which recognition, hierarchically the processing reflect features of modest from inferiorspeech, measures between different algorithms, and minimize the computerto superior. interpretation It has become and a vitalcircumferential work domain surveillance in image [25]. More recently, different methods of deep learning have connected to individual sensor approaches and boost the generalizationcomplication of [17]. the recognition system to tackle the obstacles based on smartphone and wearable sensors. Such deep learningbeen suggested techniques for thecan identificationbe piled into of various human layers behavior to Smartwatches have become more widespread in the create deep learning templates that deliver improved system the technology develops. A survey found that over 80% of to rely on standard handmade attributes. Deep learning smartwatchmarket-place users and thissaid trendsafe living is expected and to continueto medical as execution, resilience, strength and eliminate the necessity services are major advantages of [18]. There are several HAR studies in the literature that concentrate for analysis of time series has recently been examined on smartphones, and more lately on smartwatches [19- perspective[26,27]; another of time highly series associated usage of deep field learning in the that recognition include 21]. Smartwatches offer the set of motion data with a more of human behavior. Nevertheless, the author picked a wider reliable user, since it is often securely placed to the user (i.e. detection of anomalies. On the other hand, this review [28] it is worn on either left or right hand) regardless of their concentratedwords understanding, on recognition classification of human of activitythe depending period, and on deep learning algorithms using mobile or worn sensor data, option to accurately and reliably acquire motion data from describing the mechanisms for promoting deep learning- thechoice user of as clothing.smartphones Consequently, might do. Bhattacharya smartwatches S give[20] has the based recognition of human activity and providing a detailed overview on the approaches, implementation method, and and the potential of incorporating deep learning in wearable attribute teaching methods. devices.explored It the was smartwatch-centric indicated that smartwatch recognition facilitated of movement by GPU could provide profound implementation of the learning. The The Activity Recognition Task for typical day-to-day operation such as hand movement, inner/outersystem executed location, on wristwatch and public-dataset accomplished conveyance high reliability pattern. humanThis activity section recognition illustrates process. how the classification process was done. Figure 1 shows the fundamental framework of activities for smartphone and worn sensors, attribute representationIn modern techniques methods of employ acknowledgment carefully ofdesigned human extraction and selection processes that are extracted orproperly application, employing and cannot specialists be transferred domain to expertise. similar pattern These behavior.extracting In features addition, approaches, carefully designed however, vector are based features on task are difficult to analyze complicated operation data and require time-consuming extraction of features [22,23]. Many ways generalizationlike multimodal of integration human activity and decision recognition mixing across are useddiverse to Figure 1: Basic Structure of human activity recognition domains.achieve diversity Nevertheless, and flexible issues surroundingfunctionality the for perfect performance fusion process. techniques still remain and that affect achieving higher

Mashhour M Bani Amer, et al. Smartphone and Smartwatch for Human Activity Copyright© Mashhour M Bani Amer, et al. Recognition. Ann Adv Biomed Sci 2021, 4(1): 000159. 4 Annals of Advanced Biomedical Sciences

Data Collection A 10-second has been conducted in order to gain

activities regarding repetitive movements, and is small Smartphone and Smartwatch Activity and Biometrics sufficient time to capture multiple repetitions of those The dataset employed in this project is the” WISDM included in this data set have 93 features but only 43 most [29]. It consists of data collected from 51 healthy subjects, enough to provide rapid response [15]. The examples Dataset” found in UCI machine learning repository basic features [30]: one had smartwatch worn on his dominant hand, and a informative features were chosen, which are variant of six and each one performed 18 tasks for 3 minutes each. Each • Binned Distribution [30]: the accelerometer and the gyroscope on the smartphone and thesmartphone smartwatch, in his yielding pocket. four The totalcollected sensors. sensor The data smartphone was from this range is divided into 10 For equal-sized each axis, bins, the andrange then of values in the 10s window (max-min value) is located, • Average [3]: was /5X or Galaxy S5 and the • Timethe fraction between of values Peaks is [3]: recorded Time in in milliseconds each bin (per between axis). smartwatchRaw Time-Series was the LGG Sensor . Data Average sensor value (each axis). The raw time-series sensor data was collected by • Averagethe peaks Absolute in the wave Difference associated [3]: with Average most activities.absolute the accelerometer and gyroscope on the smartphone and differenceHeuristically between determined the each (per axis).of 200 readings and the smartwatch at a rate of 20Hz (i.e., every 50ms). So, there are four sensors abbreviated as watch-gyro, watch-accel, phone- • Standard Deviation [3]: • Averagemean of those Resultant readings Acceleration (per axis). [1]: Resultant is Standard deviation (per axis). gyro, and phone-accel, as shown in figure 2. averagingcomputed theseby squaring values overeach the matching 200 readings. x, y, and z value, summing them, taking the square root, and then Data Preprocessing

Only five activities from the eighteen activities were wereselected chosen in eachbecause file, many which people are: practice walking, them jogging, frequently stairs (ascending and descending), sitting, and standing. Such tasks Figure 2: Raw data types generated from sensors. Thein their formatting everyday information routines. At was first, then data removed were importedfrom the start into MATLAB 2018a to read each file in each sensor subdirectory. were deleted. After that, readings from the 51 subjects were Within each sensor subdirectory, there is a file for each of each file, and the remaining 13 unnecessary activities subject, so there are 51 files in each of the four subdirectories. • The files were named as follows: collected and put in one file for each sensor, separately. After • are:one file for each sensor was generated, they were integrated data_1600_accel_phone.txt to provide the five combinations of the four sensors, which data_1634 _ gyro_watch.txt 1) Phone: Phone acceleration+phone gyroscope (PA+PG). second part is for the subject number and ranges between 2) Watch: 1600The to 1650. first componentThe third component is fixed and is either” is always accel” “data”. or” gyro” The 3) Accl: to describe the sensor type, and the fourth component is” 4) Gyros: Watch acceleration+watch gyroscope (WA+WG). 5) All: PhonePhone acceleration+watch acceleration+phone accelerometer gyroscope+watch (PA+WA). belongs. Phone gyroscope+watch gyroscope (PG+WG). phone” or” watch” to define the device on which the sensor Transformed Activity Examples and Generated acceleration+watch gyroscope (PA+PG+WA+WG). Features acceleration and phone gyroscope, started with merging The merging process of different files, for example, Phone The raw data was split into 10-second non-overlapping with the corresponding activity and subject in the second segments for each sensor (per subject and per activity) each one of the five activities in the first file for each subject and then high-level features are created based on the 200 the minimum number of the two was chosen to avoid having (10s*20 readings/s) readings stored within each segment. file. In case the number of samples in each file is different,

Mashhour M Bani Amer, et al. Smartphone and Smartwatch for Human Activity Copyright© Mashhour M Bani Amer, et al. Recognition. Ann Adv Biomed Sci 2021, 4(1): 000159. 5 Annals of Advanced Biomedical Sciences

the unwanted features and the column of the subject number instances produced for each class forming the dataset used missing values in the merged file. After that, the columns of forfile theis saved training in CSV and filetesting to be is readshown by in WEKA. table 1.The number of in the single and merged data files are removed, and each Used Sensors Walk Jog Stairs Sit Stand Total PA 1271 1314 1180 1263 1283 6311 PG 1260 1311 1194 1153 1323 6241 WA 1011 993 997 1028 1046 5075 WG 915 902 865 939 934 4555 PA+PG 931 963 942 979 965 4780 WA+WG 915 901 864 938 933 4551 PA+WA 882 867 1074 1171 1188 5182 PG+WG 863 868 850 460 1349 4390 PA+PG+ PA+PG 863 867 858 904 886 4378 Sum 8911 8986 8824 8835 9907 45463 % 19.6 19.8 19.4 19.4 21.8 100 Table 1: Number of Instances per used Sensors and Activity.

Evaluation Methods in it. After that, another layer was added but the accuracy WEKA Data Mining Method startedfor the to second decrease, layer therefore to know it the was number eliminated, of neurons so the model used

had two layers where the first layer had 20 neurons and the userOnce activity the datasetprediction was models: ready, theMultilayer WEKA data-miningPerceptron second layer had 10 neurons, as shown in figure 3. suite [31] utilized five classification techniques to trigger

(MP), Decision Tree (J48), Random Forest (RF), k-Nearest asNeighbors a point of (KNN), reference Logistic and predicts Regression the class (LR). value In addition,that has theZeroR most classifier observations was used in forthe baselinetraining performancedataset. In each that case, acts the default settings and 70% split were used, where the data Figure 3: System of two hidden layers of the suggested is divided randomly into 70% training data, and 30% testing data. ANN-based activity recognition classification model. ANN-Multilayer Perceptron Algorithm K-Nearest Neighbor Algorithm model that consists of input, output, and multiple hidden layersANN made model of several is a feed-forward units called artificial neurons neuralthat transform network KNN is a major technique that can be used for recurring the input into something that the output layer can use. These activities as simple as that. KNN is a tool of classification hidden which acts as a form of direct classification, as it does not set of embrace a learning approach. KNN classifies an unknown layers of multilayer network will extract a different theobject concept based of on resemblance the value of(distance) k by counting among thethe numbertraining 70% traininghigh-level data. features The untilSigmoid it can function recognize was what used is lookingfor the of its nearest neighbors. The KNN algorithm operates on for.hidden At first, layers each as data an activation file was split function, into 30% and testing for the data output and of a measurement neighbor is determined using a location layer as a linear function. To specify the size of neurons in informationdataset and theof similarity classification function, of a new such instance. as the distance The distance from each layer, the procedure has been started with one layer and increased the number of neurons gradually until the accuracy started to decrease or it does not show any change, so the Euclidean function. The unknown instance shall be classified as the most common class among its k nearest neighbors. At first, data was split as in the previous section to 70% training value of neurons was fixed. Then, the process was repeated data and 30% testing data, and then KNN algorithm was built Mashhour M Bani Amer, et al. Smartphone and Smartwatch for Human Activity Copyright© Mashhour M Bani Amer, et al. Recognition. Ann Adv Biomed Sci 2021, 4(1): 000159. 6 Annals of Advanced Biomedical Sciences to classify a new observation from testing data. The value of decision, instead of only a class label. Bayesian Optimization

function and Optimize Hyper parameters name-value pair. the kSupport was one. Vector Machine Algorithm was used to optimize the SVM classification using the fitcsvm Support vector machine is by many a simple and highly Results and Discussion favored algorithm, as it produces large accuracy with less WEKA Models Evaluation computing power. The support vector machine algorithm’s objective is to locate a hyperplane in an N-dimensional space in Table 2. This table provides the accuracy level of all the The extracted outcomes for our experiments are shown data,(N- the 70% number of the data of features) was used that for training separately and identifies the rest 30% the relevant data. Data was first split into training and testing beactivities obtained in eachin many data states. type, for For each merged of the data specified of smartphone learning andclassifiers. smartwatch Table 2accelerometers confirms that highand levelmerged of accuracies data from can all was used for testing. Then, the SVM model was built. Since sensors, we generally achieve accuracies above 97%. The SVM is a binary algorithm, one of the strategies has been used to reduce the multiclass classification problem to multiple while using the watch separately provides much lower withbinary the classification class instances problem, being which positive is oneinstances vs all strategy.and the phone can perform well on its own and give good efficiency, remainderThis technique instances includes being learning negative. a single This classifier layout allows per class, the the gyroscope sensors harmonically do even worse than the accelerometerachievement in sensors. all used classifiers. For activity recognition, ground classifiers to generate a real-valued trust result for its Used Sensors MP J48 RF KNN LR ZeroR PA 93.9 92.6 95.6 95.1 87.6 19.0 PG 74.4 78.3 85.8 78.3 68.8 19.5 WA 91.0 87.7 93.2 89.8 88.2 19.4 WG 79.1 76.7 82.1 76.1 75.2 20.1 PA+PG 95.3 90.5 96.0 96.0 89.7 18.5 WA+WG 91.9 88.8 93.5 92.2 88.8 18.6 PA+WA 97.4 94.1 97.6 97.3 93.6 22.8 PG+WG 83.0 88.2 91.7 88.3 86.5 30.8 PA+PG+ PA+PG 92.5 92.6 95.8 97.4 94.5 20.4 Table 2:

Overall Accuracies of Weka Classifiers for Activity Recognition using 43 Features. merged data of smartphone and smartwatch Table 3 provides the results and confusion matrix for walking activity are misclassified as stairs and 1 of 260 jogging activity is misclassified as stairs. Moreover, 7 of 342 using Random forest classifier only since it has the highest issitting the hardest activities activity are misclassifiedto be recognized. as stairs, and 2 of 254 accuracy. On the other hand, the most incorrect classification standing activity are misclassified as stairs. That indicates it occurs when the classifier predicts stairs, where 12 of 285 Predictive Activity Random Forest Walk Jog Stairs Sit Stand Walk 273 0 12 0 0 Jog 1 257 1 1 0 Actual Activity Stairs 5 2 307 0 0 Sit 0 0 7 331 4 Stand 0 0 2 2 350 Accuracy% 95.8 98.8 97.8 96.8 98.9 Precision% 97.8 99.2 93.3 99.1 98.9 Table 3:

Activity Recognition Accuracy and Confusion Matrix for Merged Accelerometers using Random Forest Classifier. Mashhour M Bani Amer, et al. Smartphone and Smartwatch for Human Activity Copyright© Mashhour M Bani Amer, et al. Recognition. Ann Adv Biomed Sci 2021, 4(1): 000159. 7 Annals of Advanced Biomedical Sciences

ANN, KNN and SVM Models Evaluation effect of varying combinations of these motion sensors, the recognition accuracy for ANN algorithm was evaluated In this part, an analysis of the implementation of ANN, with single and combined sensors data, as shown in Table precision is introduced. Table 4 illustrates the performance accelerometer sensors of smartphone and smartwatch were ofKNN, the and three SVM classifiersalgorithms models using innine terms different of accuracy sensor and 4. As expected, we obtained the best accuracy when both combinations data. toused all together,sensors achievingaccuracy, bothapproximately have similar 96.6% accuracies. classification This ANN algorithm was built using MATLAB and incorporated indicatesaccuracy. that When phone phone accelerometer accelerometer has accuracy good performance compared a tuning of hyper parameters where the number of layers and compared with other sensors. In addition, phone sensors number of neurons were adjusted. The retained performance show better performance compared to watch sensors. is good as in previous WEKA results. To understand the Used Sensors ANN Accuracy % KNN Accuracy % SVM Accuracy % PA 94.0 89.7 95.6 PG 80.5 69.0 93.5 WA 91.5 88.7 92.5 WG 82.1 71.5 81.6 PA+PG 95.1 88.1 96.4 WA+WG 92.3 85.5 94.1 PA+WA 96.6 95.1 97.7 PG+WG 85.6 69.6 90.7 PA+PG+ 93.8 93.8 97.7 PA+PG Table 4:

Overall Classification Accuracy for Different Sensors Data using Three Algorithms, Individually. data that was got from smartphone and smartwatch sensors. KNN algorithm was applied to analyze different sensors sinceperformance the watch compared is more related with other to hand single movement sensors. than Watch to bodysensors movement. have worse Integrated classification gyroscope than sensors phone give sensors, very lessA k valueaccuracy of 1for was different used. As sensors we increased compared the to value the ANN of k, bad results compared to integrated accelerometer sensors, algorithm.the accuracy Furthermore, became less. similarly Table to 4 the shows ANN thattest, the KNN highest gives because gyroscope is not so easily accessed in smartphones accuracy of both accelerometer sensors was 95.1%, however, and smartwatches as accelerometer.

In addition, merging the gyroscope sensors did not give In this analysis, the confusion matrices of each model higherthe result accuracy, for each to sensorthe contrary, separately it has has worse weak performance. performance. with combined data from accelerometer sensors were

detailed accuracy and precision tests are also given for each is used to identify user activity based on different sensors class.developed 5182 in research order to instances examine werethe results tested inwith detail, about where the In the proposed approach of SVM, the classification same number of instances per class. The confusion matrices

4and depicts their combinations.the accuracy Weof differentused multiclass sensors Support combinations Vector sitting-standing activity pairs causes many of the predictive Machine with RBF kernel, which gave the best results. Table errors.imply that the uncertainty between walking-stairs and the best performance for different sensors data compared withresulted other from algorithms, SVM algorithm. and the Thisaccelerometer algorithm sensors provided of Tables 5-7 show that the most ineffective recognition smartphone and smartwatch gave the optimum accuracy same accuracy was obtained when all sensors used together. of the tests results by the KNN method. The walk activity is when used together, achieving approximately 97.7%. The mixed with stairs. Hence, the KNN classifier fails to identify thethese correlation events, which of the means acceleration that about data 8% patterns of the walkbetween and stair event classifications are ineffective. This is because of Consequently, phone accelerometer provides better Mashhour M Bani Amer, et al. Smartphone and Smartwatch for Human Activity Copyright© Mashhour M Bani Amer, et al. Recognition. Ann Adv Biomed Sci 2021, 4(1): 000159. 8 Annals of Advanced Biomedical Sciences

between those activity pairs. “walking” and “stairs”. Additionally, KNN misclassifies of experiments using ANN and SVM to restrict the confusion standing as being sitting. We managed to run a further series Predictive Activity ANN Walk Jog Stairs Sit Stand Walk 257 0 18 1 0 Jog 0 258 1 0 0 Actual Activity Stairs 8 2 308 2 1 Sit 1 0 5 351 4 Stand 1 0 1 8 327 Accuracy% 93.1 99.6 96.0 97.2 97.0 Precision% 96.3 99.2 92.5 97.0 98.5 Table 5:

Confusion Matrix of Accelerometer Sensors Data using ANN Algorithm. algorithm with that of the ANN algorithm, we realize that in respectively. However, the sitting and standing classes are termsBy of evaluating overall accuracy, the confusion the ANN matrix algorithm for bothsurpasses the KNN the of the walking and stairs classification by 3.9% and 2.0%, algorithm, an improvement of 1.5% in overall accuracy is changestill found comes to be in misclassified z. since both of them have no real attained.KNN algorithm. The ANN Using algorithm the ANN further algorithm increases instead the of precision the KNN movement or a transition in x and y directions, and only the

Predictive Activity KNN Walk Jog Stairs Sit Stand Walk 254 1 17 0 4 Jog 2 252 4 1 0 Actual Activity Stairs 18 0 297 3 3 Sit 1 1 3 351 5 Stand 0 0 7 5 325 Accuracy% 92.0 97.3 92.5 97.2 96.4 Precision% 92.4 99.2 90.5 97.5 96.4 Table 6:

Confusion Matrix of Accelerometer Sensors Data using KNN100% Algorithm. accuracy for jogging activity even though stairs are still

Table 7 reflects the confusion matrix arising from SVM classification of the integrated accelerometer sensors. The the most difficult activity to recognize. In terms of precision, results are significantly improved and they have shown that the SVM algorithm executes by 1.6% and 3.1%, respectively SVM is more accurate than other algorithms. It has reached better than the ANN and KNN algorithms. Predictive Activity SVM Walk Jog Stairs Sit Stand Walk 268 0 8 0 0 Jog 0 259 0 0 0 Actual Activity Stairs 2 5 312 2 0 Sit 0 0 4 356 1 Stand 0 0 0 4 333 Accuracy% 97.1 100.0 97.2 98.6 98.8 Precision% 99.3 98.1 96.3 98.3 99.7 Table 7:

Confusion Matrix of Accelerometer Sensors Data using SVM Algorithm.

Mashhour M Bani Amer, et al. Smartphone and Smartwatch for Human Activity Copyright© Mashhour M Bani Amer, et al. Recognition. Ann Adv Biomed Sci 2021, 4(1): 000159. 9 Annals of Advanced Biomedical Sciences

For more details about each smartphone and smartwatch accelerometer sensor, Tables 8 & 9 respectively show the the hand movement in jogging is very distinct and has higher other activities such as walking and stairs. This is because The confusion between the activities mentioned above can accelerometer of the watch better than the accelerometer beconfusion obviously matrices observed. built It using can alsoSVM bemodel found for that these the sensors. phone ofacceleration the phone valuesin differentiating than walking between or stairs such that activities. makes For the accelerometer shows greater overall accuracy compared integrated accelerometer sensors as in table 7, the overall to watch accelerometer and has the ability to differentiate accuracy and the ability to distinguish between the activities where their confusion occurs is better than the case when However, the watch accelerometer has more potential than using each accelerometer sensor individually, achieving thebetween phone the accelerometer activities where to identify certain jogging confusion activity exists. and overall accuracy of 97.7%. significantly minimize the uncertainty between jogging and Predictive Activity SVM Walk Jog Stairs Sit Stand Walk 343 10 27 1 1 Jog 2 385 2 1 0 Actual Activity Stairs 0 9 342 0 1 Sit 0 3 4 371 5 Stand 1 0 3 5 377 Accuracy % 89.8 98.7 97.2 96.9 97.7 Precision % 99.1 94.6 90.5 98.2 98.2 Table 8:

Confusion Matrix of Phone Accelerometer Data using SVM Algorithm. Predictive Activity SVM Walk Jog Stairs Sit Stand Walk 268 2 28 0 1 Jog 0 293 0 1 0 Actual Activity Stairs 25 8 255 0 0 Sit 2 0 4 309 5 Stand 2 1 2 25 291 Accuracy% 89.6 99.7 88.5 96.6 90.7 Precision% 90.2 96.4 88.2 92.2 98.0 Table 9:

Conclusion Confusion Matrix of Watch Accelerometer Data using SVMsensors Algorithm. integrated together. The research highlighted in this The combination of data from the smartphone and smart- that training data. Additionally, the application of deeper watch accelerometer and gyroscope sensors evaluated the learningproject can to bethis extended problem by would adding be many very more successful, activities where with it would have the capacity to advance the performance by identifying a given set of activities. Initially, we investigated inevitably developing basic representations of features. subset of sensors to know which are the most accurate in after that we assessed the performance of different sensor Acknowledgment the performance of five different classifiers using WEKA, combinations using ANN, KNN, and SVM algorithms, showing Biomedical Engineering Departments, JUST, Irbid, Jordan for resultedthat SVM from is more the smartphoneaccurate among and smartwatchthem. This project accelerometer further theirThe support. authors would like to thank Electrical and demonstrates that the maximum performance would be

Mashhour M Bani Amer, et al. Smartphone and Smartwatch for Human Activity Copyright© Mashhour M Bani Amer, et al. Recognition. Ann Adv Biomed Sci 2021, 4(1): 000159. 10 Annals of Advanced Biomedical Sciences

References

1. Soulas J, Lenca P, Thépaut A (2015) Unsupervised conferenceWu H (2011) on Mobile Poster: systems, Gait-based applications smartphone and services, user discovery of activities of daily living characterized pp:identification. 395-396. Proceedings of the 9th international by their periodicity and variability. Engineering 14. Ayu MA, Ismail SA, Matin AFA, Mantoro T (2012) A

2. Applications of 45: 90-102. phone’s accelerometer based activity recognition. et al. (2014) An automatic data mining method to detect Procediacomparison Engineering study of 41: classifier 224-229. algorithms for mobile- abnormalCandás JLC, human Peláez V,behaviour López G, Fernándezusing physical MA, lvarez activity EA, 15. 228-241. measurements. Pervasive and 15: Kwapisz JR, Weiss GM, Moore SA (2011) Activity 3. Tentori M, Favela J (2008) Activity-aware computing for recognition using cell phone accelerometers. ACM 16. SIGKDD Explorations Newsletter 12(2): 74-82.

4. healthcare. IEEE Pervasive Computing 7(2): 51-57. onMaguire accelerometer D, Frisby and R (2009)heart rate Comparison data. Technological of feature Universityclassification Dublin. algorithm for activity recognition based 2710.Alemdar H, Ersoy C (2010) Wireless sensor networks for healthcare: A survey. networks 54(15): 2688- 17. 5. From data acquisition to data fusion: A comprehensive population aging matters: A global perspective. National Pires IM, Garcia NM, Pombo N, Flórez Revuelta F (2016) InstituteDobriansky on PJ,Aging, Suzman National RM, HodesInstitutes RJ (2007)of Health, Why of daily living using mobile devices. Sensors 16(2): 184. US Department of Health and Human Services, US review and a roadmap for the identification of activities Department of State. 18. feature selection for gait recognition using smartwatches. 6. (2006) Number of mobile phone users worldwide from InternationalAl Naffakh N Journal (2017) for A Information comprehensive Security evaluation Research of 2015 to 2020. Statista Research Department. 6(3): 691-700.

7. Adibi S (2015) Mobile health: a technology road map. 19. Springer. Linz.Halbmayer P (2015) Wrist-worn activity recognition 8. Ali HM, Muslim AM (2016) Human activity recognition based on smart . Johannes Kepler University, 20. Bhattacharya S, Lane ND (2016) From smart to deep: Trends 3(10): 568-576. Robust activity recognition on smartwatches using using smartphone and smartwatch. Int J Comput Eng Res 9. Lara OD, Labrador MA (2012) A survey on human activity recognition using wearable sensors. IEEE deep learning. 2016 IEEE International Conference on communications surveys & tutorials 15(3): 1192-1209. Pervasive Computing and Communication Workshops 21. (PerComShoaib M, Workshops), Bosch S, Incel pp: 1-6.OD, Scholten H, Havinga PJ 10. He Z, Jin L (2009) Activity recognition from acceleration data based on discrete consine transform and svm. smartphone and wrist-worn motion sensors. Sensors 16(4):(2016) 426. Complex human activity recognition using

IEEE International Conference on Systems, Man and 22. 11. Cybernetics, pp: 5041-5044. for activity recognition with shift-invariant sparse timeYang J, seriesNguyen for MN, Sanhuman PP, Liactivity XL, Krishnaswamy recognition. S (2015) 24th Vollmer C, Gross HM, Eggert JP (2013) Learning features Deep convolutional neural networks on multichannel

coding. International conference on artificial neural 23. International Joint Conference on Artificial Intelligence. 12. networks, pp: 367-374. with smart- phone sensors using deep learning neural Ronao CA, Cho SB (2016) Human activity recognition Cho J, Kim J, Kim T (2012) Smart phone-based generation in building environments. Proceedings of 244. thehuman 7th international activity classification symposium and on energy sustainable expenditure healthy networks. Expert systems with applications 59: 235- buildings, pp: 97-105. 24. 521(7553): 436-444. 13. LeCun Y, Bengio Y, Hinton G (2015) Deep learning. Nature Boyle M, Klausner A, Starobinski D, Trachtenberg A, Mashhour M Bani Amer, et al. Smartphone and Smartwatch for Human Activity Copyright© Mashhour M Bani Amer, et al. Recognition. Ann Adv Biomed Sci 2021, 4(1): 000159. 11 Annals of Advanced Biomedical Sciences

25. Deep learning for visual understanding: A review. Applications 105: 233-261. NeurocomputingGuo Y, Liu Y, Oerlemans 187: 27-48. A, Lao S, Wu S, et al. (2016) the art and research challenges. Expert Systems with 29. 26. LearningWeiss GM Repository. (2019) Wisdm smartphone and smartwatch Gamboa JCB (2017) Deep learning for time-series activity and biometrics dataset data set. UCI Machine 27. analysis. arXiv preprint arXiv: 1701.01887. 30. unsupervised feature learning and deep learning for and smartwatch-based biometrics using activities of time-seriesLa¨ngkvist M,modeling. Karlsson Pattern L, Loutfi Recognition A (2014) ALetters review 42: of dailyWeiss living. GM, YonedaIEEE Access K, Hayajneh 7: 133190-133202. T (2019) Smartphone 11-24. 31. 28. learning tools and techniques with java implementations. learning algorithms for human activity recognition Witten IH, Frank E (2002) Data mining: practical machine Nweke HF, Teh YW, Al Garadi MA, Alo UR (2018) Deep ACM SIGMOD Record 31(1): 76-77. using mobile and wearable sensor networks: State of

Mashhour M Bani Amer, et al. Smartphone and Smartwatch for Human Activity Copyright© Mashhour M Bani Amer, et al. Recognition. Ann Adv Biomed Sci 2021, 4(1): 000159.