Voluntary Muscle Contraction Detection Algorithm Based on LSTM for Muscle Quality Measurement Algorithm

: In this paper, we propose the long–short-term memory (LSTM)-based voluntary and non-voluntary (VNV) muscle contraction classiﬁcation algorithm in an electrical stimulation (ES) environment. In order to measure the muscle quality (MQ), we employ the non-voluntary muscle contraction signal, which occurs by the ES. However, if patient movement, such as voluntary muscle contractionm, occurs during the ES, the electromyography (EMG) sensor captures the VNV muscle contraction signals. In addition, the voluntary muscle contraction signal is a noise component in the MQ measurement technique, which uses only non-voluntary muscle contraction signals. For this reason, we need the VNV muscle contraction classiﬁcation algorithm to classify the mixed EMG signal. In addition, when recording EMG while using the ES, the EMG signal is signiﬁcantly contaminated due to the ES signal. Therefore, after we suppress the artifact noise, which is contained in the EMG signal, we perform VNV muscle contraction classiﬁcation. For this, we ﬁrst eliminate the artifact noise signal using the ES suppression algorithm. Then, we extract the feature vector, and then the feature vector is reconstructed through the feature selection process. Finally, we design the LSTM-based classiﬁcation model and compare the proposed algorithm with the conventional method using the EMG data. In addition, to verify the performance of the proposed algorithm, we quantitatively compared results in terms of the confusion matrix and total accuracy. As a result, the performance of the proposed algorithm was higher than that of the conventional methods, including the support vector machine (SVM), artiﬁcial neural network (ANN), and deep neural network (DNN).


Introduction
The skeletal muscle is an organ composed of tissue built of myocytes, including proteins, and is the tissue of the human body, which primarily functions as a source of contraction, which ultimately causes human body movement [1][2][3]. The electrical response of the muscle to stimulation of the peripheral nerve connected to the muscle fibres causes muscle contraction via the neurotransmitter to the axon. In addition, the muscle fibres are divided into type I fibres and type II fibres, which closely affect muscular strength and muscular endurance [4][5][6].
However, when losing the motor unit due to myopathic disorders such as the sarcopenia, the clinical problem of the muscle weakness becomes serious [7][8][9][10]. Hence, muscle quality (MQ) is crucial factor in understanding muscle health conditions, and it is essential to periodically check the MQ for healthcare, in the context of a high average life expectancy and aging populations [11].
Traditionally, to measure the MQ, hospitals have extensively employed the torque equipment, muscle circumference measurement, timed up and go test (TUG), five times sitto-stand test (FTSST), electromyography (EMG), Lovett's test, and Asworth's scale [12][13][14][15][16][17]. At present, the EMG sensor records muscle response or electrical activity in response to a nerve's stimulation of the muscle, but it cannot measure muscle strength. However, since the traditional equipment requires expert knowledge or high cost, it is difficult to employ the equipment at home. Additionally, the absence of MQ measurement equipment for home is inconvenient in that the patient has to visit the hospital. The traditional methods that induce voluntary MC, such as the torque equipment, TUG, FTSST, and EMG, cause particular physical discomfort to the patient. In addition, because the traditional equipment depends on the voluntary MC of the patient, the equipment cannot precisely measure MQ from the unpredictable muscle condition of the patient. Therefore, to address this fatal weakness, we have developed an MQ technique based on a non-voluntary MC signal.
To do this, while stimulating the muscle using electrical stimulation (ES), we obtain the impact response (IR) signal from the EMG sensor [18]. At this time, the IR signal is composed of the non-voluntary MC signal of the target muscle. For this reason, when non-voluntary MC occurs due to the ES, we achieve crucial information such as muscle characteristics through the MC signal, which responds differently according to muscle condition. The major features extracted from the IR signal are employed to measure MQ though the artificial intelligence (AI) model, and the extracted features act as or play the role of the digital biomarker (DBM) for the MQ. For this, we have developed a technique that can obtain MQ information from an IR signal, which consists of DBM. Finally, since the IR signal-based MQ technique does not depend on the voluntary MC of the patient, and measures the MQ at home without an expert, the technique can solve the three issues mentioned above. However, when acquiring an IR signal for MQ measurement, the IR signal might be contaminated by the noise that occurs due to the voluntary MC of the patient. For this reason, in order to improve the performance of the MQ measurement technique, we need an exception handling algorithm.
The approach we present in this paper classifies the voluntary and non-voluntary (VNV) MC signal through the long-short-term memory (LSTM) model in order to stabilize the MQ measurement technique. For this, we first record the EMG signal, which includes VNVMC components, and we then suppress the ES noise in the EMG signal. After feature extraction is performed, the extracted feature vector is reconstructed through a feature selection process. Finally, to classify the VNVMC, we train the classification model using the LSTM scheme. We evaluate the performance of our proposed algorithm by comparing it with the conventional machine learning methods.
In this paper, the proposed algorithm detects the outlier data, which include voluntary MC signal, in order to exclude unnecessarily captured signals. When the non-voluntary signal is masked by the voluntary signal, it is difficult to obtain the muscle characteristics from the IR signal. Hence, when applying the proposed algorithm, the performance of the MQ measurement technique is guaranteed by the outlier data, which disturb non-voluntary analysis. Therefore, we have developed the proposed algorithm for this ultimate aim.

Method
In this section, we describe the VNVMC classification algorithm based on the LSTM. First, four electrode pads are placed on the target muscle (thigh) and the four pads are connected to ES device. Figure 1 shows the IR data acquisition method using the electrode pads and device. We can also control the frequency of the ES waveform, and the frequency is set to 10-90 Hz. To classify the VNVMC signal, the proposed algorithm is carried out as shown in Figure 2. Then, we collect the EMG signal, which consists of VNVMC signals, and a preprocessing scheme is performed to remove the ES signal included in the EMG signal.

Preprocessing
Since the EMG signal obtained from our device contains the ES signal, it is difficult to detect the VNVMC signal. For this reason, we apply the ES suppression (ESS) algorithm based on a moving average filter [19] using the label data of the ES. The label data are recorded as 0 or 1 when the ES occurs from the hardware. Finally, the output signal y of the ESS algorithm is calculated as follows: where s denotes input EMG signal, t and j are time index and loop index, respectively. The ESS algorithm, which is five orders of MAF, is performed iteratively for 10 samples after the ES occurs.

Feature Extraction
To classify the VNVMC signals based on LSTM using the EMG signal processed by ESS algorithm, we extract the feature vector, which includes the percentile of spectral cumulative sum (PoSCS) and the spectral cumulative sum (SCS) at each frequency bin, as shown in Figure 3. To extract the PoSCS, the input signal d is transformed into the frequency data in the discrete Fourier transform (DFT) domain D(n), where n denotes the index of the frequency bin. SCS S(n) is calculated as follows [20]: where N is DFT size. The S(n) is normalized by the S(N), as shown in Figure 3. Additionally, we find the index of the frequency when the S(n) is 0.05, 0.1, 0.15, . . . , and 0.95, and the frequency bins are employed as the feature vector, which is called PoSCS. To extract the feature vector, we perform the Algorithm 1 as follows:  where H denotes subtraction between the S(n) and the horizontal line, and PoSCS is calculated by the argmin function, which finds the index for the minimum |H|. The voluntary MC component appears differently when compared with non-voluntary MC components in the frequency domain. Moreover, the extracted features from the SCS function of the mixed MC signal appear prominently when comparing with it of the nonvoluntary MC signal only. Since we can obtain the information of the MC pattern in the DFT domain, the extracted feature vector acts as or plays the role of major feature for our proposed algorithm. Next, we extract SCS y-axis value (SCSyV) for each frequency bin and the features are used with PoSCS for the input of the LSTM model. In addition, since the y-axis of the SCS function is employed, the SCSyV includes the information of the MC pattern. To more elaborately classify the VNVMC signal, the ES frequency information is added for the input feature vector. As the non-voluntary MC signal appears differently in accordance with ES frequency, the feature is additively employed to guarantee the stable performance of the proposed algorithm. The feature vector is normalized by the average of each featurethat is extracted from the entire signal for calibration. Finally, the extracted feature vector is re-expressed through feature selection to classify the VNVMC signal.

LSTM Training and Classification
Once the feature selection for the EMG signal is achieved, we train the LSTM model using the LSTM scheme [21], which is employed for this classification task, to classify the VNVMC signal. For the LSTM learning, the feature vector is normalized using the mean and standard deviation (SD) of the feature vector [22]. The structure of the LSTM is composed of the hidden state and cell state, and the cell state includes information about the long-term and short-term data. The LSTM learning scheme is constructed of two major steps, including a forward propagation stage and a fine-tuning stage to train the LSTM model. In the forward propagation stage, the forward propagation consists of forget gate, input gate, and output gate, as shown in Figure 4, and then fine-tuning employs a back-propagation technique to update the parameters, which include the weight matrix and the bias vector [23]. For this, we first calculate the forget gate f t as follows: where W f and b f denote the weight matrix and bias vector for the forget date, respectively. h t−1 is the hidden state of the previous state and D t denotes the normalized feature vector. σ and t are the sigmoid function and index of the hidden state. Then, we calculate the input gate i t ×C t as follows: where i t andC t are the output of each neural network layer for the input gate. W i and b i denote the weight matrix and bias vector for i t . W C and b C denote the weight matrix and bias vector forC t . Then, we update the current cell state C t as follows: where C t−1 denotes previous cell state. Finally, we calculate the current hidden state h t as follows: where o t denotes result of the output gate. W o and b o are the weight matrix and biad vector for the output gate, respectively. After this procedure is performed recurrently for all states and the LSTM cell, the result of the states for the LSTM model is connected to the output layer, which has one hidden unit. Then, we update the weight matrix and the bias vector at each LSTM layer based on the cross-entropy loss function. The cross-entropy plays the role of a loss function L of the LSTM using mini-batches, as follows [24]: where Y m andŶ m denote the VNV reference and prediction result of LSTM, respectively. m is an index of the mini-batch, with M representing the mini-batch size. To optimize the parameters of the LSTM, such as the weight matrix and bias vector, the parameters are repeatedly updated by the adaptive moment estimation (ADAM) [25]. In addition, the procedure is repeatedly carried out for the high-performance model until a specific epoch, and we then classify the VNVMC through the threshold using the trained LSTM model.

Statistics
To compare the VNVMC classification algorithm with conventional methods, including a support vector machine (SVM), artificial neural network (ANN), and deep neural network (DNN), we compared the results of the LSTM-based VNVMC classifier. To evaluate the performance of the algorithms, we adopted the accuracy, confusion matrix, area under the receiver operating characteristic (ROC) curve (AUC), and boxplot between the classification result and the reference value. All statistical analyses were performed using MATLAB R2020b and IBM SPSS ver 21.0 (IBM Corp., Armonk, New York, NY, USA) [26].

Data Collection Protocol and Data Sets
Every participant signed an informed consent before the measurement. For this experiment, as shown in Figure 5a, we employed the ES device (ExoRehab, Exosystems, Gyeonggi-do, Korea), which was approved as a medical device by the Korean government. In addition, we used the electrode pads [width: 90 mm, height: 50 mm, contact surface component: hydrogel, resistance: 50 ohms per 20 mm] (StiMus Electrode, HUREV Corp., Gangwon-do, Korea), as shown in Figure 5b. We collected the EMG data from two subjects using our device, as shown in Figure 5a,b. To record the EMG signal, which included the VNVMC signal, we attached the electrode pad to the right thigh, as shown in Figure 1. Then, the reference electrode, which was cut as in (b-2) of Figure 5b, was attached to knee. At this time, since the surface area of the electrode pad (b-1) of Figure 5b was relatively larger than that of the knee, the electrode pad might be separated from the knee while moving the muscle. Therefore, to stably collect the EMG data, we employed a pad of suitable size such as the electrode pad (b-2) in Figure 5b. To collect the VNVMC signal using a varying frequency, which was set from 10 Hz to 90 Hz, we repeatedly collected the data while the parameter increased by 5 Hz. The amplitude of the ES was set 22.10 V pp or 14.72 V pp according to the endurance of the subjects in terms of the pain. While the device was turned on for the ES during 35 s, the only non-voluntary MC signal was recorded for 15 s without the voluntary MC. Next, the non-voluntary MC signal and the voluntary MC signal were simultaneously collected while the muscle of the subject spontaneously contracted for 10 s. Then, the non-voluntary MC signal was obtained for 10 s without the voluntary MC. Since we allowed the participants to sit for one minute before beginning each signal collection to rest, muscle fatigue was minimized while collecting the DB. Finally, we obtained a database (DB) for about 6510 s for six subjects (height (mean ± SD): 167.0 ± 6.5 cm, weight: 67.2 ± 8.9 kg, age: 31.0 ± 8.4 years, # of male/female: 4/2) and the DB was divided into the training DB and test DB to conduct the experiment. Although the experiment was performed with a few participants, the number of the subjects that participated in our experiment was similar when comparing some studies using EMG [27][28][29][30][31][32]. In [27][28][29][30][31][32], since the average number of participants in the literature was aggregated as 6.5, we could confirm that our DB had a general size. The subjects were divided by two groups, and the groups did not overlap each other. In addition, one group was employed in order to train the model, and another group was used as the test DB. At this time, we evaluated the model performance through the cross-validation test of the two groups. The groups were divided as similarly as possible by body weight (group1: 70.0 ± 5.9 kg, group2: 64.3 ± 10.3 kg), age (group1: 33.7 ± 11.0 years, group2: 28.3 ± 2.6 years), and gender ratio (group1: 1 female and 2 male, group2: 1 female and 2 male). To evaluate the performance of the proposed algorithm, the two subjects were divided into two groups, and we used one of the two group as the training DB. The remaining DB was employed as the test DB that was not included in the model learning.

Preprocessing and Data Analysis
Since the EMG signal based on IR was recorded, the EMG signal included the ES signal. For this reason, the ES signal disturbed the signal analysis and caused the degradation of the proposed algorithm. We applied preprocessing using the method described in Section 2.1, and the ES signal in the EMG signal was thus removed, as shown in Figure 6. As shown in Figure 6a,b, we confirmed that the ES signal of the noisy signal with an averaged −14 dB signal-to-noise ratio (SNR) was almost suppressed, and the non-voluntary and voluntary muscle contraction signal remained, with very little residual noise. At this time, to calculate the SNR of the signal, the epoch length was set as only 1000 samples from the front. The SNR of the noisy signal at from 10 Hz to 45 Hz ES appeared with an average of −12 dB, and the SNR of noisy signal at from 50 Hz to 90 Hz ES appeared with an average of −17 dB. However, the signal which was suppressed by the ES signal included the VNVMC signal, and we have to classify the VNVMC signal to correctly measure the MQ, which was estimated using only non-voluntary MC. As shown in Figure 7a, when using 10 Hz ES, we can distinguish the voluntary MC signal from the non-voluntary MC signal through amplitude discrimination. However, when using the 90 Hz ES, we cannot distinguish between two MC signals through the amplitude discrimination, as shown in Figure 7b. Indeed, when the muscle was stimulated by high frequencies, exceeding 20 Hz, it was difficult to detect the voluntary MC signal using the amplitude discrimination. Therefore, after applying the ESS, we extracted the feature vector to classify the VNVMC signal in detail, using the LSTM model.   The feature vector was extracted using the ES-suppressed signal and consisted of PoSCS (19 dimension) and SCSyV (256 dimension). To confirm the availability of the extracted features, we compared the distribution of the feature from the non-voluntary MC signal with that from the mixed MC signal, as shown in Figure 8. As a result, the distributions of the feature between the VNVMC were distinctly separated. Thus, we confirmed that the extracted feature vector had useful characteristics to classify the VNVMC signal. However, when we variously set the frequency parameter of the ES in accordance with the type of the IR signal, the key features appeared differently to each parameter to classify the VNVMC signal. Since the key features had to be employed differently, according to muscle condition, it is difficult to classify the VNVMC using a threshold of the feature. For this reason, we need to train the LSTM model using variously extracted features to improve the performance of the algorithm. The feature vector was reconstructed using feature selection to improve the proposed algorithm. Finally, the input features of the proposed algorithm were experimentally selected for higher performance.

VNVMC Classification
To classify the VNVMC signal, we trained the classification model based on the LSTM technique described in Section 2.3. The number of LSTM cells with a time-step size of 16 was three and the hidden unit for each LSTM cell was set [128,128,128]. The parameters of the LSTM model were set empirically through the experiments to find the best performance. To evaluate the performance of the DNN model, the number of hidden layers was set as three and the number of hidden units was set as [64,64,64]. In addition, the activation function of the DNN model was an exponential linear unit (ELU) function, and cross-entropy was used for the loss function of the DNN model. In time, the parameters of the DNN model were empirically determined through the experiments with the best performance. When the number of the hidden layers increased to more than four layers, the overfitting problem occurred in the model. To train the SVM model, we chose the second-order polynomial function for the kernel function, and the kernel scale was searched for automatically log-scaled positive values in the range of [0.001, 1000]. At this time, we determined the second-order polynomial function through extensive experiments to find the best performance of the SVM model. Next, to learn the ANN model, we set one hidden layer with 128 hidden units, and we then selected the ELU function as the activation function of the ANN model. In addition, the parameters, including the weight matrix and the bias vector, were updated at the hidden layer based on the cross-entropy loss function. To equivalently evaluate both the conventional algorithm and the proposed algorithm, we employed the same feature vector and the same training/test DB.
Finally, to evaluate the performance of the VNVMC algorithm, we compared the proposed method with conventional methods using the total accuracy, confusion matrix, AUC, and boxplot of the VNV reference and the prediction result. As a result, our experimental results, such as the total accuracy, confusion matrix and AUC, are summarized in Tables 1 and 2. At this time, the LSTM model shows a better performance than the conventional machine-learning method in terms of the evaluation results summarized in Tables 1 and 2. When we evaluated the performance of the models regarding each the ES frequency parameters, the performance of the LSTM model showed, on average, a larger AUC than the conventional model, as shown in Table 2 and Figure 9. As shown in Figure 10, the boxplot shows the results of the LSTM model and conventional model. The central line in each boxplot means median value, the edges of the boxplot indicate the 25th (lower) and 75th (upper) percentiles, and the outliers were plotted using the + symbol. The whiskers of the boxplot that extended to the maximum value were excluded as outliers. Since the box size was inversely proportional to the performance, the conventional models, including SVM, ANN, and DNN, were unstable, as shown in Figure 10b, while the LSTM model yielded the precise classification for the VNVMC signal. Although the box size of the models was similar, as shown in Figure 9a, the performance of the LSTM model was better than the conventional method in terms of the central line and minimum value of the box. Thus, as plotted in Figure 10, we confirmed that the LSTM model more accurately classified the VNVMC signal than the conventional model. As a result, since the cell state memorizes the previous information, the performance of the LSTM model regarding the sequential data is better than that of the model trained by the conventional method.

Discussion
We have developed the MQ technique to conveniently confirm the muscle condition, without an expert at home. Moreover, since the IR signal does not depend on the condition of the subject, the MQ technique precisely measures the muscle condition without error, compared to an analysis of voluntary MC. Indeed, since the IR signal is response signal of the target muscle, we obtain the DBM though the feature extraction technique. At this time, since the IR signal, which is a novel data type for EMG recording, has been used to measure the muscle characteristics for research into our MQ measurement technique, we believe that the proposed research in this paper is a crucial and unique study. Finally, the DBM is employed as the input of the AI model and, thus, we can estimate the MQ for the patients. Furthermore, we aim to estimate various diseases, such as sarcopenia, myopathy, neuropathy, and Parkinson's disease, using the IR signal, DBM, and AI in future works. However, if the IR signal contains the voluntary MC, the performance of the MQ technique is degraded. Thus, when using the proposed algorithm for the MQ measurement technique, we can improve the performance of the disease-detection algorithm and MQ measurement technique. As a result, the performance of the LSTM model is better than that of the conventional methods. In [21], Song et al. proved that the LSTM has a robust estimation ability for time series data prediction. The LSTM model also more robustly estimated target value than conventional methods such as the fully connected neural network in [21]. Hence, since our DB is time series data in this paper, our model, trained by the LSTM scheme, exhibited the best performance compared with the conventional methods. In the experiment, the frequency parameter of the ES was set as 10 Hz to 90 Hz. However, when we employed the ES which is set at a high frequency, exceeding 90 Hz, it was difficult to divide the VNVMC signal using the features. Thus, research addressing the limitation issues is needed in future works.

Conclusions
To detect the voluntary MC signal, we propose the VNVMC signal classification algorithm based on the LSTM. For this, we first collect the IRS DB for various ES frequencies, and we then extract the feature vectors, such as PoSCS and SCSyV. Since the distribution of features appears differently for each class, it is possible to classify the VNVMC signal using these features. Since changes in the frequency components are observed with voluntary MC, the extracted feature can effectively classify the VNVMC signal. In addition, because the major classification features for the appear differently, in accordance with the muscle condition, we train the classification model using the feature vector. To improve performance, the proposed model is trained by the LSTM scheme, and its performance is better than that of the conventional methods such as SVM, ANN, and DNN. Since the LSTM model is suitable for sequential data, such as IRS, the LSTM model shows the best performance when compared with conventional methods.

Conflicts of Interest:
The authors declare no conflict of interest.

Abbreviations
The following abbreviations are used in this manuscript: