1 Introduction

Recently, it is known that many researchers have been working in different fields on the detection, recognition and monitoring of human activities. The automatic detection of human physical movements is often referred to as human activity recognition (HAR). There are two basic approaches to perform HAR tasks. The first of these approaches is expressed as the computer vision approach and the second as the sensor-based approach. The computer vision-based approach generally works efficiently in laboratory conditions. However, in real-time scenarios, computer vision-based approach can fail due to many possible disturbances such as noise, variable light intensity and contrast [1, 2].

HAR systems in which sensors are used aim to obtain information about the state of the person's environment by the use of sensors attached to the person's body and continuous monitoring of many physiological signals that reflects the state of human activities. It is observed that studies in this area have improved significantly, especially with the recently developed sensor technologies and the active use of mobile devices in activity recognition applications [3].

The purpose of HAR is to obtain information about the behavior of a person (person-user) with computer systems. In HAR applications, body-worn motion sensors (MS) such as EEG, accelerometers, gyroscopes and magnetometers are commonly used. The accelerometer is defined as a type of sensor used to measure the acceleration of motion relative to a precise axis. The gyroscope is defined as a type of sensor used to measure the rate of rotation around a precise axis. The magnetometer is a magnetic sensor and a type of sensor used to measure the components of the local magnetic field along a sensitive axis [4].

Motion sensors used in AR studies provide position and orientation information for the physical activity of the body area used. MS is used to detect and track body movements in a wide range of work areas. In previous years, MS was used only in certain areas (spaceships, planes, ships, submarines, cars, etc.), while in recent years it has been used in many different sectors (game industry (game consoles, etc.), armbands (presentation, sports, etc.), health sector, it is used to track and control the movement of many different man-made devices (including wheeled and legged robots) [5].

HAR systems need continuous monitoring of activities to identify (detect) abnormal situations or to prevent unforeseen events that may occur for different scenarios. Thanks to the developing technological innovations, health monitoring devices have become a wearable sensor (device) on the body. It is an important issue the follow-up of patients with different types of diseases both inside and outside the hospital. With the developing sensor technology, vital signals such as electrocardiography (ECG), electromyography (EMG), blood pressure, heart rate and temperature can be monitored, and thus diseases such as seizures, hypertension, dysthymia and asthma can be diagnosed and treated [6]. It is a very important issue to follow the physical activities of patients in the hospital environment. According to the condition of the disease, patients who are in a lying position and make unfavorable movements by making wrong activities, the recovery period is prolonged, and different negative scenarios may be encountered. In this context, patients are followed up by using different devices for different diseases. It is known that during the pandemic period we are in (Covid-19), it is very important issue that people do not leave their homes unless they have to. In addition, some patient groups should be followed at home according to the course and condition of their diseases. It is very important to monitor the conditions of such patients instantaneously and in certain periods. Thanks to the developing technological sensors, communication methods and devices, people can be monitored in any condition or situation [7,8,9,10].

Apart from the different areas mentioned above, HAR systems can also be used in human–robot interaction. Robots need to understand and anticipate users' activities in the next stage and give users an appropriate response. For this reason, the rapid determination of human activities has an important place in human–robot interaction. In addition, HAR applications are used in daily activities, sports activities, entertainment-playgrounds (game consoles), daily business activities (presentations and meetings), monitoring patient care (performing rehabilitation applications), monitoring elderly care, detecting abnormal situations or unforeseen events prevent), military areas, etc. It can be used in many different areas. HAR systems are used in many different sectors, especially in the fields of health, military and security [11].

As a result of technological applications and studies developed in recent years, information about the state of human activities can be obtained by using external (heterogeneous) sensors connected to the person's body in sensor-based HAR systems. The low cost, small size and low energy consumption of wearable sensors allow them to be widely used in applications for determining daily activities in human activity recognition studies. The main purpose of activity recognition applications is to reach distinctive information for movements with the help of sensor data [12].

There are two important components in HAR applications. In the first step, features are extracted from the signals that are measured from the sensors. In the second stage, the extracted features are classified by a machine learning method. The success of the system depends on the effective features obtained in the first stage [13].

In the literature, it has been seen that many different studies have been conducted on activity recognition in recent years. In these studies, it was observed that activity recognition operations were successfully performed using signals obtained from sensor data. However, one of the major problems of current wearable human activity recognition methods is that although the average recognition accuracy is acceptable, the recognition accuracy for some activities (for example, climbing stairs and descending stairs) is mainly relatively less training data and for those activities (complex behavior patterns). Another problem is that recognition accuracy is low when training data from the test subject are limited, which is common in real practice.

In this study, a new approach called 1D-GLCM which performs feature extraction from sensor signals for HAR systems. The proposed approach is inspired by the GLCM method, which is widely used in image processing. In this study, the GLCM method has been transformed into a form that can extract features from one-dimensional sensor signals. To test the proposed approach, two datasets (DS1, DS2) with different numbers of physical activities were used. Acceptably high results were observed with the 1D-GLCM method.

The contribution of this study can be summarized as follows in general. A new approach has been proposed for activity recognition that extracts features from sensor signals. The proposed approach has been developed from the GLCM method, which is widely used in image processing. However, this approach has been developed to extract features from one-dimensional signal. It is thought that this approach can be used for different signals (EMG, ECG, EEG).

2 Related studies

The sensor-based HAR has been an important area of research in recent years. Activity sensitive systems inspire new user interfaces and new applications in smart environments, surveillance, emergency response and military missions. It is seen as a result of studies that systems that identify human activities from sensors worn on the body can open many doors to the healthcare world such as fitness monitoring, elderly care support, long-term preventive and chronic care and cognitive assistance. In HAR applications, sensor technology is critical to obtain success.

Sensor-based activity recognition uses wearable sensors such as a magnetometer, gyro and accelerometer. Information such as environmental characteristics (temperature), acceleration (posture and limb movements, etc.), location information (position) and physiological characteristics (EMG, ECG, heart rate monitoring, lung air capacity measurement, etc.) can be measured by using wearable sensors [14,15,16]. Today, it is seen that mobile device sensors are used extensively for HAR. Thanks to new technologies, the sensors and devices used have become devices that can be worn on the body (sensor, armband, watch, etc.). Wearable systems have an important advantage as they can be used easily [17,18,19,20,21].

Kwapisz et al. [8] conducted a study on how a smartphone can be used to recognize activities by simply keeping it in a pocket. They also stated that activity recognition can be defined accurately with high performance, and that it is recognized correctly in 90% of the activity time. In addition, they stated that these activities could be recognized quickly since each sample was generated from only 10 s of data [8].

In another study, Atallah et al. [22] tried to classify various activities using the Relief-F, Simba and Minimum Redundancy and Maximum Relevance MRMR feature extraction methods using accelerometer sensors. In the study, they obtained a total of 124 features and stated that they performed the classification using KNN and Bayes algorithms. As a result of the study, they obtained an accuracy of approximately 90% [22].

Chernbumroong et al. [23] stated that they developed an AR method to detect nine daily activities of an elderly person, taking into account both technical and practical aspects as the purpose of their study. From a practical point of view, the recommended recognition method is small, inexpensive, without multiple sensors, that is, an accelerometer, temperature sensor and altimeter embedded as input to a wristwatch. The proposed method provides a high classification performance of the F-score between 0.81 and 0.97 and an overall accuracy of 90.23%. They stated that the proposed method performed very well in detecting the activities of an elderly person [23].

Elvira et al. [24] stated that they proposed a new feature extraction method for HAR. The authors used inertia and magnetic sensors in their studies. In the proposed method, the direction of the person with respect to the earth is estimated using the quaternion representation. A quaternion is a four-element vector that can be used to encode any rotation in a 3D coordinate system. A quaternion is composed of one real element and three complex elements, and it can be used for much more than rotations. They evaluated the performance by applying the proposed feature extraction technique to a most advanced hierarchical dynamic model (HDM) based on Hidden Markov Models (GMM) [24].

Bayat et al. [25] aimed to recognize certain activities by using a three-axis accelerometer in an android mobile phone. They obtained the required attributes for classification by performing feature clustering. They used Multi-Layer Artificial Neural Networks (ANN), Decision Support Vectors(SVM) and Random Forest (RO) algorithms in the classification stage. In the study, they stated that they achieved an accuracy of 81 to 91% [25].

Sensors are easily affected by noise in human activities. Ponce et al. [26] stated that for a successful activity classification application with noisy data, stable and robust machine learning techniques should be used. They proposed an Artificial Hydrocarbon Network (AHN) technique in their work. They stated that they achieved 97% success by comparing the AHN classifier method with other machine learning methods for AR [26].

Hassan et al. [9] stated that the main purpose of their study is to develop a robust HAR system based on the data of smartphone sensors. They stated that using smartphones for AR is very smart because smartphones are one of the most used devices in their daily lives, not only for communication but also for a wide variety of applications including healthcare. Thus, they proposed a new approach to AR using smartphone inertial sensors such as accelerometers and gyroscope sensors. The authors stated in their study that an average recognition rate of 89.61% and an overall accuracy rate of 95.85% were obtained by controlling for twelve different physical activities [9].

Tuncer et al. [27] proposed a new triple pattern and discrete wavelet (TP-DWT) based iterative feature extraction method. A sEMG signal recognition method using the predicted TP-DWT-based feature extraction network is presented. Suggested TP-DWT-based sEMG signal recognition method consists of channel combining, feature extraction using TP-DWT network and feature selection using 2-level feature selection method and classification using traditional classifiers. The proposed method was tested using a sEMG dataset collected from amputated participants with 3 strength levels (Low, Medium, High). Four cases have been studied to comprehensively evaluate the proposed TP-DWT-based hand movements classification method with sEMG signals. Based on the evaluations, the authors stated that the proposed TP-DWT-based sEMG classification method, using the k-nearest neighbor (k-NN) classifier with tenfold cross validation, reached an accuracy rate of 99.14% for all strength levels. They also reported success rates of 97.78, 93.33 and 92.96% for low, medium and high strength levels, respectively [27].

Tuncer et al. [28] stated in their study that they proposed a new method for daily sports activities and gender recognition by using sensor signals. Three cases are defined to test the proposed MK-LDP and RFNCA-based HAR method. These states are gender classification, activity classification, and both gender and activity classification, respectively. The authors stated the best accuracy rates obtained for recognition of gender, daily sports activities and both gender and daily sports activities as 99.47, 99.71 and 99.36%, respectively. The proposed MK-LDP-based method has also been compared with the latest technology and deep learning techniques. The authors stated that the results obtained were a successful HAR study using sensor signals of the proposed MK-LDP and RFNCA-based framework [28].

Tuncer et al. [29] carried out AR procedure with transfer deep learning methods in their study. The authors stated that ResNet18, ResNet50 and ResNet101 were used as feature extractors, and they extracted 1000 attributes per network. 3000 features were obtained by combining the extracted features. In the feature selection phase, the most distinctive 1000 features were selected using Relief-F, and these selected features were used as input for the third order polynomial (cubic) activation-based support vector machine. The authors stated that the proposed method achieved classification accuracy rates of 99.96 and 99.61%, respectively, for gender and activity recognition. The authors stated that the results clearly show that the proposed pre-trained community ResNet-based method achieves a high success rate for sensor signals [29].

3 Datasets

In this study, two datasets with different properties are used. Both datasets are used publicly. While the first dataset was obtained from the UCI database, the second dataset was obtained from the KAGGLE database. Signals in both datasets were recorded from acceleration, gyro, magnetometer sensors. Accelerometer is a device that is used to measure the acceleration of a mass. While doing this, by making use of the variable position of the positioned mass inside; result is obtained. So; by taking the vertical position of these masses as a reference, one can find the changes that occur by comparing them with these reference points. Gyroscope is a device used for direction determination. The gyroscope sensor is similar to an accelerometer, but there is a big difference between them: The accelerometer measures the acceleration of the device, while the gyroscope measures the rotation speed of the 3 coordinates (X, Y, Z). Accelerometer measures the acceleration from a single coordinate, while the gyroscope measures the speed of rotation according to three coordinates. Magnetometer is a device used to measure magnetic field strength and direction. Since the earth has a significant magnetic field, the magnetometer can also be used as a compass.

3.1 The dataset 1 (DS1)

The first dataset used in the study is the MHealth (mobile health) dataset in the UCI library [30, 31]. There are 12 different activities signals in the dataset. The signals were obtained from three wearable sensors such as acceleration, gyro, magnetometer. Sensors were placed on the people's chest, right wrists and left ankles, respectively, and fitted using elastic straps. Using more than one sensor enables the measurement of various activities of body parts, namely acceleration, rotation speed and magnetic field orientation. Signals are recorded at a sampling rate of 50 Hz and are deemed sufficient to capture human activity. The activities in the dataset were selected according to the general activities of daily life. Information on 12 activities is given in Table 1. Sample signals for the X-axis of the accelerometer sensor for the activities in the dataset are given in Fig. 1.

Table 1 Activity set in DS1
Fig. 1
figure 1

Signals from the X-axis of the accelerometer sensor for physical activities in DS1

3.2 The dataset 2 (DS2)

Another dataset used in this study is the MotionSense Smartphone Sensor Data dataset shared in the KAGGLE [32]. The dataset contains time series data generated by accelerometer and gyroscope sensors (position, gravity, rate of rotation and user acceleration). The data in the study were obtained using an Iphone 6 s smart mobile phone using SensingKit, which collects information from the Core Motion frame on IOS devices placed in the right front pockets of people for 6 specified activities. It is conducted 6 activities with 24 participants. These 6 activities are given in Table 2. In Fig. 2, sample signals of the X-axis of the accelerometer sensor are given for these 6 motions.

Table 2 6 different motions used in the study (6 different motions)
Fig. 2
figure 2

X-axis signals of the accelerometer sensor for physical movements within the DS2

4 Method

4.1 Proposed approach

In this study, a new approach is proposed for activity recognition using signals obtained from wearable sensors. The block-diagram of the proposed approach is given in Fig. 3. This diagram consists of 5 blocks. The transactions performed in each block are briefly given below.

Fig. 3
figure 3

Block Diagram

Block 1 Signals for two different datasets were obtained from various sensors (accelerometer, magnetometer, gyroscope).

Block 2 The wearable sensor signals were converted into values between 0 and 255, 0–127 and 0–63. The conversion of the values in the range of 0–255 was carried out according to the following equation.

$${\text{New }}X_{i} = {\text{round}}\left( {\left[ {\frac{{X_{i} - {\text{Min}}\left( X \right)}}{{{\text{Max}}\left( X \right) - {\text{Min}}\left( X \right)}}} \right]x255} \right)$$
(1)

The transformations of the signs for the X-axis of the accelerometer sensor belonging to two different signals are given in below.

Figure 4 shows the process of converting signs to values between 0 and 255. Looking at the signs, the form of the signals has not changed for the two datasets. Original signals and transformed signals are similar.

Fig. 4
figure 4

The conversion of the signals values between 0 and 255. a original signals for the X-axis of the accelerometer sensor for the dataset 1, b transformed signals, c original signals for the X-axis of the accelerometer sensor for the dataset 2, d transformed signals

Block 3 Co-Occurrence matrices are obtained from the transformed signals. The application of the method to signals is described in below. Co-Occurrence Matrix differ according to the parameter of distance between values on the signal.

Block 4 At this stage, Heralick features are obtained from Co-Occurrence matrix created according to the distance parameter (d). These attributes will be used as input attributes for machine learning methods.

Block 5 The classification process using the calculated Heralick features is carried out according to the tenfold cross validity test. In K-Folds cross validation, we divide our data into k different subsets. We use k-1 subsets to train our data and leave the last subset as test data. The average classification value obtained as a result of k experiments indicates the validity of our model. In this study, all experiments, tenfold cross validation was applied to the dataset. The dataset is divided into 10 clusters according to the cross validation process. In a cross validation, 1 set of 10 sets is used for testing, and 9 sets are used for training. Each cluster means 1 test for the remaining 9 clusters used for training.

The classification process was carried out using BN (Bayesian Network), Support Vector Machine (SVM), Multi-Layer Perceptron (MLP) a type of Artificial Neural Network (ANN), Logistic Regression (LR) and Random Forest (RF) machine learning methods.

4.2 Gray level Co-occurrence matrices

The Gray Level Co-Occurrence Matrix (GLCM) method has been proposed by Heralik et al. for the classification of different texture in image processing [33]. GLCM is also known as a back-level dependency matrix [33]. Basically, the GLCM method is a pixel-based image processing method. In other words, it is an approach that uses the relationship between pixels to obtain features from a gray level image. The formation of the GLCM matrix is based on the distance between pixels (D), angle of pixels (0º, 45º, 90º and 135º) and the number of gray tone levels (maximum 256) to be transformed. In the GLCM method, the image is first re-scaled according to the number of grayscale levels. In the generated GLCM matrix, the sum of the number of adjacent pixels at the specified angle and distance is assigned in the re-scaled image with the specified grayscale. In this study, a new feature extraction approach is proposed for one-dimensional signals. First, the vibration signals were transformed to values between 0 and255. A co-occurrence matrix is calculated from newly formed signals. Although the proposed new approach has distance parameter, it does not include angle parameter. The application method of the proposed method is described in Fig. 5. In Fig. 5a, assume a signal showing four different pattern values between 0 and 3. The co-occurrence matrix for these signals is calculated as in Fig. 5b. Here #(i, j) is the number of values that satisfy the condition (d = 1) at the specified distance.

Fig. 5
figure 5

a illustrates the creation of the co-occurrence matrices of a signal for different distances (d = {1, 2, 3 and 4}) Calculation of the co-occurrence matrix

Formation of identical co-occurrence matrices for different distances can be seen in Fig. 6. This co-occurrence matrix is then normalized. The normalization process is carried out by taking the ratio of the co-occurrence matrix to the total number of values in a cell. Signal analysis is performed by using statistical data of the co-occurrence matrix. Heralick proposed different features that can be obtained from co-occurrence matrix. These features can be calculated by using the equations as follows [33].

Fig. 6
figure 6

Formation of identical co-occurrence matrices for different distances

Angular Second Moment

$$f1 = \mathop \sum \limits_{i = 1}^{{N_{g} }} \mathop \sum \limits_{j = 1}^{{N_{g} }} \left( {\frac{{P\left( {i,j} \right)}}{R}} \right)^{2}$$
(2)

Contrast

$$f2 = \mathop \sum \limits_{i = 0}^{{N_{g} - 1}} i^{2} \left\{ {\mathop \sum \limits_{{\left| {i - j} \right|}} \left( {\frac{{P\left( {i,j} \right)}}{R}} \right)} \right\}$$
(3)

Correlation

$$f3 = \frac{{\mathop \sum \nolimits_{i = 1}^{{N_{g} }} \mathop \sum \nolimits_{j = 1}^{{N_{g} }} \left[ {ijP\left( {i,j} \right)/R} \right] - \mu_{x} \mu_{y} }}{{\delta_{x} \delta_{y} }}$$
(4)

Variance

$$f4 = \mathop \sum \limits_{i = 1}^{{N_{g} }} \mathop \sum \limits_{j = 1}^{{N_{g} }} \left( {i - \mu } \right)^{2} P\left( {i,j} \right)$$
(5)

Inverse Different Moment

$$f5 = \mathop \sum \limits_{i = 1}^{{N_{g} }} \mathop \sum \limits_{j = 1}^{{N_{g} }} \frac{{P\left( {i,j} \right)}}{{1 + \left( {i + j} \right)^{2} }}$$
(6)

Sum Average

$$f6 = \mathop \sum \limits_{i = 2}^{{2N_{g} }} iP_{x + y} \left( i \right)$$
(7)

Sum Variance

$$f7 = \mathop \sum \limits_{i = 2}^{{2N_{g} }} \left( {i - f_{8} } \right)^{2} P_{x + y} \left( i \right)$$
(8)

Sum Entropy

$$f8 = - \mathop \sum \limits_{i = 2}^{{2N_{g} }} P_{x + y} \left( i \right){\text{log}}\left\{ {P_{x + y} \left( i \right)} \right\}$$
(9)

Entropy

$$f9 = - \mathop \sum \limits_{i = 1}^{{N_{g} }} \mathop \sum \limits_{j = 1}^{{N_{g} }} P\left( {i,j} \right){\text{log}}\left( {P\left( {i,j} \right)} \right)$$
(10)

Difference Variance

$$f10 = {\text{variance}}\; {\text{of}} P_{x - y}$$
(11)

Difference Entropy

$$f11 = - \mathop \sum \limits_{i = 0}^{{N_{g} - 1}} P_{x - y} \left( i \right){\text{log}}\left\{ {P_{x - y} \left( i \right)} \right\}$$
(12)

Information Measures of Correlation

$$f12 = \frac{HXY - HXY1}{{{\text{max}}\left\{ {HX,HY} \right\}}}$$
(13)
$$f13 = \left( {1 - \exp \left[ { - 2\left( {HXY2 - HXY} \right)} \right]} \right)^{1/2}$$
(14)
$$HXY = \mathop \sum \limits_{i = 1}^{{N_{g} }} \mathop \sum \limits_{j = 1}^{{N_{g} }} P\left( {i,j} \right){\text{log}}\left( {p\left( {i,j} \right)} \right)$$
(15)
$$HXY1 = \mathop \sum \limits_{i = 1}^{{N_{g} }} \mathop \sum \limits_{j = 1}^{{N_{g} }} P\left( {i,j} \right){\text{log}}\left\{ {p_{x} \left( i \right)p_{y} \left( j \right)} \right\}$$
(16)
$$HXY2 = \mathop \sum \limits_{i = 1}^{{N_{g} }} \mathop \sum \limits_{j = 1}^{{N_{g} }} P_{x} \left( i \right)P_{y} \left( j \right){\text{log}}\left\{ {p_{x} \left( i \right)p_{y} \left( j \right)} \right\}$$
(17)

Maximal Correlation Coefficient

$$f14 = \left( {{\text{second}} {\text{largest}} {\text{eigenvalue}} of Q} \right)^{1/2}$$
(18)
$$Q\left( {i,j} \right) = \mathop \sum \limits_{k} \frac{{P\left( {i,k} \right)p\left( {j,k} \right)}}{{P_{x} \left( i \right)P_{y} \left( k \right)}}$$
(19)

Here, the parameters of μx, μy, δx and δy indicate the means and standard deviation of Px and Py. In addition, HX and HY are the entropy values of Px and Py. P(i,j) is value on co-occurrence matrix of i and j coordinates of the co-occurrence matrix. \(N_{g}\) indicates the width or height of the co- occurrence matrix.

5 Experimental results

In this study, a new feature extraction approach is proposed for HAR using accelerometer, gyroscope and magnetometer signals obtained from wearable sensor devices. Two different datasets (DS1, DS2) were used to test the proposed approach. The number of physical activities performed in the two datasets is different. DS1 has 12 activities and 40 examples for each activity. DS1 has a total of 480 samples. For DS2, 6 activities and 60 samples were used for each activity. There are 360 samples in total in DS2. Heralick features extracted from co-occurrence matrix obtained from signals are classified with different machine learning methods. The classification process was carried out with the open-source Weka program [34] according to a tenfold cross validation test. Classification success rate is the ratio of the number of correctly classified samples to the total number of samples. It is calculated with the following equation.

$${\text{Accuracy}} = \frac{{{\text{number}}\; {\text{of}}\; {\text{correctly}}\; {\text{classified}}\; {\text{samples}}}}{{{\text{total}}\; {\text{number}}\; {\text{of}} \;{\text{samples}}}}$$
(20)

The results obtained using different machine learning methods are given in Table 3.

Table 3 Success rates for different machine learning methods

Looking at Table 3, acceptable results have been observed with all classification methods. The highest success rate for DS1 was observed with RF as 90.83%. The lowest success rate was achieved with SVM as 83.33%. For DS2, the highest success rate was observed with ANN. The success rate was obtained as 88.05%. The least successful method for DS2 is seen as LR.

In order to determine which Heralick feature is effective in HAR for the two datasets, the classification process for each Heralick features was carried out separately. The success rates achieved are given in Table 4. While the classification process for DS1 data is performed with RF, for DS2, ANN method is used. RF for DS1 and ANN method for DS2 were used in all the next scenarios.

Table 4 Success rates of Heralick features for datasets

Looking at Table 4, the highest success rate for the DS1 dataset was obtained with the Correlation feature. A success rate of 89.17% was obtained by using only this feature. The lowest success rate seems to be obtained with the Sum Average feature. The highest success rate for the DS2 dataset was observed with the Correlation feature as 81.39%. For both datasets, Correlation feature has been found more successful than other features. As a result, it is seen that all Heralick features should be used together.

The proposed method has a parameter in the form of distance (d). Different features are obtained for different values of this parameter. Macro and micro patterns are captured depending on the distance between values on the signal. The success rates obtained by using the features obtained for the distance parameter {1, 2, 3, 4, 5, 6 and 7} to determine the effect of d parameter for two datasets are given in Table 5.

Table 5 Success rates according to the d (distance) parameter

Looking at Table 5, high success rates were obtained according to all d (distance) values. The highest success rate for the DS1 dataset was obtained at d = 6 as 93.33%. When all the features are used, the average performance obtained for all d values in the table has been observed as 91.66%. It is seen that the success rate changes as the value of the d parameter increases. The appropriate d value should be decided after trials.

For the DS2 dataset, the highest success rate was obtained as 90.28% in d = 7. When all the features are used, the average performance obtained for all d values in the table is 90.55%. The success rates observed according to the d distance parameter are shown in Fig. 7.

Fig. 7
figure 7

HAR success rates according to parameter d

Heralick features were obtained from 23 channels in the DS1 dataset. 14 features have been extracted from each channel. There are 23 × 14 = 322 features in total in DS1. Likewise, a total of 12 × 14 = 168 features were extracted from 12 channels in DS2. Not all features are thought to be effective in AR. For this reason, the feature selection process has been carried out. Feature selection was performed by the correlation-based method (CbFSS, Correlation-based Feature Subset Selection) [35]. Feature selection is dimension reduction process. In data science, dimension reduction is the transformation of data from a high dimensional space to a low dimensional space without losing its performance. Processing a large data size requires more computational cost. Therefore, dimension reduction is frequently used in areas such as signal processing, speech recognition, neuroinformatic and bioinformatics, where a large number of observations and features are examined. The feature selection process has been carried out for all scenarios. The success rates obtained after the selection process are given in Table 6.

Table 6 Success rates after feature reduction

Looking at Table 6, it is seen that success rates increase after the reduction process. It is seen that for both DS1 and DS2, feature selection increases the success of HAR instead of using all values of the distance parameter. The highest success rate for DS1 was 96.66% when d = {1 and 2}. For DS2, the highest success rate was 93.88% when parameter d = {4 and 5}. Overall, very high success rates have been achieved.

Pixel values of gray images vary between 0 and 255. Therefore, the GLCM method used in image processing consists of images who’s co-occurrence matrix values vary between 0 and 255. In the 1D-GLCM method which is used in this study, the sensor signals can be converted into values between 0 and 255, 0–127 and 0–63. The conversion process does not change the form of the signals. The graphic of the new signals was generated after converting a sample signal into these intervals is given in Fig. 8.

Fig. 8
figure 8

Transformation of signals. a Original signal, b Converting the signal to 0–255 range, c Converting signal to 0–127 range, d Converting signal to 0–63 range

The size of the co-occurrence matrix changes when the signals are transformed into different intervals. After converting the signals into different intervals for DS1 and DS2 datasets, the features were removed, and success rates were observed. The success rates achieved are given in Table 7.

Table 7 Based on co-occurrence matrix size

As can be seen from Table 7, the highest success rate was observed when the conversion range of the signals is 0–127. It would not be correct to say that a change interval is good. The change interval should be decided after trials.

Datasets consist of signs obtained from accelerometer, gyro and magnetometer sensors. Each sensor type is used in equal numbers. In order to get the success of the sensor type in activity recognition, classification processes have been carried out according to sensor type. While there are 3 sensor types in the DS1 dataset, there is no magnetometer sensor in the DS2 dataset. The success rates obtained according to the sensor type are shown in Table 8.

Table 8 Activity recognition to sensor types

As can be seen from Table 8, the most successful results were obtained with the features obtained from the accelerometer sensor. The approach proposed for HAR appears to be successful in different scenarios. The success rates obtained were compared with other studies in the literature. The comparison table is given in Table 9. Looking at the table, it is seen that acceptable high results are obtained with the proposed approach.

Table 9 Comparison with the other studies

6 Discussion

In recent years, it has been seen that many studies have been carried out to obtain in-depth information about human activity (HA) using different practices in people's daily lives. A successful activity recognition (AR) implementation is used in many different areas such as home behavior analysis, video surveillance, gait analysis and gesture recognition. There are two types of AR, video-based AR and sensor-based AR. Video-based AR uses motion data from smart sensors such as an accelerometer, gyroscope, Bluetooth, sound sensors and so on, while analyzing videos or images that contain human activities on the camera. Thanks to the development of sensor technology and common computer technology, sensor-based AR has become more popular and is widely used. Sensor-based AR systems aim to capture the state of the user and his environment by using heterogeneous sensors connected to the person's body and allowing continuous monitoring of many physiological signals that reflect the state of human actions. Especially in recent years, it has been observed that microelectronics and computer systems have significantly improved with the use of special sensors and mobile devices in HAR applications. In this study, a new feature approach method based on Co-Occurence Matrix is proposed using sensor signals for HAR. This approach has been developed from the GLCM (Gray Level Co-occurrence Matrix) method to extract features from one-dimensional signal. The GLCM method is a widely used method for texture analysis in image processing. The GLCM functions characterize the texture of an image by calculating how often pairs of pixels with specific values and in a specified spatial relationship occur in an image, creating a GLCM, and then extracting statistical measures from this matrix. The 1D-GLCM method is used to extract effective features from sensor-type one-dimensional signals. Firstly, Co-Occurence Matrix were obtained from the signals obtained from the magnetometer, gyroscope and accelerometer sensors. Then, Heralick features were extracted from these matrices. Classification process has been carried out using different machine learning methods with these features. The extracted features are classified by different machine learning methods such as BN, SVM, ANN, LR and RF.

Two different datasets were used to test the proposed approach. HAR operation has been carried out in different scenarios for DS1 and DS2. Both datasets consist of acceleration, gyro, magnetometer sensor signals connected to the legs. While there are 12 activities in DS1, there are 6 activities in DS2.

The 1D-GLCM method has a parameter in the form of d (distance). For the same signals, different co-occurrence matrices are obtained with this parameter. Therefore, different features are obtained. In the study, the effect of the distance parameter of the 1D-GLCM method was also examined. For DS1, the best result was obtained when d = {3 or 4}, for DS2 it was obtained when d = {4 or 5}. Heralick features are extracted from co-occurrence matrices. Heralick reported 14 features used in the GLCM method. In the study, the activities of these features were examined separately. Correlation features was found to be the most successful attribute for both datasets.

While the highest success rate for DS1 was observed as 96.6667%, this success rate for DS2 was 93.88%. Acceptable high success rates were observed for DS1 and DS2. It is thought that the proposed approach can be used in the classification of different signals.

7 Conclusion

Sensor-based human activity recognition attracts attention in the field of computers due to its wide use in daily life and is a rapidly growing field of research. Activity recognition (AR) application is carried out by evaluating the signals obtained from various sensors placed in the human body. In this study, a new approach is proposed for HAR to extract features from sensor signals. This approach is inspired by the Gray Level Co-Occurence Matrix (GLCM) method, which is widely used in image processing, but it is applied to one-dimensional signals unlike GLCM. The 1D-GLCM method is used to extract effective features from sensor-type one-dimensional signals. The activity recognition process was carried out using different machine learning methods for these features. Acceptable high results were observed. In addition, the proposed approach is thought to be a method that can be used to classify different signals. This approach will be applied on medical signals such as ECG, EMG and EEG in our future studies.