1 Introduction

Lower limb exoskeleton robot is the human–robot collaborative intelligent system that can enhance the flexibility of human lower limbs by wearing external devices on limbs (Ma and Liao 2017; Choi et al. 2022; Jung et al. 2015; Ma et al. 2019). They have significant applications in the fields of rehabilitation assistance, load-bearing assistance, and exercise enhancement (Ma et al. 2019; Lee et al. 2021; Asokan and Vigneshwar 209). With the development of the technology of the assistant exoskeleton, it has taken many advantages to human life. As an integrated human–machine system, exoskeletons need to timely perceive the motion status of both humans and machines, as well as identify the intentions of human motion to achieve human–machine coordination. Human–machine interaction is crucial for improving the comfort and safety of wearing the exoskeleton. To ensure flexible human–machine interaction, lower limb exoskeletons are expected to perform motion-switching control based on the wearer’s motion state (Tanghe et al. 2020; Taborri et al. 2016; Vu et al. 2020). Therefore, accurate gait detection is essential for controlling exoskeleton robots as it synchronizes the assistive force of wearable robots with user movements. The sensor system, which is the basis of gait feature measurement, can be classified into non-wearable and wearable sensors. Opto-electronic system, as the standard in gait analysis, has high precision and reliability in classification results (Taborri et al. 2016; Vu et al. 2020). However, it can only be conducted indoors due to its spatial constraints. Similarly, force measurement platforms and ultrasonic sensors are limited for the same reason. Wearable sensors, such as electromyogram (EMG) sensors (Asokan and Vigneshwar 209; Tanghe et al. 2020; Zhou et al. 2021), inertia measurement units (IMU) (Bijalwan et al. 2021; Lou et al. 2019; Bruinsma and Carloni 2021), and plantar pressure sensors, have been widely applied to measure gait features. By fusing the EMG data with two types of data from inertial measurement, Liu et al. (2021) enhanced a muscle synergy-inspired method of locomotion mode identification. IMUs were used to achieve pattern identification of different human joints and joint angle prediction (Semwal et al. 2022; Sung et al. 2021). IMUs and foot gait analysis system were combined for recognizing human movement gait phase (Song et al. 2022). However, EMG-based system is complex in data acquisition and processing steps (Ding et al. 2018). The IMUs indirectly identify gait phases based on characteristic points of periodic inertial signals. Additionally, subjects may feel uncomfortable during the gait collection due to the lengthy setup time and burdensome of the sensor system. As the most widely used information, plantar pressure can directly obtain certain physiological information of the human body to analyze the gait status. Attal et al. (2018)used a pair of pressure sensor arrays worn in shoes to extract important gait parameters like pressure profile, number of steps, etc. Zhang et al. (2022) used the plantar pressure signal measured by a pressure sensor array for human balance evaluation. Furthermore, when lower limb lesions occur, the distribution of plantar pressure will undergo corresponding changes. Therefore, the plantar pressure that reflects certain physiological or pathological information of the human body holds significant scientific and practical value in the lower limb exoskeleton. In addition, wearable intelligent insoles can monitor changes in walking speed during various activities, enhancing individual comfort and improving the safety of exoskeleton robot assistance. The human gait measurement system requires the gait phase detection algorithm to provide stable and smooth locomotion. Recently, some techniques based on machine learning algorithms have been adopted for gait detection (Semwal et al. 2023). In Attal et al. (2018), an unsupervised classification method called multiple regression hidden markov model (MRHMM) for six gait phases detection is proposed without any prior knowledge. Integrated sparse autoencoder (SAE), bidirectional long short-term memory (BiLSTM), and deep neural network in Zhang et al. (2022), the SBLSTM model is built to identify four phases during normal walking. Lee et al. (2021) adopted the long short-term memory (LSTM) method and used two IMUs and heel FSR sensors for continuous gait phase estimation. The experimental results showed that the method had good performance in gait phase classification. However, it could only identify two phases and failed to achieve precise control under more conditions. As an efficient classifier, supporting vector machine is expected to have advantages over existing learning algorithms such as multi-layer perceptron, nearest neighbor, and neural network. In Zeng et al. (2021), the SVM and BP neural networks are combined to achieve high accuracy in gait phase detection. The above recognition algorithms achieve a good experimental result under the normal walking state. However, they overlooked the impact of the walking speed and external environmental factors, which could potentially reduce the stability and generalization capability of gait phase recognition.

To deal with the above issues, a lightweight, durable, wireless, and soft material-based smart insole is designed for an accurate and cost-effective gait analysis system. Additionally, this paper develops a novel radius-margin-based SVM model with the particle swarm optimization(PSO) called PSO-FSVM for gait phase recognition under different conditions. Smart insole based on flexible and elastic sensors is designed to measure and analyze human gait features. The FSVM method is utilized to enhance the accuracy of the SVM by maximizing margin information and minimizing radius information in feature transformation space. Considering that gait phase detection is a nonlinear problem, and the input of the gait detection model is multi-dimensional, the kernel principle component analysis is incorporated, and the gait data is mapped to a new feature space. The PSO algorithm is adopted to optimize the parameters c and \(\gamma\) in FSVM model. Using the flexible sensor system, gait phase detection experiments were conducted indoors and outdoors, and the proposed method was validated. The experimental results were compared with other methods to prove the accuracy and effectiveness of this approach.

2 Wearable gait acquision system

2.1 Division of human gait phase

Walking is the most basic form of human movement and gait is a characteristic of human behavior. Human walking is a process of repeated movement of both feet. A gait cycle during walking is usually defined as the process from one heel touching the ground to the other heel touching the ground again. Typically, a gait cycle is divided into different stages. According to the support of the foot to the human body, a gait cycle can be divided into the support phase and the swing phase. The gait analysis shows that the stance phase always contacts the ground during walking, accounting for about 60% of the gait cycle, and the swing phase accounts for about 40% Kang et al. (2020). Through biomechanical analysis and actual detection of human lower limbs, the gait cycle is divided into five phases (take the right foot as an example) as shown in Fig. 1.

Fig. 1
figure 1

Five gait phases division

  1. 1.

    Loading response (phase 1): the period begins from the right foot contacts the ground and ends when the left toe is off the ground.

  2. 2.

    Mid-stance (phase 2): the period begins from the left foot leaves the ground, and the right leg enters the single-leg support stage and ends when the right heel is off the ground.

  3. 3.

    Terminal stance (phase 3): the period begins from the end of the right mid-stance and ends when the left foot contacts the ground.

  4. 4.

    Pre-swing (phase 4): the period begins from the left foot contacts the ground and ends when the right toe is off the ground.

  5. 5.

    Swing (phase 5): the period begins from the right foot leaves the ground and ends when the right heel contacts the ground again.

2.2 Wearable smart flexible insoles

The sensing system designed in this paper is the plantar pressure insole based on flexible elastic sensors. The plantar pressure sensing system, as shown in Fig. 2, consists of a plantar pressure detection module, a microcontroller control module, a signal processing and conversion module, a communication module, and an upper computer module. The overall plantar pressure sensing system is controlled by the STM32F103C8T6 microprocessor. The specific working process involves using flexible and elastic pressure sensors to perceive the interaction force between human feet and the ground during different walking states. Then, the measured capacitance signal is processed and sent to the control module. Subsequently, the signal is transmitted to the upper computer through the communication module for real-time display and storage of pressure data. Finally, the collected data is further analyzed to determine the different gait states of the human body.

Fig. 2
figure 2

System block diagram

2.2.1 Flexible elastic pressure insole and its structural distribution

The flexible sensor is the capacitive sensor based on a sandwich structure, as shown in Table 1. Flexible capacitive pressure sensors detect pressure by changing the capacitance value after applying pressure and exhibit high sensitivity in detecting small pressures. The existing research (Cho et al. 2021) showed that the peak of plantar pressure of normal people in a static standing state mainly occurs in the metatarsal region. During gait analysis, the state of foot-ground contact in each gait phase will affect the position of the peak pressure which determines the range of the pressure sensor.

By analyzing the relationship between plantar pressure and gait phases, this study designed a plantar pressure measurement module consisting of nine elastic pressure sensors. The distribution of these pressure sensors is illustrated in Fig. 3. During human walking, the interaction between the foot and the ground is perceived by the flexible and elastic pressure sensors.

Table 1 Specifications of elastic sensor
Fig. 3
figure 3

Development of a pressure sensor-based insole system. (a): distribution of nine flexible and elastic sensors; (b): plantar pressure acquisition by a measurement unit

2.3 Gait data collection

2.3.1 Training dataset

To obtain the training dataset, we conducted a series of tasks under different conditions. The gait cycle data of three subjects with 165 ± 5 cm height and an age range of 24±3 years is divided into three groups of samples. The experimental data of each participant was a group of samples, and each group included the gait phase data of the left and right feet. As shown in Fig. 4, participants wore plantar pressure insoles, and the data acquisition circuit and power supply were fixed at the ankle.

Fig. 4
figure 4

Wearing diagram of the pressure measurement system

Task 1: The three participants first adapted to the treadmill indoors by walking at a low speed for two minutes, then walked for three minutes at a speed of 2.5 km/h. To prevent the influence of fatigue, participants rested for three minutes. All participants walked at the same speed on the treadmill, with walking speeds of 3.0 km/h, 3.5 km/h and 4.0 km/h, respectively. To minimize external interference, participants repeated the experiment five times at each speed, and the datasets of three trials for each subject are used for training while the other two are used for testing.

Fig. 5
figure 5

Pressure of right insole on the treadmill (3.0km/h)

Taking the gait curve of the right foot of subject 1 as an example. Figure 5 shows the ground reaction force on the treadmill with the speed of 3.0 km/h. it can be observed that the plantar pressure exhibits periodic variation when the human body walks on the treadmill at 3.0 km/h. According to Cho et al. (2021), the plantar region can be mainly divided into four areas: the toe region, the metatarsal region, the arch region, and the heel region. As shown in Fig. 5, it indicates that the changes in pressure during human walking mainly come from the toe, metatarsal, and heel regions.

Task 2: Three participants wore gait pressure sensors and walked at slow, moderate, fast, and variable speeds on the flat outdoor surface. Before the experiment, each subject was instructed to perform ten trials of walking at their most comfortable speed. The average speed from these ten trials was calculated and recorded as the moderate speed. The subject’s slow walking speed is defined as half of their moderate walking speed, and the fast walking speed is defined as the subject walking at a constant speed of 1.2 times their moderate speed. After experimental testing, the moderate speed of the three subjects is 3.98 km/h, 4.45 km/h, and 4.8 km/h, respectively. Each participant walked for two minutes and then rested for two minutes. Each participant repeated these four conditions five times. The datasets of three trials for each subject are used for training while the other two are used for testing.

Fig. 6
figure 6

Pressure of right insole in the outdoor (slow)

Fig. 7
figure 7

Pressure of right insole in the outdoor (variable)

The designed pressure-sensing insoles exhibit significant distinctions under different load weights. Additionally, Figs. 6 and  7 also show the sensing information from subject 2 while walking outdoors. It can be seen that under variable walking speed, the pressure on the soles of the human foot significantly increases. Moreover, the number of gait cycles under slow walking conditions is less than that under variable speed walking conditions. The gait pressure of the human body exhibits a stable cyclic variation at slow walking speed, and the plantar pressure in different regions shows a consistent changing trend compared to a variable speed walking state. The pressure in different regions varies, with peak values sometimes exceeding 200 N and at other times dropping below 120 N. However, when participants walk slowly, the peak pressure under the heel is less than 160 N.

Overall, the data in the gait regions exhibit periodic variations, and the pressure in different areas demonstrates a "quasi-pulse" pattern of the foot postures, showing a smooth process from entering to leaving the ground contact state. This indicates that a person’s walking gait is relatively stable. From the pressure levels in each region, it can be observed that the pressure in the heel region is greater than that in the metatarsal region while the pressure in the metatarsal region outweights the forefoot region’s. In addition, the pressure in the forefoot region is larger than that in the arch region. Due to the arched structure of the foot, some regions do not make direct contact with the ground, resulting in the smallest pressure in the arch region. The pressure distribution between different regions in both cases indicates the adaptability of the human body to different environments.

2.3.2 Signal processing and feature extraction

The gait phase recognition process is illustrated in Fig. 8. The data is processed by extracting the required data from the datasets and dropping unnecessary columns. To smooth the signal, the moving average filter (MAF) is applied. The plantar pressure data includes pressure information from nine sensors located in the toes, metatarsals, arch, and soles of both left and right feet. To minimize the influence between different sensors, the plantar region is divided into four areas: the toe area, the metatarsal area, the arch area, and the heel area. Aggregate the data from different regions to obtain pressure information for each region, and use MAF to filter the pressure data of both feet. To reduce the impact of outliers and noise in sensor data during the walking process, normalization is applied to simplify the complexity of the data. Additionally, it can ensure that the data is within a consistent scale, which is beneficial to multiple gait phase recognition. Time-domain based approach for feature extraction from plantar pressure data is adopted to characterize the subject’s gait pattern. The sliding window is set to 100ms and the standard deviation and mean of the four regions for both left and right feet within the sliding window, as well as the sum of plantar pressure, are calculated as inputs to the model. These extracted features reveal information in the pressure data.

Fig. 8
figure 8

System chart of gait phase recognition

3 Human gait detection and recognition algorithm

3.1 Principle analysis of SVM and optimization with PSO

With the appropriate selection of feature vectors and data dimensions, SVM can find a decision boundary as wide as possible. However, in this work, the input dataset of GRF is highly nonlinear. The basic idea is to map data from input space into a high-dimensional feature space through nonlinear mapping to avoid the curse of dimension and maximize the separation between classes. Given a set of data \(data={(x_{1},y_{1}),(x_{2},y_{2}),..(x_{m},y_{m})}\), with \(x_{i} \in R^m\) and \(y_{i} \in {(-1,1)}\), the SVM will construct a boundary that can be formulated as

$$\begin{aligned} f(x) = {\varvec{\omega }^T}x + b = 0 \end{aligned}$$
(1)

By introducing the slack variable \({\xi _i} = ({\xi _1},{\xi _2},{\xi _3},...,{\xi _m})\), the basic SVM model can be formulated as

$$\begin{aligned} \begin{array}{c} \mathop {\min }\limits _{\omega ,b,\xi } \frac{1}{2}{\varvec{\omega }^T}\varvec{\omega }+ C\sum \limits _{i = 1}^m {{\xi _i}} \\ s.t.{y_i}[{\varvec{\omega }^T} \cdot \Phi ({x_i}) + b] \ge 1 - {\xi _i} \\ {\xi _i} \ge 0 \end{array} \end{aligned}$$
(2)

Gaussian radial basis function (RBF) is chosen to deal with the nonlinear problem. The function can be expressed as

$$\begin{aligned} K({x_i},{x_j}) = \exp ( - \gamma (\parallel {x_i} - {x_j}{\parallel ^2})) \end{aligned}$$
(3)

where \(\varvec{\omega }\) is the weight and b is the bias, respectively, C is a penalty parameter, and m denotes the number of slack variables, \(\Phi ({x_i})\)represents the high-dimensional feature spaces, \(\gamma\) is defined to control RBF kernel width. So as to obtain satisfactory results, setting parameters C and \(\gamma\) mentioned above is essential.

3.2 Human gait recognition model based on PSO-FSVM

Although the model in (2) takes into consideration the maximization of the margin, it ignores the radius which has an impact on the generalization error bounds of SVM. Besides, the feature dimension of the input SVM is multi-dimensional, which will increase the cost of computing time and reduce the system in real-time. Considering the radius error of feature space, Wu et al. (2018) proposed a new radius-margin-based SVM model aiming to jointly learn SVM together with the feature transformation by minimizing the radius-margin ratio, called FSVM. With the approximation formula of feature space, a linear transformation matrix A and the radius information were introduced. The radius R is bounded by \({{{{\bar{R}}}}}\), i.e., \(\frac{1}{2}{{{\bar{R}}}} \le {{R}} \le {{{\bar{R}}}}\), \({{{{\bar{R}}}}}\) represents the largest Euclidean distance between the training sets and the mean vector in the transformation space, i.e., \({\bar{R}} = {\max _i}\parallel A{x_i} - A{\bar{x}}{\parallel _2}^2\). Let the matrix \(\textit{M} = {\textit{A}^T}{} \textit{A}\). Instead of featuring weighting, FSVM can simultaneously learn the feature transformation and classifier. The plantar pressure data collected in this study is nonlinear and indivisible. It is known that kernel SVM can be utilized to handle the nonlinear classification problem. Inspired by the characteristic of kernel SVM, kernel principal component analysis was adopted and the kernel FSVM was proposed, which maps linear FSVM into the kernel PCA space (Wu et al. 2018). The feature selection model in multidimensional kernel principal component analysis can be expressed as follows

$$\begin{aligned} \begin{array}{c} \min \limits _{\varvec{\omega },b,\xi ,M} \dfrac{1}{2} \varvec{\omega }^T M^{-1} \varvec{\omega }+ C \sum \limits _{i = 1}^n {{\xi _i} +\rho tr(MS_k) } \\ s.t.y_i\left[ \varvec{\omega }^T \cdot \varvec{\ }\varvec{k_i} +b \right] \ge 1- \xi _i,i=1,2, \ldots ,N \\ \xi _i \ge 0, \forall {i} \\ M \succ 0 \end{array} \end{aligned}$$
(4)

where \({\varvec{W}}^T = [{\omega _1},{\omega _2},...,{\omega _{D0}}]\) represents the eigenvalues of dimensional eigenvectors, \({\xi _i}\) is the slack variable, \({S_k} = \sum \nolimits _{i = 1}^n {{\varvec{\omega }_i}k{k_i}^T}\), \({k_i} = {{\varvec{W}}^T}\Phi ({x_i})\). It is noted that the solution efficiency and accuracy of the SVM model not only depend on general error bounds but also are affected by the parameter settings. PSO is used to deal with complex multimodal problems and Marini and Walczak (2015) showed that PSO has attained good performance in parameter optimization, such as easy convergence, simple structure, and good fitness. Considering both general error bounds and parameter optimization, we adopt the PSO algorithm to optimize parameters C and \(\gamma\) of the FSVM classifier. The PSO algorithm with the updating process of particle speed and position is formulated as follows

$$\begin{aligned} V_{iD}^k & = \varepsilon V_{iD}^{k - 1} + {c_1}{r_1}(P_{iD}^{k - 1} - X_{iD}^{k - 1}) + {c_2}{r_2}(P_{gD}^{k - 1} - X_{gD}^{k - 1}) \end{aligned}$$
(5)
$$\begin{aligned} X_{iD}^k &= X_{iD}^{k - 1} + V_{iD}^k \end{aligned}$$
(6)

where \(\varepsilon\) is the inertial weight, \({c_1}\) and \({c_2}\) is the acceleration constant, k is the number of iterations, X is the particle position, \({r_1}\) and \({r_2}\) are randomly selected in the [0,1] interval. After optimization of parameters, we obtained the SVM classifier, the formula (4) can be reformulated as

$$\begin{aligned} \begin{array}{c} \mathop {\min }\limits _M f(M) = \frac{1}{2}({\varvec{\omega }^T}{M^{ - 1}}\varvec{\omega }) + \rho tr(MS_k) \\ s.t.M \succ 0 \end{array} \end{aligned}$$
(7)

Since the formula is convex and differentiable regarding \(M \succ 0\), the gradient-projection method is employed to update M.

$$\begin{aligned} f(M) = - \frac{1}{2}({M^{ - 1}}\varvec{\omega }{\varvec{\omega }^T}{M^{ - 1}}) + \rho S \end{aligned}$$
(8)

Computing the gradient of \({M_\xi }\) with the formula (9), then \({M_{\xi + 1}}\) can be defined as

$$\begin{aligned} \ {M_{\xi + 1}} = {\rho _{s + }}({M_\xi } - {t_\xi }\nabla f({M_\xi }))\ \end{aligned}$$
(9)

The flowchart of the PSO-FSVM algorithm is shown in Fig. 9. The proposed method combines FSVM and PSO, which mainly includes the following steps. Firstly, divide the dataset for training and testing, and put the training set into the feature space by introducing a transformation matrix and integrating the radius information. Secondly, the PSO algorithm is adopted to find the optimal parameters C and \(\gamma\) in the feature space. Finally, by testing the dataset during external evaluation, the performance of the gait phase classifier is measured.

Fig. 9
figure 9

Flowchart of PSO-FSVM for Gait phases classification

4 Gait analysis experiments

The gait sensor system consists of smart insoles for the left and right feet. The sampling frequency of the smart insole system is 50 Hz. The Bluetooth communication protocol is used for ground reaction force data collection with up to 10 m communication distance. Using the designed system, we collected the pressure signals of humans walking under different conditions. Before conducting the experiment, the sensor insoles are initially placed stationary inside the shoe to measure the baseline pressure information. The actual pressure exerted by the human body is then determined by calculating the difference between the acquired pressure data and the baseline pressure information. In this study, we collected training and testing datasets from Task 1 and Task 2.

4.1 Indoor experiments

Using the dataset from Task 1 as the training and testing dataset, we tested the performance of PSO-FSVM in gait phase recognition. The results indicate that the algorithm detected their gait phases. Firstly, we analyze the performance of gait data at 3.5 km/h speed on the standard SVM classifier and the proposed classifier. As portrayed in Fig. 10, it manifests that although the predicted value matches the real value in phase 5, there are still large errors in the other four gait phases. As a consequence, only 93.78% accuracy of gait phase recognition can be achieved with the SVM-only classifier. Figure 11 showed that the recognition result using the proposed method matched well with the manually labeled reference phases, especially in the swing phase. Overall, it can be found that the proposed method outperforms the SVM-only method.

Fig. 10
figure 10

Estimated phases obtained with SVM (Speed 3.5km/h)

Fig. 11
figure 11

Estimated phases obtained with PSO-FSVM (Speed 3.5km/h)

The error of each gait phase at 3.5 km/h is depicted in Fig. 12. The results demonstrate that phase 5 can be detected by the proposed method with no detection error on subject 3, and the error rate of phase 4 is higher than other gait phases in most cases. The recognition errors for phase 1 of the three participants are all below 2%. Among them, the recognition error rate for phase 3 is approximately 4%, indicating that apart from gait phase 4, it is more challenging for gait phase 3 to be identified compared to other gait phases. Additionally, phases 1 and phase 5 have relatively low recognition error rates using the proposed method.

Fig. 12
figure 12

Error rate of PSO-FSVM at 3.5 km/h

Considering the influence of different speeds in human movement, the proposed method is used to detect gait phases at a speed varying from 2.5 km/h to 4.0 km/h. Datasets are from task 1. The recognition accuracy with five-fold cross-validation is illustrated in Fig. 13. The average recognition accuracy at the speed of 2.5 km/h for the gait phase reaches 99.13%, which surpasses the average recognition accuracy at other speeds. Therefore, it can be concluded that the recognition accuracy decreases with the increase of speed. Furthermore, the experiment results show that the accuracy of the ten tests is all above 96% at four speeds, which proves that the proposed method has a good performance of gait phase detection at different speeds.

Fig. 13
figure 13

Average accuracy of PSO-FSVM under different speeds

Fig. 14
figure 14

Average accuracy of four classifiers under different speeds

Fig. 15
figure 15

The recognition efficiency of the four algorithms

Figure 14 and Table 2 compare the accuracy of gait phases detected by the proposed method and other variants of SVM at speeds ranging from 2.5 to 4.0 km/h. The results show that the proposed method achieves the best performance in the testing dataset. As can be observed from Fig. 14, the recognition performance of the four classifiers can be ranked from the highest to the lowest as follows: PSO-FSVM, FSVM, PSO-SVM, and SVM. In Table 2, by adopting the particle swarm optimization algorithm, the accuracy improves by 1.28% and attains 96.90% at 3 km/h. The average recognition accuracy of FSVM at four speeds fluctuated between 97% and 98%. The proposed method has a superlative performance with an average accuracy of 99.13% at 2.5 km/h and achieves 98.01% at the speed of 4 km/h. To further appraise the performance of our phase segmentation model, the computational efficiency of the proposed algorithm and other classification methods is also compared in Fig. 15. Through the comparison results, it can be found that the average classification time for a single gait cycle of the four algorithms is less than 2ms. Moreover, the algorithm proposed in this article outperforms the other three algorithms in both response time and recognition accuracy. In summary, the PSO-FSVM method has been validated to be accurate and stable for gait phase recognition.

Table 2 Average accuracy performance (%)

4.2 Outdoor experiments

Considering that the outdoor environment can be affected by factors such as stride frequency, speed, weather, and road conditions, we conducted a series of experiments outdoors to verify the effectiveness of the proposed method for gait phase classification. Several different classifiers were trained on the dataset from task 2 and their average classification accuracies were compared.

Fig. 16
figure 16

Average recognition accuracy of four classifiers(under different speeds)

The proposed method is compared with the other four algorithms to validate the effectiveness of gait phase detection. It is evident that the classification performance of the proposed algorithm outperforms SVM, k-nearest neighbor (KNN), adaptive boosting (AdaBoost), and quadratic discriminant analysis (QDA) algorithms. The proposed algorithm shows high average recognition accuracy for different walking states in outdoor circumstance. The average recognition accuracy of four classifiers under different speeds can be seen in Fig. 16. Different conditions can have a destabilizing effect on algorithms such as KNN. The average accuracy of KNN is 93.76% under slow speed conditions, and the accuracy under moderate speed is 92%. In contrast to the stable environment of the treadmill, participants are influenced by the surroundings in outdoor experiments. Accuracy decreases with increasing speed. The accuracy under variable conditions is lower than that in fixed speed. The average recognition accuracy of gait phases for the KNN, Adaboost, and QDA algorithms is below 95%, while the proposed method achieves an average recognition accuracy of over 98% in slow walking conditions and can still reach 96% with variable speed. Overall, the proposed method achieves an average accuracy exceeding 96% across all four scenarios.

Fig. 17
figure 17

Average Error Rate of Five Gait phases: a slow, b moderate, c fast, d (variable)

Table 3 Average accuracy performance (%)

From Fig. 17 and Table 3, it can be observed that under the variable speed walking and fast walking conditions, the average recognition error rates for the five gait phases are significantly higher compared to the other walking conditions. On the contrary, the gait phase recognition error rate of the proposed method is minimal under slow walking conditions. Additionally, the recognition error rate for the swing phase is the lowest among the five gait phases and the error rate of the proposed method is less than 1.1%. The proposed method can achieve accurate identification of the swing phase in outdoor scenarios. Compared to the other algorithms, the proposed method showed the best performance in gait phase detection in outdoor experiments. The average error rate for gait phase recognition is less than 3.5% with slow walking and moderate walking speeds. In the cases of variable speed and fast walking conditions, the overall average error rate for gait phase recognition is less than 4.5%, verifying the effectiveness of the proposed method.

5 Discussion

The gait phase detection by PSO-FSVM showed the best performance in the estimation. When SVM-only is adopted for gait detection at four speeds, the error rate is noticeably higher. In addition, as the speed improves, the detection accuracy of the gait phase decreases, which reflects the limitations of this algorithm under more conditions. The outdoor concrete and the indoor treadmill were used as the test platform to collect and preprocess the multi-task gait data. The experimental results show that the gait detection equipment based on flexible elastic sensing technology can effectively collect and display plantar pressure signals in real-time. Furthermore, the PSO-FSVM model proposed can achieve an average recognition accuracy of 99.13% for gait data at the speed of 2.5 km/h. The average recognition accuracy of the three subjects exceeds 98%, and the average recognition accuracy is higher than SVM, PSO-SVM, and FSVM algorithms at four speeds. It retains the recognition advantages of a single algorithm model as well as solves the shortcomings of SVM in practical applications. By integrating the advantages of improved SVM and PSO, the reliability of the algorithm is enhanced and the recognition accuracy is improved. To verify the effectiveness of the proposed method outdoors, another set of outdoor experiments was conducted. Subjects may be affected by uncertainties in the external environment, and their walking speed may vary and be irregular. All subjects were required to walk at slow, fast, moderate, and variable speeds and were trained using SVM, KNN, Adaboost, QDA, and PSO-FSVM as classifiers respectively. The experimental results indicate that the average accuracy of gait recognition is lower compared to walking on the treadmill due to the external environment. Among them, the recognition accuracy is the lowest under variable speed conditions, with an average accuracy of 96.13%. This suggests that variable speed conditions have the most significant impact on recognition outcomes. The gait detection accuracy under various speeds and environmental conditions may be affected by stride, BMI (Body Mass Index), weather, and parameters of the PSO-FSVM. Therefore, data that encompasses more factors and gait information can be analyzed under various speeds and environmental conditions and then serve as input for the gait detection model. Additionally, a more precise PSO-FSVM method can be modeled by improving the optimization process of PSO algorithms (Wu et al. 2023; Moazen et al. 2023). Besides, the proposed method achieves an average gait recognition rate of 97% in moderate speed conditions. The accuracy of the proposed algorithm can obtain 96.98% with the fast speed conditions, which manifests the effectiveness of the method. The average recognition rate is higher than the recognition results of the other four classifiers.

6 Conclusion

In this paper, we develop a pressure insole system using flexible and elastic sensors to collect lower limb walking ground reaction force at different speeds. To tackle the multi-gait phase recognition of the exoskeleton robot, we propose a PSO-FSVM method that takes advantage of PSO and considers radius-margin error bound. Experimental results show that the proposed method improves the accuracy by 2.68% on average in comparison with the standard SVM and achieves 98% accuracy at four speeds. Furthermore, outdoor experiments demonstrate the effectiveness of the proposed method for gait phase detection under more conditions. Experimental results show that the average recognition accuracy can exceed 96%, despite being affected by the environment. With the optimal parameters and model offline trained of PSO-FSVM and the real-time module of the industrial control system, the real-time recognition of the gait phase for the exoskeleton robot will be achieved. Future work will focus on applying this method in real-time gait phase prediction for the lower limb exoskeleton.