# Recognition of Human Motion Intentions Based on Bayesian-Optimized XGBOOST Algorithm

Authors: Jingwei Gao; Chao Ma; Da Wu; Xiaoli Xu; Shaohong Wang; Jie Yao
Journal: Journal of Sensors
 (2022)

---

## Abstract

In order to improve the recognition rate for lower extremity motion patterns, this study designs a recognition method for such patterns, which integrates electromyography (EMG) and inertial measurement unit (IMU) signals in three posture modes, including walking on the ground, squatting, and extending seated legs, to address the difficulty with obtaining high signal-to-noise ratio EMG and IMU signals synchronously. Besides, this study proposes a synchronous analysis method for EMG and IMU dual-mode information to correct antipower frequency interference accelerometer signals. The collected signals are preprocessed to extract eigenvalues. And by using the kernel principal component analysis (KPCA), the information on these eigenvalues is fused. Finally, according to the characteristics of the data, a Bayesian-optimized XGBOOST algorithm is designed. Lower-limb movement patterns are classified with the feature vector put into the optimization algorithm. Multiperson experimental results show that the average recognition accuracy for different poses can reach 94.42%, the averageF1 value 95.33%, and the average return value 95.68%, proving that the model proposed can be used to identify human motion intentions and its generalization ability can detect individual differences in human bodies.


---

## Body

## 1. Introduction

### 1.1. Overview

With the rapid development of computer technology as well as the continuous improvement of people’s lives, great changes have taken place in the diet structures and work styles of people, with increasingly more of them becoming accustomed to sedentary jobs. As people age, these lifestyles may increase the risk of getting diseases such as hypertension, cerebrovascular troubles, and stroke [1], most of which can cause sequelae, such as motor dysfunction [2].In the United States, for example, 18 out of 10,000 people are stroke patients, 25% of the patients have to rely on wheelchairs to assist their walking, and 60% of the patients encounter greatly reduced muscle endurance and lowered walking speed three months after the onset of related diseases [3]. Stroke, traumatic brain injury, spinal cord injury [4], and other sequelae bring physical pains and mental torments to patients. Moreover, treatment costs also impose a great burden on governments and patients’ families. In addition, when general patients are troubled with muscle weakness after the onset of related diseases, auxiliary personnel need to consume more physical strength to assist them during the training process. This forms a major test of patients’ strength and endurance, which makes the traditional artificial rehabilitation method for patients difficult to sustain, thereby reducing the intensity of training and delaying the recovery of patients.Assistive rehabilitation robots can maximize patients’ limb functions, activity scopes, and independence, while minimizing secondary complications [5], thus becoming one of the important ways for patients to undergo training and treatment and widely recognized by experts in related fields [6].


### 1.2. Significance of This Study

Clinically, lower extremity rehabilitation equipment is widely used in the recovery of patients with lower extremity amputations caused by nerve injury and other diseases or accidents while providing safe and reliable gait rehabilitation support for patients with walking dysfunction [7]. With such treatments, patients can complete a large batch of repetitive physiological gait training through mechanical lower limbs and reestablish correct movement patterns so that they can participate in daily activities like normal people, thus improving their life quality [8].When used for patients with walking dysfunction, the lower-limb intelligent rehabilitation equipment must determine wearers’ movement intentions accurately, quickly, and stably. Although decoding wearers’ electroencephalogram (EEG) information can help identify the motion intention of the lower limbs of humans, some problems exist, such as difficulty in information extraction, frequent interferences, and low accuracy of multijoint action recognition. As a kind of neural signal, EMG has the property of being generated ahead of limb movement [9, 10]; therefore, by measuring the EMG of human bodies, the degree of muscle fatigue [11] and the functional state of humans can be measured [12].Accordingly, this study uses EMG signals and IMU signals as the identification source of lower-limb action intention, to adopt multisource signal synchronous acquisition technology to collect the subjects’ EMG and lower-limb inertial information, for high-performance collection of human motion information as well as application of neural signals and inertial sensor information in the control over intelligent lower-limb rehabilitation equipment.


### 1.3. Contributions of This Study

Key contributions of this study are stated as follows.(1)
Data Acquisition. Motion intention data were collected with EMG and IMU sensors from 10 subjects (age: 24±2 years old and age range: 22~26 years old; male/female: 6/4; height: 170~185 cm; and weight: 50~92 kg). Through an initial assessment of data quality, available data collection time, and potential participant fatigue, each subject recorded an average of 8 or 9 trials (range: 8-10). The final dataset consists of 95 horizontal walking trials, 85 squat trials, and 95 sitting-leg extension trials.(2)
Data Processing and Dual-Mode Signal Feature Extraction. This method improves the quality of EMG signals through second-order analog-digital hybrid antialiasing filtering to optimize the design of front-end acquisition circuits and EMG electrodes. Reliable acceleration signals are obtained by calibrating the IMU signals. A unified clock is used to control each acquisition module to ensure the synchronization of multichannel signals. Eigenvalues are extracted after the collected signals are preprocessed with the kernel principal component analysis (KPCA) implemented to fuse such eigenvalues.(3)
Pattern Recognition Algorithm. The extracted data are substituted into the Bayesian-optimized XGBOOST algorithm for classification. A multiperson test finds that the average precision can reach 94.42%, the average recall 95.68%, and the average F1 score 95.33%, demonstrating that the generalization ability of the model would not be affected by individual differences between human bodies.


### 1.4. Organization of This Paper

The rest of the sections are structured as follows: Section2 is for a literature review on gait data analyses with EMG and IMU sensors. Section 3 describes the data collection and preprocessing of raw data in this study. Section 4 demonstrates the optimization algorithm steps. Section 5 introduces the experimental design and procedure. Section 6 offers conclusions and analyses and provides some comparisons with others’ experiments. The last section summarizes this study and proposes future research directions.


## 1.1. Overview

With the rapid development of computer technology as well as the continuous improvement of people’s lives, great changes have taken place in the diet structures and work styles of people, with increasingly more of them becoming accustomed to sedentary jobs. As people age, these lifestyles may increase the risk of getting diseases such as hypertension, cerebrovascular troubles, and stroke [1], most of which can cause sequelae, such as motor dysfunction [2].In the United States, for example, 18 out of 10,000 people are stroke patients, 25% of the patients have to rely on wheelchairs to assist their walking, and 60% of the patients encounter greatly reduced muscle endurance and lowered walking speed three months after the onset of related diseases [3]. Stroke, traumatic brain injury, spinal cord injury [4], and other sequelae bring physical pains and mental torments to patients. Moreover, treatment costs also impose a great burden on governments and patients’ families. In addition, when general patients are troubled with muscle weakness after the onset of related diseases, auxiliary personnel need to consume more physical strength to assist them during the training process. This forms a major test of patients’ strength and endurance, which makes the traditional artificial rehabilitation method for patients difficult to sustain, thereby reducing the intensity of training and delaying the recovery of patients.Assistive rehabilitation robots can maximize patients’ limb functions, activity scopes, and independence, while minimizing secondary complications [5], thus becoming one of the important ways for patients to undergo training and treatment and widely recognized by experts in related fields [6].


## 1.2. Significance of This Study

Clinically, lower extremity rehabilitation equipment is widely used in the recovery of patients with lower extremity amputations caused by nerve injury and other diseases or accidents while providing safe and reliable gait rehabilitation support for patients with walking dysfunction [7]. With such treatments, patients can complete a large batch of repetitive physiological gait training through mechanical lower limbs and reestablish correct movement patterns so that they can participate in daily activities like normal people, thus improving their life quality [8].When used for patients with walking dysfunction, the lower-limb intelligent rehabilitation equipment must determine wearers’ movement intentions accurately, quickly, and stably. Although decoding wearers’ electroencephalogram (EEG) information can help identify the motion intention of the lower limbs of humans, some problems exist, such as difficulty in information extraction, frequent interferences, and low accuracy of multijoint action recognition. As a kind of neural signal, EMG has the property of being generated ahead of limb movement [9, 10]; therefore, by measuring the EMG of human bodies, the degree of muscle fatigue [11] and the functional state of humans can be measured [12].Accordingly, this study uses EMG signals and IMU signals as the identification source of lower-limb action intention, to adopt multisource signal synchronous acquisition technology to collect the subjects’ EMG and lower-limb inertial information, for high-performance collection of human motion information as well as application of neural signals and inertial sensor information in the control over intelligent lower-limb rehabilitation equipment.


## 1.3. Contributions of This Study

Key contributions of this study are stated as follows.(1)
Data Acquisition. Motion intention data were collected with EMG and IMU sensors from 10 subjects (age: 24±2 years old and age range: 22~26 years old; male/female: 6/4; height: 170~185 cm; and weight: 50~92 kg). Through an initial assessment of data quality, available data collection time, and potential participant fatigue, each subject recorded an average of 8 or 9 trials (range: 8-10). The final dataset consists of 95 horizontal walking trials, 85 squat trials, and 95 sitting-leg extension trials.(2)
Data Processing and Dual-Mode Signal Feature Extraction. This method improves the quality of EMG signals through second-order analog-digital hybrid antialiasing filtering to optimize the design of front-end acquisition circuits and EMG electrodes. Reliable acceleration signals are obtained by calibrating the IMU signals. A unified clock is used to control each acquisition module to ensure the synchronization of multichannel signals. Eigenvalues are extracted after the collected signals are preprocessed with the kernel principal component analysis (KPCA) implemented to fuse such eigenvalues.(3)
Pattern Recognition Algorithm. The extracted data are substituted into the Bayesian-optimized XGBOOST algorithm for classification. A multiperson test finds that the average precision can reach 94.42%, the average recall 95.68%, and the average F1 score 95.33%, demonstrating that the generalization ability of the model would not be affected by individual differences between human bodies.


## 1.4. Organization of This Paper

The rest of the sections are structured as follows: Section2 is for a literature review on gait data analyses with EMG and IMU sensors. Section 3 describes the data collection and preprocessing of raw data in this study. Section 4 demonstrates the optimization algorithm steps. Section 5 introduces the experimental design and procedure. Section 6 offers conclusions and analyses and provides some comparisons with others’ experiments. The last section summarizes this study and proposes future research directions.


## 2. Review of Related Works

High-performance assisted rehabilitation robots can help reintegrate patients into society while improving their quality of life. Only by correctly identifying the motion patterns of the lower limbs of patients can an effective control strategy be developed. Therefore, the research on the recognition of motion patterns of the lower limbs has become one of the hot topics in the field of intelligent prosthetics [5, 6].Recognition methods for sensor-based lower extremity motion patterns are favored by researchers because of their high sensitivity and freedom from environmental factors. In the research on lower limbs’ gait recognition, to obtain sufficient human motion information, it is necessary to build up a multisensor information acquisition system. Multichannel EMG and acceleration signals are widely used in the recognition of human movement patterns. By using Kinect sensors and IMU, Bijalwan et al. [13] explored in detail the biomechanical properties of the pelvic, hip, knee, and ankle joint motions during normal walking, and this research is much useful for prosthetic and exoskeleton design. To find the characteristics of the lower-limb movements, Semwal et al. [14], Jain et al. [15], and others used IMU sensors for gait recognition, and their results can be used for gait parameter estimation, health monitoring systems, automatic feature extraction, and gait event detection. By placing four flexible piezoelectric sensors on the knees and hips, Cha et al. [16] delivered a gait recognition rate of over 93%. Huang et al. [17] combined plantar pressure signals and 9-channel EMG signals to classify the stance phase and swing phase of gaits at an accuracy of over 90%, thus correctly identifying the transition of gait phases.At present, the commonly used sensor information for recognition of lower-limb motion patterns mainly includes EMG signals, plantar pressure signals, joint angle signals, and IMU signals [18, 19]. The sensors that can collect acceleration signals have the advantages of cheap price, small size, low power consumption, and rich motion information. To acquire EMG signals, sensors can be simply fixed on the corresponding muscles, so the signal acquisition is convenient and flexible. IMU signals can reflect large-scale human motion information, while EMG signals can showcase refined muscle activity information [20, 21]. Therefore, it is reasonable to combine the two kinds of signals. To improve the recognition accuracy and overcome the difficulty in detecting lower limbs’ posture changes in complex environments, this study tries to identify lower limbs’ asynchronous patterns by acquiring both EMG and IMU signals.


## 3. Signal Preprocessing and Feature Extraction Methods

### 3.1. Dual-Mode Signal Noise Characteristic Analysis and Signal Analysis Method

According to the characteristics of EMG noise, a variety of measures have been taken to improve the signal-to-noise ratio of EMG signals. Based on the analysis of the noise model of the IMU signals, an accelerometer signal calibration algorithm based on ellipsoid fitting is developed to improve the quality of IMU signals [22], while simultaneous analysis of dual-mode information is carried out to explore the characteristics of EMG and IMU signals.


#### 3.1.1. EMG Signal Noise Model and SNR Improvement Method

The main interferences in EMG detection include electrode impedance change, motion interference, and power frequency interference. This study adopts a series of methods to enhance the EMG noise ratio, such as antialiasing filtering, active shielding, and special flexible metal dry electrodes, with the specific measures shown in Table1.
(1)
Antialiasing Filter. The second-order analog-digital hybrid antialiasing filter is composed of a first-order analog filter and a second-order digital filter. The cutoff frequency of the analog filter is Kfs/2, and the digital filter is responsible for removing the noise between fs/2 and Kfs/2. The sampling frequency of EMG signals is 1 kHz, and the oversampling ratio is K=128. Therefore, the antialiasing analog low-pass filter’s cutoff frequency is(1)Kfs2=128×1kHz2=64kHz.(2)
Optimization of Front-End Amplifier Circuits. An amplifying circuit is used to augment the weak electrical signal, guided by the patch electrode with a gain of 50, and the amplified signals can reach hundreds of millivolts. To improve anti-interference effects, differential inputs are used through two electrodes; in addition, a potentiometer is used for R3, which is convenient for gain adjustment. The circuit diagram is shown in Figure 1.Table 1
Major interferences in EMG detection and the countermeasures taken in this study.
Type of interferenceSource of interferenceCountermeasures of this studyElectrode impedanceSkin oil and sweatAntialiasing filtering and front-end amplifier circuit optimizationMotion disturbanceContact impedance change, electrode displacement, etc.Designing flexible electrodes for improved attachmentsElectromagnetic interference50 Hz power frequency and surrounding electromagnetic environment interferenceBattery power, circuit board wiring isolation, etc.Figure 1
The preoptimized amplification system for data acquisition.


#### 3.1.2. IMU Signal Noise Model and Calibration Algorithm

Human motion signals are collected with the IMU, which may have three main errors: noise (white noise and random walk noise), scale factor error, and axis deviation. The noise model of the accelerometer can be expressed as(2)a0=T×K×aS+b+n,where superscript 0 represents the orthogonal reference coordinate system, S represents the nonorthogonal coordinate system, T represents the transformation matrix of the axis deviation, K represents the scale factor, a represents the true value, n represents the Gaussian white noise, which is mainly caused by external noises from A/D conversion, and b represents the random walk noise, which is comprehensively affected by the internal structures of sensors and temperatures. The scale error comes from the errors appearing when a digital quantity is converted into a physical quantity of acceleration. Axial misalignment would result from the conversion of the measurement from a nonorthogonal coordinate system (the actual coordinate system of an accelerometer) to an orthogonal one (the world coordinate system).When a piece of muscle is deformed and mechanical vibration occurs, the signal from the accelerometer attached to the muscle changes, which is expressed as a muscle signal, and its solution is directly affected by the error and calibration accuracy of the accelerometer itself. Given that the vector and vertex of accelerometer signals fall on an approximate ellipsoid at rest attitude, the accelerometer calibration is generally made based on the least squares fitting (Gauss-Newton algorithm), to fit spherical data for ellipsoid fitting.(3)X−CMX−CT=1+CMCT,where X=xyz represents the accelerometer coordinate point, C=cxcycz represents the ellipsoid center coordinate, M represents the transformation matrix, and r represents the ellipsoid axis length. And the formula for M is as follows:
(4)M=r11r12r13r21r22r23r31r32r33l1000l2000l3r11r12r13r21r22r23r31r32r33=a1a42a52a42a2a62a52a62a3.


### 3.2. Dual-Mode Synchronization Analysis Method for Information from EMG and IMU

The purpose of feature fusion is to retain the useful information in the original feature vectors as much as possible while eliminating redundant information. When extracting the eigenvalues of the EMG and IMU signals, it is found that their distribution in the eigenspace is nonlinear; as a result, the traditional linear fusion method is not applicable. As a kernel version of principal component analysis (PCA), kernel principal component analysis (KPCA) can map feature vectors to high-dimensional feature spaces through a preselected nonlinear mapping function and then PCA can be further adopted. The method would calculate the principal component, thus not only maintaining the advantages of PCA but also solving the problem of nonlinear dimensionality reduction. Since the scales of eigenvalues extracted from different signals vary greatly, the eigenvalues need to be normalized before fusion, as shown in(5)xnew=x−μσ,where xnew indicates the normalized eigenvalue and μ and σ indicate the mean and variance of the data. Equation (5) can normalize the eigenvectors to a dataset with mean 0 and variance 1. The feature vectors are fused according to the KPCA method as introduced by Deng et al. [23].


## 3.1. Dual-Mode Signal Noise Characteristic Analysis and Signal Analysis Method

According to the characteristics of EMG noise, a variety of measures have been taken to improve the signal-to-noise ratio of EMG signals. Based on the analysis of the noise model of the IMU signals, an accelerometer signal calibration algorithm based on ellipsoid fitting is developed to improve the quality of IMU signals [22], while simultaneous analysis of dual-mode information is carried out to explore the characteristics of EMG and IMU signals.


### 3.1.1. EMG Signal Noise Model and SNR Improvement Method

The main interferences in EMG detection include electrode impedance change, motion interference, and power frequency interference. This study adopts a series of methods to enhance the EMG noise ratio, such as antialiasing filtering, active shielding, and special flexible metal dry electrodes, with the specific measures shown in Table1.
(1)
Antialiasing Filter. The second-order analog-digital hybrid antialiasing filter is composed of a first-order analog filter and a second-order digital filter. The cutoff frequency of the analog filter is Kfs/2, and the digital filter is responsible for removing the noise between fs/2 and Kfs/2. The sampling frequency of EMG signals is 1 kHz, and the oversampling ratio is K=128. Therefore, the antialiasing analog low-pass filter’s cutoff frequency is(1)Kfs2=128×1kHz2=64kHz.(2)
Optimization of Front-End Amplifier Circuits. An amplifying circuit is used to augment the weak electrical signal, guided by the patch electrode with a gain of 50, and the amplified signals can reach hundreds of millivolts. To improve anti-interference effects, differential inputs are used through two electrodes; in addition, a potentiometer is used for R3, which is convenient for gain adjustment. The circuit diagram is shown in Figure 1.Table 1
Major interferences in EMG detection and the countermeasures taken in this study.
Type of interferenceSource of interferenceCountermeasures of this studyElectrode impedanceSkin oil and sweatAntialiasing filtering and front-end amplifier circuit optimizationMotion disturbanceContact impedance change, electrode displacement, etc.Designing flexible electrodes for improved attachmentsElectromagnetic interference50 Hz power frequency and surrounding electromagnetic environment interferenceBattery power, circuit board wiring isolation, etc.Figure 1
The preoptimized amplification system for data acquisition.


### 3.1.2. IMU Signal Noise Model and Calibration Algorithm

Human motion signals are collected with the IMU, which may have three main errors: noise (white noise and random walk noise), scale factor error, and axis deviation. The noise model of the accelerometer can be expressed as(2)a0=T×K×aS+b+n,where superscript 0 represents the orthogonal reference coordinate system, S represents the nonorthogonal coordinate system, T represents the transformation matrix of the axis deviation, K represents the scale factor, a represents the true value, n represents the Gaussian white noise, which is mainly caused by external noises from A/D conversion, and b represents the random walk noise, which is comprehensively affected by the internal structures of sensors and temperatures. The scale error comes from the errors appearing when a digital quantity is converted into a physical quantity of acceleration. Axial misalignment would result from the conversion of the measurement from a nonorthogonal coordinate system (the actual coordinate system of an accelerometer) to an orthogonal one (the world coordinate system).When a piece of muscle is deformed and mechanical vibration occurs, the signal from the accelerometer attached to the muscle changes, which is expressed as a muscle signal, and its solution is directly affected by the error and calibration accuracy of the accelerometer itself. Given that the vector and vertex of accelerometer signals fall on an approximate ellipsoid at rest attitude, the accelerometer calibration is generally made based on the least squares fitting (Gauss-Newton algorithm), to fit spherical data for ellipsoid fitting.(3)X−CMX−CT=1+CMCT,where X=xyz represents the accelerometer coordinate point, C=cxcycz represents the ellipsoid center coordinate, M represents the transformation matrix, and r represents the ellipsoid axis length. And the formula for M is as follows:
(4)M=r11r12r13r21r22r23r31r32r33l1000l2000l3r11r12r13r21r22r23r31r32r33=a1a42a52a42a2a62a52a62a3.


## 3.1.1. EMG Signal Noise Model and SNR Improvement Method

The main interferences in EMG detection include electrode impedance change, motion interference, and power frequency interference. This study adopts a series of methods to enhance the EMG noise ratio, such as antialiasing filtering, active shielding, and special flexible metal dry electrodes, with the specific measures shown in Table1.
(1)
Antialiasing Filter. The second-order analog-digital hybrid antialiasing filter is composed of a first-order analog filter and a second-order digital filter. The cutoff frequency of the analog filter is Kfs/2, and the digital filter is responsible for removing the noise between fs/2 and Kfs/2. The sampling frequency of EMG signals is 1 kHz, and the oversampling ratio is K=128. Therefore, the antialiasing analog low-pass filter’s cutoff frequency is(1)Kfs2=128×1kHz2=64kHz.(2)
Optimization of Front-End Amplifier Circuits. An amplifying circuit is used to augment the weak electrical signal, guided by the patch electrode with a gain of 50, and the amplified signals can reach hundreds of millivolts. To improve anti-interference effects, differential inputs are used through two electrodes; in addition, a potentiometer is used for R3, which is convenient for gain adjustment. The circuit diagram is shown in Figure 1.Table 1
Major interferences in EMG detection and the countermeasures taken in this study.
Type of interferenceSource of interferenceCountermeasures of this studyElectrode impedanceSkin oil and sweatAntialiasing filtering and front-end amplifier circuit optimizationMotion disturbanceContact impedance change, electrode displacement, etc.Designing flexible electrodes for improved attachmentsElectromagnetic interference50 Hz power frequency and surrounding electromagnetic environment interferenceBattery power, circuit board wiring isolation, etc.Figure 1
The preoptimized amplification system for data acquisition.


## 3.1.2. IMU Signal Noise Model and Calibration Algorithm

Human motion signals are collected with the IMU, which may have three main errors: noise (white noise and random walk noise), scale factor error, and axis deviation. The noise model of the accelerometer can be expressed as(2)a0=T×K×aS+b+n,where superscript 0 represents the orthogonal reference coordinate system, S represents the nonorthogonal coordinate system, T represents the transformation matrix of the axis deviation, K represents the scale factor, a represents the true value, n represents the Gaussian white noise, which is mainly caused by external noises from A/D conversion, and b represents the random walk noise, which is comprehensively affected by the internal structures of sensors and temperatures. The scale error comes from the errors appearing when a digital quantity is converted into a physical quantity of acceleration. Axial misalignment would result from the conversion of the measurement from a nonorthogonal coordinate system (the actual coordinate system of an accelerometer) to an orthogonal one (the world coordinate system).When a piece of muscle is deformed and mechanical vibration occurs, the signal from the accelerometer attached to the muscle changes, which is expressed as a muscle signal, and its solution is directly affected by the error and calibration accuracy of the accelerometer itself. Given that the vector and vertex of accelerometer signals fall on an approximate ellipsoid at rest attitude, the accelerometer calibration is generally made based on the least squares fitting (Gauss-Newton algorithm), to fit spherical data for ellipsoid fitting.(3)X−CMX−CT=1+CMCT,where X=xyz represents the accelerometer coordinate point, C=cxcycz represents the ellipsoid center coordinate, M represents the transformation matrix, and r represents the ellipsoid axis length. And the formula for M is as follows:
(4)M=r11r12r13r21r22r23r31r32r33l1000l2000l3r11r12r13r21r22r23r31r32r33=a1a42a52a42a2a62a52a62a3.


## 3.2. Dual-Mode Synchronization Analysis Method for Information from EMG and IMU

The purpose of feature fusion is to retain the useful information in the original feature vectors as much as possible while eliminating redundant information. When extracting the eigenvalues of the EMG and IMU signals, it is found that their distribution in the eigenspace is nonlinear; as a result, the traditional linear fusion method is not applicable. As a kernel version of principal component analysis (PCA), kernel principal component analysis (KPCA) can map feature vectors to high-dimensional feature spaces through a preselected nonlinear mapping function and then PCA can be further adopted. The method would calculate the principal component, thus not only maintaining the advantages of PCA but also solving the problem of nonlinear dimensionality reduction. Since the scales of eigenvalues extracted from different signals vary greatly, the eigenvalues need to be normalized before fusion, as shown in(5)xnew=x−μσ,where xnew indicates the normalized eigenvalue and μ and σ indicate the mean and variance of the data. Equation (5) can normalize the eigenvectors to a dataset with mean 0 and variance 1. The feature vectors are fused according to the KPCA method as introduced by Deng et al. [23].


## 4. Bayesian-Optimized XGBOOST Algorithm

### 4.1. Steps of XGBOOST Algorithm

In this study, an XGBOOST algorithm built based on Bayesian optimization is used to process the input data. As one of the very effective machine learning algorithms, XGBOOST [24] algorithm has a core principle: take the second-order Taylor expansion of the objective function and then use the second-order derivative of the function to train tree models. In addition, the complexity of tree models is incorporated into the optimization objective as a regular term to improve the efficiency of the learning model [25].In the XGBOOST algorithm, the first step is to solve the objective functionobjt in the splitting tree model for postures of lower limbs. The objective function in the t-th iteration can be expressed as
(6)objt=∑i=1ngiftxi+12hift2xi+Ωft=∑i=1ngiwqxi+12hiwqxi2+γT+12λ∑j=1Twj2=∑j=1T∑i∈Ijgiwj+12∑i∈Ijhi+λwj2+γT,where fx indicates one of the trees, γ indicates the weight of the number of leaves, Ωft indicates the complexity of the trees, T indicates the number of leaf nodes, λ indicates the complexity of a leaf, wj2 indicates the norm of the leaf node L2, j indicates the number of leaf nodes, and q indicates the structure of a tree. gi and hi are defined as follows:
(7)gi=∂y∧t−1lyi,y∧t−1,hi=∂2y∧t−1lyi,y∧t−1,where the true value is yi, and the predicted value is y^i∑j=1T, representing all the training samples that have been grouped based on the leaf nodes. Ij=iqxi=j represents the lead node sample set that contains all samples from the j-th lead node.
(8)objt=∑j=1TGjwj+12Hj+λwj2+γT,where Gj=∑i∈Ijgi represents the sum of the first-order partial derivatives of the samples contained in the j-th leaf node (a constant) and Hj=∑i∈Ijhi represents the sum of their second-order partial derivatives of them.Similar to the information gain and Gini index used in the random forest, the XGBOOST algorithm calculates the gainΘ of the selected parameter when attempting to create a segment for an existing leaf:
(9)Θ=12GL2HL+λ+GR2HR+λ−GL+GR2HL+HR+λ−γ,where the subscripts L and R represent the left and right subtrees, respectively, GL2/HL+λ shows the information score of the left subtree, GR2/HR+λ shows that of the right one, and GL+GR2/HL+HR+λ indicates the information score when no segmentation is created.By taking the derivative of Equation (8) concerning wj and setting the derivative to zero, it is possible to obtain the output score of the lead node wj∗ and the minimum loss of the posture tree structure S as follows:
(10)wj∗=−GjHj+λ,(11)S=−12∑i=1TGj2Hj+λ+γT.Figure2 shows the steps involved in creating a splitting tree for postures in complex systems.Figure 2
Flowchart for a posture-splitting tree.


### 4.2. Optimization

In any machine learning algorithm, the hyperparameters must be initialized before any learning process is launched because few algorithms are hyperparameter-independent. Besides, the prediction accuracy of the XGBOOST machine learning algorithm is deeply affected by several hyperparameters, including the amount and depth of trees. Therefore, suitable adjustments to these hyperparameters are crucial for enhancing the accuracy of learning models. However, hyperparameter optimization is a process that entails choosing a set of optimal hyperparameters; therefore, the gradient descent algorithm used to optimize general parameters cannot be applied directly in this process.As a Bayes-based method, Bayesian optimization is purposed to search the global extremum of functions (especially the high-dimensional nonlinear nonconvex functions) [26].There are two core steps involved in Bayesian optimization: the prior function (PF) and the acquisition function (AC). The former primarily adopts Gaussian process regression, while the latter incorporates multiple methods, such as EI, PI, and UCB. Furthermore, the balance between exploitation and exploration can also be realized by AC. There are three types of acquisition functions: upper confidence bound (UCB), probability of improvement (PI), and expected improvement (EI). This study adopts the PI (probability of improvement) acquisition function as follows:(12)PIx=Pfx≥fx++v=Φμx−fx+−vσx.The hyperparameterμ is used to tune the balance between exploration and exploitation. μ=0 indicates a tendency to converge at fx+, Φ⋅ represents the cumulative distribution function of the standard normal, and fx+ represents the current maximum. x is the observation point, while σ is the standard deviation of all observation points. The Bayesian-optimized process is shown in Figure 3.Figure 3
Flowchart of Bayesian optimization.Bayesian optimization uses certain constantly updated probabilistic models to “set” promising hyperparameters by inferring past results. By referring to previous estimates, Bayesian methods can save a lot of wasted efforts when trying the next set of hyperparameters. The combination of Bayesian optimization and XGBOOST can effectively reduce algorithm overfitting and computation workload, and the efficiency of the model algorithm can also be greatly boosted by optimizing the parameters. The model can quickly and accurately identify complex posture changes in lower limbs to achieve the expected purpose. The experimental process and verification are shown below.


## 4.1. Steps of XGBOOST Algorithm

In this study, an XGBOOST algorithm built based on Bayesian optimization is used to process the input data. As one of the very effective machine learning algorithms, XGBOOST [24] algorithm has a core principle: take the second-order Taylor expansion of the objective function and then use the second-order derivative of the function to train tree models. In addition, the complexity of tree models is incorporated into the optimization objective as a regular term to improve the efficiency of the learning model [25].In the XGBOOST algorithm, the first step is to solve the objective functionobjt in the splitting tree model for postures of lower limbs. The objective function in the t-th iteration can be expressed as
(6)objt=∑i=1ngiftxi+12hift2xi+Ωft=∑i=1ngiwqxi+12hiwqxi2+γT+12λ∑j=1Twj2=∑j=1T∑i∈Ijgiwj+12∑i∈Ijhi+λwj2+γT,where fx indicates one of the trees, γ indicates the weight of the number of leaves, Ωft indicates the complexity of the trees, T indicates the number of leaf nodes, λ indicates the complexity of a leaf, wj2 indicates the norm of the leaf node L2, j indicates the number of leaf nodes, and q indicates the structure of a tree. gi and hi are defined as follows:
(7)gi=∂y∧t−1lyi,y∧t−1,hi=∂2y∧t−1lyi,y∧t−1,where the true value is yi, and the predicted value is y^i∑j=1T, representing all the training samples that have been grouped based on the leaf nodes. Ij=iqxi=j represents the lead node sample set that contains all samples from the j-th lead node.
(8)objt=∑j=1TGjwj+12Hj+λwj2+γT,where Gj=∑i∈Ijgi represents the sum of the first-order partial derivatives of the samples contained in the j-th leaf node (a constant) and Hj=∑i∈Ijhi represents the sum of their second-order partial derivatives of them.Similar to the information gain and Gini index used in the random forest, the XGBOOST algorithm calculates the gainΘ of the selected parameter when attempting to create a segment for an existing leaf:
(9)Θ=12GL2HL+λ+GR2HR+λ−GL+GR2HL+HR+λ−γ,where the subscripts L and R represent the left and right subtrees, respectively, GL2/HL+λ shows the information score of the left subtree, GR2/HR+λ shows that of the right one, and GL+GR2/HL+HR+λ indicates the information score when no segmentation is created.By taking the derivative of Equation (8) concerning wj and setting the derivative to zero, it is possible to obtain the output score of the lead node wj∗ and the minimum loss of the posture tree structure S as follows:
(10)wj∗=−GjHj+λ,(11)S=−12∑i=1TGj2Hj+λ+γT.Figure2 shows the steps involved in creating a splitting tree for postures in complex systems.Figure 2
Flowchart for a posture-splitting tree.


## 4.2. Optimization

In any machine learning algorithm, the hyperparameters must be initialized before any learning process is launched because few algorithms are hyperparameter-independent. Besides, the prediction accuracy of the XGBOOST machine learning algorithm is deeply affected by several hyperparameters, including the amount and depth of trees. Therefore, suitable adjustments to these hyperparameters are crucial for enhancing the accuracy of learning models. However, hyperparameter optimization is a process that entails choosing a set of optimal hyperparameters; therefore, the gradient descent algorithm used to optimize general parameters cannot be applied directly in this process.As a Bayes-based method, Bayesian optimization is purposed to search the global extremum of functions (especially the high-dimensional nonlinear nonconvex functions) [26].There are two core steps involved in Bayesian optimization: the prior function (PF) and the acquisition function (AC). The former primarily adopts Gaussian process regression, while the latter incorporates multiple methods, such as EI, PI, and UCB. Furthermore, the balance between exploitation and exploration can also be realized by AC. There are three types of acquisition functions: upper confidence bound (UCB), probability of improvement (PI), and expected improvement (EI). This study adopts the PI (probability of improvement) acquisition function as follows:(12)PIx=Pfx≥fx++v=Φμx−fx+−vσx.The hyperparameterμ is used to tune the balance between exploration and exploitation. μ=0 indicates a tendency to converge at fx+, Φ⋅ represents the cumulative distribution function of the standard normal, and fx+ represents the current maximum. x is the observation point, while σ is the standard deviation of all observation points. The Bayesian-optimized process is shown in Figure 3.Figure 3
Flowchart of Bayesian optimization.Bayesian optimization uses certain constantly updated probabilistic models to “set” promising hyperparameters by inferring past results. By referring to previous estimates, Bayesian methods can save a lot of wasted efforts when trying the next set of hyperparameters. The combination of Bayesian optimization and XGBOOST can effectively reduce algorithm overfitting and computation workload, and the efficiency of the model algorithm can also be greatly boosted by optimizing the parameters. The model can quickly and accurately identify complex posture changes in lower limbs to achieve the expected purpose. The experimental process and verification are shown below.


## 5. Experiments and Pattern Recognition Analyses

### 5.1. System Design and Implementation

This system includes two hardware modules: EMG and IMU signal acquisition, which are two software modules of the lower computer STM32 control program and the upper computer PYTHON program. The control chip used in this system is STM8L151F3, the EMG acquisition chip is ADS1292R, and the IMU acquisition chip is BWT901CL, with an intelligent high-integration Bluetooth inertial measurement unit at the sampling frequency of 200 Hz. Interpolation is made to complement the IMU signal sampling frequency.The freedom in the movement of the human lower limbs includes thighs’ flexion and extension, external rotation and internal rotation, abduction and adduction, calves’ flexion and extension, feet’s flexion and extension, and valgus and varus. Biomechanical simulation and experimental studies have shown that the power consumption in the sagittal plane of the human body is higher than in the frontal plane and the horizontal plane [27] so three-dimensional motions of human bodies can be simplified to a relatively simple plane motion. The five-bar model is often adopted to examine the kinematics and dynamics of walking gaits, with the advantage that it is not needed to consider its lateral gait stability in the frontal plane. In the model, the influence of humans’ heads and arms on the movement process is ignored, and the upper body of humans is simplified as a rigid rod. In addition, each leg is simplified as two rigid rods connected by hinge joints perpendicular to the sagittal plane, while the feet are attached to the calves, under an assumption that the model only contacts the ground through the ends of the calf rigid rods during walking. This human lower-limb model is shown in Figure 4.Figure 4
Establishment of the human coordinate system.The coordinate system involved is defined at the heel of the supporting leg. In particular,e0x is parallel to the instep, from the ankle joint to the toe; and e0y is perpendicular to the instep. And this system also determines the positions of human bodies in the plane, but cannot characterize human bodies’ postures. Meanwhile, other local coordinate systems are used to determine human bodies’ postures. The x-axis of all local coordinate systems is perpendicular to the link and points directly in front of the motion. The relative angle between the two adjacent rods is the relative angle of the joint, represented by θ1~θ4: specifically, θ1 indicates the knee joint angle of the supporting leg; θ2 indicates the hip joint angle of the supporting foot; θ3 indicates the knee joint angle of the swing leg, and θ4 indicates the hip joint angle of the swing leg joint angle.In this study, the right leg of the tester is selected for experiments. After tests and comparisons of the leg muscles, the gastrocnemius and rectus femoris are finally selected as the signal source, and the two sets of EMG sensors (with one set including two detection electrode pads and a reference electrode pad) are arranged in corresponding positions. A three-axis accelerometer is fixed on the tester’s biceps femoris to capture and record raw motion data in thex, y, and z axes. The equipment layout is shown in Figure 5.Figure 5
Equipment layout.During the motion control test, the reference time is sent to the IMU and the EMG sensor through a unified host computer. Each instrument attaches a time stamp to the independently collected data according to the calibrated uniform time so that the time of all instruments can be synchronized. The schematic diagram of the system is shown in Figure6.Figure 6
System design and implementation method.


### 5.2. Test Environment

Carried out in the Key Laboratory of Modern Measurement and Control Technology of the Ministry of Education, this research experiment collects human motion data from several subjects without any neuromusculoskeletal abnormalities (age:24±2 years old and age range: 22~26 years old; male/female: 6/4; height: 170~185 cm; and weight: 50~92 kg). There are no significant differences in age, sex ratio, height, and weight among the subjects (P>0.05), all of whom voluntarily participate in this test by signing the informed consent agreements.


### 5.3. Test Plan

Before data collection, to reduce interference, the muscles related to this study are wiped with alcohol to remove the dander on skin surfaces; and the testers are required not to do strenuous exercise within 24 hours. First, their muscles relax naturally and then they do ten sets of gaits, ten actions of squatting, and ten actions of bending and extending of legs in sitting positions. Tester A’s IMU part is selected to collect signals, as shown in Figure7.Figure 7
Acceleration signals.
(a)(b)(c)The raw EMG data of Tester A and the enlarged data graph after processing are shown in Figure8.Figure 8
EMG signals.
(a)(b)(c)An average of 8 or 9 trials (range 8-10) are recorded per subject through initial assessments of data quality, available data collection time, and potential fatigues of participants. The final dataset consists of 95 horizontal walking trials, 85 squatting trials, and 95 sitting leg extension trials.


### 5.4. Design and Verification of the Model

The programming language for data processing in this study is Python 3.6. All calculations are performed on a desktop computer with a graphics processor of GPU GTX 1650 and 8 GB of memory in the Windows 10 operating system.The experiment uses supervised learning to train the Bayes-optimized XGBOOST algorithm. Based on the data extracted from the aforementioned tests, a sample dataset is established to train the algorithm. In this study, the sets for training, validation, and test are randomly divided at a ratio of 8 : 1 : 1. To evaluate the performance of the algorithm in detail, this study examines its accuracy rate, precision rate, return value, andF1 value.
(13)Precision=TPTP+FP,(14)Accuracy=TP+TNTP+TN+FP+FN,(15)Recall=TPTP+FN,(16)F1=2×precision×recallprecision+recall,where P and N represent “positive” and “negative,” respectively. FP (false positive) represents the number of negative samples that were originally predicted to be positive; TN (true negative) represents the number of negative samples that were originally predicted to be negative; TP (true positive) represents the number of positive samples that were originally predicted to be positive; and FN (false negative) represents the number of positive samples that were originally predicted to be negative. In addition, TP+FP=P′ represents the total amount of samples that were originally predicted to be positive; similarly, FN+TN represents the total amount of samples that were originally predicted to be negative, TP+FN represents the total amount of positive samples, and FP+TN represents the total amount of negative samples.


## 5.1. System Design and Implementation

This system includes two hardware modules: EMG and IMU signal acquisition, which are two software modules of the lower computer STM32 control program and the upper computer PYTHON program. The control chip used in this system is STM8L151F3, the EMG acquisition chip is ADS1292R, and the IMU acquisition chip is BWT901CL, with an intelligent high-integration Bluetooth inertial measurement unit at the sampling frequency of 200 Hz. Interpolation is made to complement the IMU signal sampling frequency.The freedom in the movement of the human lower limbs includes thighs’ flexion and extension, external rotation and internal rotation, abduction and adduction, calves’ flexion and extension, feet’s flexion and extension, and valgus and varus. Biomechanical simulation and experimental studies have shown that the power consumption in the sagittal plane of the human body is higher than in the frontal plane and the horizontal plane [27] so three-dimensional motions of human bodies can be simplified to a relatively simple plane motion. The five-bar model is often adopted to examine the kinematics and dynamics of walking gaits, with the advantage that it is not needed to consider its lateral gait stability in the frontal plane. In the model, the influence of humans’ heads and arms on the movement process is ignored, and the upper body of humans is simplified as a rigid rod. In addition, each leg is simplified as two rigid rods connected by hinge joints perpendicular to the sagittal plane, while the feet are attached to the calves, under an assumption that the model only contacts the ground through the ends of the calf rigid rods during walking. This human lower-limb model is shown in Figure 4.Figure 4
Establishment of the human coordinate system.The coordinate system involved is defined at the heel of the supporting leg. In particular,e0x is parallel to the instep, from the ankle joint to the toe; and e0y is perpendicular to the instep. And this system also determines the positions of human bodies in the plane, but cannot characterize human bodies’ postures. Meanwhile, other local coordinate systems are used to determine human bodies’ postures. The x-axis of all local coordinate systems is perpendicular to the link and points directly in front of the motion. The relative angle between the two adjacent rods is the relative angle of the joint, represented by θ1~θ4: specifically, θ1 indicates the knee joint angle of the supporting leg; θ2 indicates the hip joint angle of the supporting foot; θ3 indicates the knee joint angle of the swing leg, and θ4 indicates the hip joint angle of the swing leg joint angle.In this study, the right leg of the tester is selected for experiments. After tests and comparisons of the leg muscles, the gastrocnemius and rectus femoris are finally selected as the signal source, and the two sets of EMG sensors (with one set including two detection electrode pads and a reference electrode pad) are arranged in corresponding positions. A three-axis accelerometer is fixed on the tester’s biceps femoris to capture and record raw motion data in thex, y, and z axes. The equipment layout is shown in Figure 5.Figure 5
Equipment layout.During the motion control test, the reference time is sent to the IMU and the EMG sensor through a unified host computer. Each instrument attaches a time stamp to the independently collected data according to the calibrated uniform time so that the time of all instruments can be synchronized. The schematic diagram of the system is shown in Figure6.Figure 6
System design and implementation method.


## 5.2. Test Environment

Carried out in the Key Laboratory of Modern Measurement and Control Technology of the Ministry of Education, this research experiment collects human motion data from several subjects without any neuromusculoskeletal abnormalities (age:24±2 years old and age range: 22~26 years old; male/female: 6/4; height: 170~185 cm; and weight: 50~92 kg). There are no significant differences in age, sex ratio, height, and weight among the subjects (P>0.05), all of whom voluntarily participate in this test by signing the informed consent agreements.


## 5.3. Test Plan

Before data collection, to reduce interference, the muscles related to this study are wiped with alcohol to remove the dander on skin surfaces; and the testers are required not to do strenuous exercise within 24 hours. First, their muscles relax naturally and then they do ten sets of gaits, ten actions of squatting, and ten actions of bending and extending of legs in sitting positions. Tester A’s IMU part is selected to collect signals, as shown in Figure7.Figure 7
Acceleration signals.
(a)(b)(c)The raw EMG data of Tester A and the enlarged data graph after processing are shown in Figure8.Figure 8
EMG signals.
(a)(b)(c)An average of 8 or 9 trials (range 8-10) are recorded per subject through initial assessments of data quality, available data collection time, and potential fatigues of participants. The final dataset consists of 95 horizontal walking trials, 85 squatting trials, and 95 sitting leg extension trials.


## 5.4. Design and Verification of the Model

The programming language for data processing in this study is Python 3.6. All calculations are performed on a desktop computer with a graphics processor of GPU GTX 1650 and 8 GB of memory in the Windows 10 operating system.The experiment uses supervised learning to train the Bayes-optimized XGBOOST algorithm. Based on the data extracted from the aforementioned tests, a sample dataset is established to train the algorithm. In this study, the sets for training, validation, and test are randomly divided at a ratio of 8 : 1 : 1. To evaluate the performance of the algorithm in detail, this study examines its accuracy rate, precision rate, return value, andF1 value.
(13)Precision=TPTP+FP,(14)Accuracy=TP+TNTP+TN+FP+FN,(15)Recall=TPTP+FN,(16)F1=2×precision×recallprecision+recall,where P and N represent “positive” and “negative,” respectively. FP (false positive) represents the number of negative samples that were originally predicted to be positive; TN (true negative) represents the number of negative samples that were originally predicted to be negative; TP (true positive) represents the number of positive samples that were originally predicted to be positive; and FN (false negative) represents the number of positive samples that were originally predicted to be negative. In addition, TP+FP=P′ represents the total amount of samples that were originally predicted to be positive; similarly, FN+TN represents the total amount of samples that were originally predicted to be negative, TP+FN represents the total amount of positive samples, and FP+TN represents the total amount of negative samples.


## 6. Results

### 6.1. Results of Intention Recognition for Human Motions in XGBOOST Algorithm

The motion signals of Subject A are randomly selected as a reference. The XGBOOST algorithm is jointly used for IMU and EMG to measure the indicators shown in Table2.Table 2
Indicators for equipment identification and evaluation.
Precision (%)Accuracy (%)Recall (%)F1 score (%)EMG79.2681.5479.2679.26IMU95.6495.8295.6495.64EMG+IMU98.3698.3998.3698.36It can be seen from Table2 that the scores of each indicator identified by EMG alone are not high, but the scores identified by IMU can reach more than 95%. When EMG and IMU are used together to identify the indicators, the evaluation indicators can go up to more than 98%. This proves that the method of EMG signal and the IMU jointly recognizing changes in human bodies’ postures is suitable for this experiment.A random forest and two hidden layers are introduced, and an MLP neural network model with a regularization parameter of 0.1 is compared with the XGBOOST model. To make the experiment go smoothly, the Sklearn library is used to run the MLP and decision tree algorithms. Meanwhile, XGBOOST operates with an XGBOOST package. The EMG signals and IMU integrated signals are inputted into each algorithm, with the accuracy rate, precision rate, return value, andF1 value taken as performance analysis indicators to select the optimal algorithm.As seen in Table3, the indicators of XGBOOST deliver the best scores of the three algorithms in this experiment. The confusion matrix of each algorithm is shown in Table 4, where bt means gaits, dq means squatting, and qs means sitting legs’ flexion and extension.Table 3
Identification and evaluation indicators for various algorithms.
Precision (%)Accuracy (%)Recall (%)F1 score (%)Random forest94.0095.1294.0094.00MLP94.9396.0094.0094.93XGBOOST98.3698.3998.3698.36Table 4
Confusion matrix of various algorithms.
True labelbt127830True labelbt1881110True labelbt11851300dq076212dq13510183dq07513qs035961qs9001439qs050932btdqqsbtdqqsbtdqqsPredicted labelPredicted labelPredicted labelXGBOOSTMLPRandom forestIn the confusion matrix, each column represents a predicted category, the total amount of each column represents the quantity of data predicted to belong to a specific category, and the value in each column represents the quantity of real data predicted to belong to a specific category. On the other hand, each row represents the true attribution category of the data; and the total quantity of data in each row represents the number of data instances for that category. It can be seen from the XGBOOST confusion matrix that it can accurately identify human gaits; however, a small part of squatting movements and sitting legs’ flexion and extension movements are incorrectly predicted, because the changes in these two movements are relatively similar to each other. But the recognition accuracy is significantly higher than random forests and MLP neural network models.The prediction accuracy and robustness of the established model are systematically compared with two comparative machine learning methods under 10-fold cross-validation. Figure9 shows the scoring accuracy curve of the machine learning algorithm model under 10-fold cross-validation, and the results indicate that the average accuracy of the XGBOOST model is greater than that of the other two algorithm models, demonstrating that the recognition performance of the XGBOOST-based model in the training set is better than that of other models.Figure 9
Cross-matrix comparison for each algorithm.


### 6.2. Results of Recognition of Humans’ Motion Intention by Bayesian-Optimized XGBOOST Algorithm

Figure10 compares the accuracy rate of the algorithm after Bayesian optimization for recognition of different gestures with that of the unoptimized algorithm.Figure 10
Comparison of algorithms.It can be seen from the above experiments that the XGBOOST algorithm adopted in this study delivers the highestF1 value, which takes into account the results of the accuracy and return value and can prove that the selected algorithm is more effective. In addition, the selected algorithm has the lowest classification error rate in the confusion matrix, indicating that the XGBOOST algorithm has the best robustness in recognizing different posture changes. The XGBOOST algorithm also has the highest accuracy after Bayesian hyperparameter optimization, with its recognition rate for different actions of a single person reaching 99%. In terms of the accuracy rate, precision rate, return value, F1 value, and confusion matrix, the Bayes-optimized XGBOOST algorithm can be better applied in the recognition of complex motion signals of human lower limbs collected by the combination of single-person EMG sensors and IMU.


### 6.3. Experimental Results for All Subjects

Given individual differences in human beings, individual experiments cannot prove that the selected algorithm and the collection system designed in this study are suitable for a wider population. Therefore, 10 more people with different physical indicators are selected to conduct an experimental test. The data of the qualified subjects are brought into the algorithm to predict the average indicators, as shown in Figure11.Figure 11
Comparison of trials for all subjects.As shown in Figure11, although the combined recognition accuracy of EMG and IMU signals in the XGBOOST algorithm is 87.95%, it is a significant improvement compared with 80.96% for IMU and 74.51% for EMG. However, the accuracy rate of the unoptimized algorithm is less than 90%, and it cannot be well adapted to different individuals, so it cannot satisfy this experiment. After Bayesian-optimized, the accuracy rate of the XGBOOST algorithm reaches 94.42%, much greater than that of the unoptimized algorithm, which is 87.95%. Table 5 showcases the identification and evaluation indicators of various optimization algorithms in multiperson experiments.Table 5
The average accuracy of identification and evaluation of various optimization algorithms in multiperson experiments.
Average precision (%)Average accuracy (%)Average recall (%)AverageF1 score (%)Bayes-random forest87.1288.0087.1287.39Bayes-MLP81.1684.5483.2181.18Bayes-XGBOOST94.4294.3595.6895.33Generalization ability refers to the predictive ability of a model for unknown data. The higher the generalization ability of a model, the stronger its recognition performance for different experimental objects and different posture changes. This ability can be comprehensively evaluated by the accuracy rate, precision rate, return value, andF1 value. As shown in Table 5, for accuracy rate, Bayes-XGBOOST is 13.26% higher than Bayes-MLP and 7.3% higher than Bayes-random forest. For accuracy, Bayes-XGBOOST is 9.81% higher than Bayes-MLP and 6.35% higher than Bayes-random forest. For the return value, Bayes-XGBOOST is 12.47% higher than Bayes-MLP and 8.56% higher than Bayes-random forest. For the F1 value, Bayes-XGBOOST is 14.15% higher than Bayes-MLP and 7.94% higher than Bayes-random forest. These metrics indicate that the Bayes-XGBOOST algorithm has the best generalization ability, which can deal with changes brought by individual differences and achieve the expected effect.


### 6.4. Comparison with Other Experimental Results

Table6 shows the results obtained from comparison with other research. For a fair comparison, researchers that can meet two requirements are selected: they used EMG and IMU fusion signal recognition, and they collected motion signals under similar experimental conditions.Table 6
Comparative analysis with other algorithms.
ProposalAverage precisionAverage recallAverageF1 scoreBangaru et al. [28]93.68%95.00%94.00%Su et al. [29]92.33%90.17%90.50%Wang et al. [30]86.07%——Hao et al. [31]94.32%——Ours94.42%95.68%95.33%Bangaru proposed an ANN-based method for automatic recognition of construction workers’ activities, which shows the ability to identify several scaffold activities at a weighted accuracy of 0.94, compared to the precision of 94.42% in this study. Wang et al. and Hao et al. only provided a single result, so a comparison with them is not clear. As shown in Table3, the method proposed by this study achieves higher accuracy than other methods, and the recall rate and precision of this method are also higher, demonstrating that the method of this study is more capable of human motion intents’ detection.


## 6.1. Results of Intention Recognition for Human Motions in XGBOOST Algorithm

The motion signals of Subject A are randomly selected as a reference. The XGBOOST algorithm is jointly used for IMU and EMG to measure the indicators shown in Table2.Table 2
Indicators for equipment identification and evaluation.
Precision (%)Accuracy (%)Recall (%)F1 score (%)EMG79.2681.5479.2679.26IMU95.6495.8295.6495.64EMG+IMU98.3698.3998.3698.36It can be seen from Table2 that the scores of each indicator identified by EMG alone are not high, but the scores identified by IMU can reach more than 95%. When EMG and IMU are used together to identify the indicators, the evaluation indicators can go up to more than 98%. This proves that the method of EMG signal and the IMU jointly recognizing changes in human bodies’ postures is suitable for this experiment.A random forest and two hidden layers are introduced, and an MLP neural network model with a regularization parameter of 0.1 is compared with the XGBOOST model. To make the experiment go smoothly, the Sklearn library is used to run the MLP and decision tree algorithms. Meanwhile, XGBOOST operates with an XGBOOST package. The EMG signals and IMU integrated signals are inputted into each algorithm, with the accuracy rate, precision rate, return value, andF1 value taken as performance analysis indicators to select the optimal algorithm.As seen in Table3, the indicators of XGBOOST deliver the best scores of the three algorithms in this experiment. The confusion matrix of each algorithm is shown in Table 4, where bt means gaits, dq means squatting, and qs means sitting legs’ flexion and extension.Table 3
Identification and evaluation indicators for various algorithms.
Precision (%)Accuracy (%)Recall (%)F1 score (%)Random forest94.0095.1294.0094.00MLP94.9396.0094.0094.93XGBOOST98.3698.3998.3698.36Table 4
Confusion matrix of various algorithms.
True labelbt127830True labelbt1881110True labelbt11851300dq076212dq13510183dq07513qs035961qs9001439qs050932btdqqsbtdqqsbtdqqsPredicted labelPredicted labelPredicted labelXGBOOSTMLPRandom forestIn the confusion matrix, each column represents a predicted category, the total amount of each column represents the quantity of data predicted to belong to a specific category, and the value in each column represents the quantity of real data predicted to belong to a specific category. On the other hand, each row represents the true attribution category of the data; and the total quantity of data in each row represents the number of data instances for that category. It can be seen from the XGBOOST confusion matrix that it can accurately identify human gaits; however, a small part of squatting movements and sitting legs’ flexion and extension movements are incorrectly predicted, because the changes in these two movements are relatively similar to each other. But the recognition accuracy is significantly higher than random forests and MLP neural network models.The prediction accuracy and robustness of the established model are systematically compared with two comparative machine learning methods under 10-fold cross-validation. Figure9 shows the scoring accuracy curve of the machine learning algorithm model under 10-fold cross-validation, and the results indicate that the average accuracy of the XGBOOST model is greater than that of the other two algorithm models, demonstrating that the recognition performance of the XGBOOST-based model in the training set is better than that of other models.Figure 9
Cross-matrix comparison for each algorithm.


## 6.2. Results of Recognition of Humans’ Motion Intention by Bayesian-Optimized XGBOOST Algorithm

Figure10 compares the accuracy rate of the algorithm after Bayesian optimization for recognition of different gestures with that of the unoptimized algorithm.Figure 10
Comparison of algorithms.It can be seen from the above experiments that the XGBOOST algorithm adopted in this study delivers the highestF1 value, which takes into account the results of the accuracy and return value and can prove that the selected algorithm is more effective. In addition, the selected algorithm has the lowest classification error rate in the confusion matrix, indicating that the XGBOOST algorithm has the best robustness in recognizing different posture changes. The XGBOOST algorithm also has the highest accuracy after Bayesian hyperparameter optimization, with its recognition rate for different actions of a single person reaching 99%. In terms of the accuracy rate, precision rate, return value, F1 value, and confusion matrix, the Bayes-optimized XGBOOST algorithm can be better applied in the recognition of complex motion signals of human lower limbs collected by the combination of single-person EMG sensors and IMU.


## 6.3. Experimental Results for All Subjects

Given individual differences in human beings, individual experiments cannot prove that the selected algorithm and the collection system designed in this study are suitable for a wider population. Therefore, 10 more people with different physical indicators are selected to conduct an experimental test. The data of the qualified subjects are brought into the algorithm to predict the average indicators, as shown in Figure11.Figure 11
Comparison of trials for all subjects.As shown in Figure11, although the combined recognition accuracy of EMG and IMU signals in the XGBOOST algorithm is 87.95%, it is a significant improvement compared with 80.96% for IMU and 74.51% for EMG. However, the accuracy rate of the unoptimized algorithm is less than 90%, and it cannot be well adapted to different individuals, so it cannot satisfy this experiment. After Bayesian-optimized, the accuracy rate of the XGBOOST algorithm reaches 94.42%, much greater than that of the unoptimized algorithm, which is 87.95%. Table 5 showcases the identification and evaluation indicators of various optimization algorithms in multiperson experiments.Table 5
The average accuracy of identification and evaluation of various optimization algorithms in multiperson experiments.
Average precision (%)Average accuracy (%)Average recall (%)AverageF1 score (%)Bayes-random forest87.1288.0087.1287.39Bayes-MLP81.1684.5483.2181.18Bayes-XGBOOST94.4294.3595.6895.33Generalization ability refers to the predictive ability of a model for unknown data. The higher the generalization ability of a model, the stronger its recognition performance for different experimental objects and different posture changes. This ability can be comprehensively evaluated by the accuracy rate, precision rate, return value, andF1 value. As shown in Table 5, for accuracy rate, Bayes-XGBOOST is 13.26% higher than Bayes-MLP and 7.3% higher than Bayes-random forest. For accuracy, Bayes-XGBOOST is 9.81% higher than Bayes-MLP and 6.35% higher than Bayes-random forest. For the return value, Bayes-XGBOOST is 12.47% higher than Bayes-MLP and 8.56% higher than Bayes-random forest. For the F1 value, Bayes-XGBOOST is 14.15% higher than Bayes-MLP and 7.94% higher than Bayes-random forest. These metrics indicate that the Bayes-XGBOOST algorithm has the best generalization ability, which can deal with changes brought by individual differences and achieve the expected effect.


## 6.4. Comparison with Other Experimental Results

Table6 shows the results obtained from comparison with other research. For a fair comparison, researchers that can meet two requirements are selected: they used EMG and IMU fusion signal recognition, and they collected motion signals under similar experimental conditions.Table 6
Comparative analysis with other algorithms.
ProposalAverage precisionAverage recallAverageF1 scoreBangaru et al. [28]93.68%95.00%94.00%Su et al. [29]92.33%90.17%90.50%Wang et al. [30]86.07%——Hao et al. [31]94.32%——Ours94.42%95.68%95.33%Bangaru proposed an ANN-based method for automatic recognition of construction workers’ activities, which shows the ability to identify several scaffold activities at a weighted accuracy of 0.94, compared to the precision of 94.42% in this study. Wang et al. and Hao et al. only provided a single result, so a comparison with them is not clear. As shown in Table3, the method proposed by this study achieves higher accuracy than other methods, and the recall rate and precision of this method are also higher, demonstrating that the method of this study is more capable of human motion intents’ detection.


## 7. Discussion

This study is aimed at boosting the recognition rate for the lower limbs’ motion patterns while identifying the impact of different sensors on classification accuracy and generalization. Analyses of the model demonstrate that, due to complex human body postures, the multimodal motion recognition that relies only on a single signal, such as IMU or EMG, would deliver a high misjudgment rate; especially, the EMG is in extreme ambiguity. The recognition of human motion intentions is very controversial, so it is an effective way to recognize human motion intention by integrating multisource signals.The daily movements of the lower limbs of the human body are very complex [5, 6]. In this study, three behaviors with the highest frequency in rehabilitation therapy are selected for experiments. However, other lower-limb movements need to be further verified. In addition, for the sake of safety, the experiments in this study are completed with healthy people. Whether the experimental results so obtained are still applicable to patients with motor impairments requires further experimental verification.This study can be further extended to such cases as lower extremity postoperative rehabilitation, prosthetic intent recognition, clinical human health monitoring, and gait-based human detection. As a future research direction, the fusion between EMG and IMU signals in recognition of human motion intents is an economical, reliable, and sustainable solution. This recognition is of great significance for analyzing human gait laws, repairing motion abnormalities, diagnosing kinematic diseases, and improving human-centered rehabilitation equipment and prosthetics. Although this study puts forward only a preliminary model, the results obtained are encouraging.


## 8. Conclusions

To improve the recognition rate for humans’ lower extremity motion, this study designs a pattern recognition method for such motions by integrating EMG signals and IMU signals, while using a Bayes-optimized XGBOOST algorithm to recognize human motion intentions. The experimental results based on the changes in human body postures demonstrate that the method proposed in this study can realize the measurement of the equipment attached to the lower limbs and effectively identify changes in human body postures. In the multiperson experiment, the average accuracy of recognition of different gestures reaches 94.42%, the averageF1 value reaches 95.33%, and the average return value reaches 95.68% proving the generalization ability of the model would not be affected by individual differences among human bodies.



---

*Source: 3015645-2022-09-01.xml*