Keywords

1 Introduction

According to World Health Organisation (WHO) report about one billion persons are affected by neurological disorders worldwide [2]. Neurological diseases ranging from migraine to stroke and Alzheimer are the leading cause of Disability Adjusted Life Years (DALY) loss [8]. For example, there is a high risk of falling down for patients with gait impairments from neurological disease [20, 24]. Therefore it is important to assess neurological disease patient gait deviations and, if possible, correct step patterns using certain assistive devices. It is shown that even simple mechanical devices like ankle-foot orthoses certainly can reduce the risk of falling [27]. However, it is shown that Functional Electrical Stimulation (FES) devices that activate in proper moments corresponding muscles, are more effective for fall prevention [14] and generic gate improvements [16]. Essentially, long term gate deviation analysis and efficient run-time control of FES devices requires automated recognition of “incorrect” steps or other gate deviations. According to our previous research [22] we have concluded that Support Vector Machines (SVM) based methods are most widely used ones for automated gait analysis, followed by Convolutional Neural Networks (CNN). The benefits of SVM include capability to operate with relatively small data sets and high computational efficiency [10, 11]. For human activity recognition has been reported by Almaslukh et al. [1] quite impressive accuracy, close to 97%. There are several other results indicating 90% accuracy, listed in [22]. However, there is a very limited research conducted of analysing how well machine learning methods, particularly SVM, performs in detecting realistic gait deviations, caused by actual neural diseases. Current work focuses on describing test results collected by us in this domain, that are still relying on simulated gait deviations.

Gait of each person is virtually unique. It can be described by a set of parameters such as: step length, length of individual step phases, muscle force and etc. [18]. Especially high variability and deviations from the “normal” gait pattern can be seen in persons gait, who are suffering from neuromuscular diseases [15]. Therefore it is extremely difficult to analyze patients’ gate patterns. Certain diseases cause jumpy gait changes - like freezing episodes of Parkinson Disease (PD) [4], other diseases, like Multiple Sclerosis (MS) may contain long duration relapse episodes with individual impact and have slow progression [23]. From the perspectives of physiotherapists, each person has own “normal” (or target) gate that has to be used as a reference in gate assessment procedure.

Various stationary (3D camera systems), portable (pressure mats) and wearable (motion sensors) instrumental solutions are used for gait analysis. However, wearable motion sensors, containing multidimensional Inertial Motion Units (IMUs), are the most widely used gait assessment devices in the recent years [25]. IMUs are also used for gait assessment of neurological disease patients [12, 19, 21].

Main goal of this research work is to detect abnormality in the gait, caused by some kind of disease, as fast as possible, to prevent person from falling. Current paper proposes analysis of gait using SVM, to classify the normal and abnormal steps. Even if such a full step classification does not solve the main goal, abnormality estimation in the real-time, it will be used as pre-processing stage to produce reference set of good steps for the real-time abnormality detection algorithm. Therefore the current paper proposes time series based “good” and “bad” steps SVM classifier implementation, which is built on the tslearn Python library [26] and applied to the time-series gyroscope gait data, which is different from feature based SVM classification, used in other works. Thus, it is possible to compare achieved results to the feature based approach, found in other works.

This paper consist of 5 sections: after the introductory state-of-art overview in Sect. 2 the motion data collection methodology is described; in Sect. 3 proposed application of the SVM based algorithm implementation, applied to the time-series gait data, is presented; the results are presented in the Subsect. 4 and discussion and conclusion are in the Sect. 5.

2 Gait Data Collection

The fundamental part of each instrumented gait analysis is collection of human walking patterns, which provide relevant information about the gait changes of the subjects. The human gate contains of seven phases [3] (Fig. 1). The ultimate long term goal is to detect deviations of each phase separately for fastest gate corrections. However, current study focuses on classification of whole steps only.

Fig. 1.
figure 1

The seven phases of human gait cycle [3]

During the current study, Shimmer S3 (Dublin, Ireland) wearable sensors were used for lower limb motion data capture. Sensors were configured to work 256 Hz sampling rate, measurement data was recorded on device’s memory, later modulus was calculated from three-dimensional 16-bit gyroscope signal to reduce the amount of data feed to machine learning algorithm. Two different sensor placements were initially tested (Fig. 2): right below of the knee that is the location of foot drop FES devices directly stimulating the most important lower limb muscles, namely tibialis anterior and fibularis longus, and on forefoot, which is the most widely used placement of inertial sensors for gate cycle monitoring [9]. According to initial visual analysis of recorded signals, forefoot data was selected for the further analysis.

Fig. 2.
figure 2

Sensor placement for data collection

During the data collection, correct (“good”) and incorrect (“bad”) steps were mixed according to following procedure:

  1. 1.

    \(Normal\ gait + one\ abnormal\ step\)

  2. 2.

    \(Normal\ gait + one\ abnormal\ step + normal\ gait\)

  3. 3.

    \(Normal\ gait + N \cdot abnormal\ step + normal\ gait + N \cdot abnormal\ step\), where \(N=0,1,2,3,4\ldots \)

To add more variability to the test data, recording was performed on two types of surfaces: hard and soft (sand) surface. Each recording contains deviations of one specific disability type that is described below. Recordings were annotated using a semiautomatic tool: all correct and incorrect steps were labeled in the data file.

2.1 Data Collection of Simulated Gait Abnormalities

The ultimate goal of present study is to evaluate how well an actual SVM implementation can detect gait deviation caused by neurological impairments. Abnormalities were simulated by 2 healthy persons of different gender, both 23 years old. Simulations were replicating actual patients’ videos and instructions of a professional physiotherapist. The chosen, most frequent, gait abnormalities were following:

  • Steppage gait - seen in patients gait with foot drop (weakness of foot dorsiflexion). This is caused due to an attempt to lift the leg high enough during walking, so that the foot does not drag on the floor [3]. This disability is most widely targeted with foot drop assistive devices.

  • Hemiplegic gait - includes impaired natural swing at the hip and knee with leg circumduction. The pelvis is often tilted upward on the involved side to permit adequate circumduction.

  • Diplegic gait - a specific subcategory of the wide spectrum of motion disorders gathered under the name of cerebral palsy.

  • Ataxic gait - commonly defined as a lack of coordination in body movements or a loss of balance, which is not due to muscle weakness.

  • Parkinsonian gait - is a feature of Parkinson’s disease in later stages. It’s often considered to negatively impact the quality of life more than other Parkinson’s symptoms. Parkinsonian gait is usually small, shuffling steps.

  • Hyperkinetic gait - is seen with certain basal ganglia disorders, including Sydenham’s chorea, Huntington’s Disease, and other forms of chorea, athetosis, or dystonia. The patient will display irregular, jerky, involuntary movements in all extremities. Walking may accentuate their baseline movement disorder [3].

Comparative analysis of applying SVM algorithm to data is in the next section.

3 SVM Performance Assessment

Considering that the SVM is well known in classification applications and, particularly, in gait analysis [1, 5, 13, 17, 28], this method, however, can not be used directly with time series (output of IMU motion sensor), where the input vectors can be of different lengths (feature dimensions). Therefore, time series oriented implementation (tslearn [26]) of the SVM classifier (call it as tsSVM) was selected for the current research work and applied to the human gait steps ensemble extracted from the time series data to classify correct and anomaly (incorrect) steps.

TsSVM implementation uses Global Alignment Kernel (GAK) [6], which allows to apply the SVM classifier to time-series data with different duration of samples.

The GAK is related to the soft-Dynamic Time Warping (soft-DTW) [7] through Eq. (1), which is used to align time series samples in time. In kernel equation, \({\mathbf{x}=(\mathbf{x}_\mathbf{0},\dots ,\mathbf{x}_\mathbf{n-1})}\) and \({\mathbf{y}=(\mathbf{y}_\mathbf{0},\dots ,\mathbf{y}_\mathbf{m-1})}\) are two time series of respective lengths \(\mathbf{n}\) and \(\mathbf{m}\). Hyper-parameter \(\gamma \) is related to the bandwidth parameter \(\sigma \) of GAK through \(\gamma =2\sigma ^2\).

$$\begin{aligned} k(x,y)=exp(\frac{softDTW_{\gamma }(x,y)}{\gamma }) \end{aligned}$$
(1)

In Eq. (2) soft-DTW could be observed with hyper-parameter \(\gamma \), that controls smoothing of the resulting metric (squared DTW corresponds to the limit case \(\gamma \rightarrow 0\)), where \({(\mathbf{a}_\mathbf{1},\dots ,\mathbf{a}_\mathbf{n})}\) is time series.

$$\begin{aligned} soft-min_{\gamma }(a_1,\dots ,a_n)={-\gamma }log\sum _{i}e^{-a_{i}/\gamma } \end{aligned}$$
(2)

The GAK’s smoothing hyper-parameter \(\gamma \) was experimentally chosen depending on the data set to get the best actual performance. Usually it was between 20 and 150. Tslearn toolbox was used to convert one-dimensional magnitude, calculated from gyroscope data from data set into time series with same length. Then data set was divided into training and test sets with proportion of 70% to 30% respectively. After that, training was performed and the following results were achieved.

First some preprocessing was required to be able to use the algorithm. Data was divided into individual steps, using timestamps in labels. After that they were combined into required form and normalized in duration by adding Nan’s to the shorter steps. Then proper hyperparameter \(\gamma \) was chosen by iteration over potential numbers.

4 Results

In proposed approach 3D gyroscope angular velocity data was used as the initial input, which then was transformed into the magnitude time series format. Assuming that gyroscope axes are called gX, gY and gZ, the magnitude is calculated as in Eq. 3, where \(t_i\) is given moment of time, and normalized by Min-max feature scaling 4 for every time series instance:

$$\begin{aligned} gM(t_i) = \sqrt{gX(t_i)^2+gY(t_i)^2+gZ(t_i)^2} \end{aligned}$$
(3)
$$\begin{aligned} gM(t)_{norm} = \frac{gM(t) - gM(t)_{min}}{gM(t)_{max} - gM(t)_{min}} \end{aligned}$$
(4)

Calculated gyroscope magnitude time series (Eq. 3) is used as an input for the tsSVM algorithm.

To understand the results lets observe support vectors on Fig. 3 for two classes, they represent common step forms, corresponding to a particular class. For each class support vectors looks similar, only for class 2 excess vectors could be observed, what affects results. Ataxic gait test data set had 14 samples: 6 abnormal steps (positive) and 8 normal steps (negative). After training the SVM on 32 samples, two false positives were detected using test data set (Table 1).

Table 1. Classification quality for data. Where, TP is True Positive, TN is True Negative, FP is False Positive and FN is False Negative

This could have happened due to residual “abnormality” in normal steps following abnormal steps. On the Fig. 8c noisier step could be seen than the step on the Fig. 8a. Similar situation could be observed for steppage gait test 1, where there is to much deviation for normal steps (Fig. 5a and Fig. 5c), what could be considered as data collection error. This leads to misclassification of abnormal steps which result in 0% f1 score (Fig. 4). On the other hand, if normal steps are consistent, as for steppage gait test 2 (Fig. 7), classification of abnormal steps is preformed correctly and f1 score of 100% is achieved (Fig. 6).

Fig. 3.
figure 3

Support vectors for ataxic gait, test 2. X-axis is the time [ms], Y-axis is normalized gyroscope magnitude values (see Eq. 4).

Fig. 4.
figure 4

Support vectors for steppage gait, test 1. X-axis is the time [ms], Y-axis is normalized gyroscope magnitude values (see Eq. 4).

Fig. 5.
figure 5

Normal (left) and abnormal (right) steps for steppage gait, test 1. X-axis is the time [ms], Y-axis is normalized gyroscope magnitude values (see Eq. 4).

Fig. 6.
figure 6

Support vectors for steppage gait, test 2. X-axis is the time [ms], Y-axis is normalized gyroscope magnitude values (see Eq. 4).

Fig. 7.
figure 7

Normal (left) and abnormal (right) steps for steppage gait, test 2. X-axis is the time [ms], Y-axis is normalized gyroscope magnitude values (see Eq. 4).

Fig. 8.
figure 8

Normal (left) and abnormal (right) steps for ataxic gait, test 2. X-axis is the time [ms], Y-axis is normalized gyroscope magnitude values (see Eq. 4).

Fig. 9.
figure 9

Support vectors for diplegic gait, test 1. X-axis is the time [ms], Y-axis is normalized gyroscope magnitude values (see Eq. 4).

Lets have closer look at step shapes. For example on Fig. 8a first peak represents a moment, when toe is starting to move in the end of stance phase (40%–60% of phase on Fig. 1), then it is start of a swing phase, till the second peak (60%–100%), which represents toe movement, to prepare for initial contact and third peak is, when toe lands on the ground flat (0%–20%), after that it is a stance phase between the toe movement (20%–40%). For abnormal step (Fig. 8b) clear separation between peaks is lost. According to description of ataxic gait type, clear swing phase is lost, what could be observed.

As it was mentioned above, on Fig. 8 and Fig. 10 peaks for normal and abnormal gait steps are located differently and have different amplitudes. F1 score for ataxic gait was 80% (Fig. 3) and for diplegic gait it was 100%, (Fig. 9) that shows SVM capability of classifying steps. Good results could be observed also for parkinsonian and hyperkinetic gaits, 93% and 80% respectively, because normal and abnormal steps have very different magnitude and shape. For diplegic gait abnormal step (Fig. 10b) it could be seen, that third peak is unclear, that shows that there is no full contact of toe with ground on that gait type (Figs. 4, 6 and 9).

Fig. 10.
figure 10

Normal (left) and abnormal (right) steps for diplegic gait, test 1. X-axis is the time [ms], Y-axis is normalized gyroscope magnitude values (see Eq. 4).

Also for diplegic gait type it could be observed, that normal steps have more common features and abnormal steps have different number of peaks and magnitude. That helps tsSVM to differentiate them better and gives higher score. Because of the nature of this anomalous gait, several abnormal steps were performed in the row, that means that number of abnormal steps was more than in some other data sets.

Fig. 11.
figure 11

Support vectors for hemiplegic gait, test 2. X-axis is the time [ms], Y-axis is normalized gyroscope magnitude values (see Eq. 4).

Fig. 12.
figure 12

Normal (left) and abnormal (right) steps for hemiplegic gait, test 2. X-axis is the time [ms], Y-axis is normalized gyroscope magnitude values (see Eq. 4).

Normal and abnormal steps for hemiplegic gait can be observed in the Fig. 12. They have similarly placed local maximums but with different amplitudes. This is due to abnormal movement, mainly affecting upper body, thus sensor have little impact by that movement. Normal steps have some variation, especially after abnormal step. This leads to misclassification and f1 score of 67% (Fig. 11).

5 Discussion and Conclusion

Ready made tsSVM could be well used for step classification, even using rather small amount of training data (tens of steps), as can be seen in results. The issues still occur, when the dataset is too small, and/or major variability in normal steps is present. As mentioned before, this situation is quite likely to appear with actual patient data. Some issues may arise, if gait deviation is happening in the upper part of the body. That would only lead to small deviations in forefoot placed sensor data, and could easily lead to misclassification of steps. A straightforward solution would be to add more body sensors, but that would increase systems cost and significantly reduce comfort of usage of this system. Obtained results could be useful in determining how different gait types abnormalities affect quality of classification of machine learning algorithms. It is clear, that good reference data presence (correct steps) is crucial for SVM, and, most likely for the other ML based classification methods as well.

Type of gait deviation has significant affect on quality of chosen algorithm results. Achieved average step classification accuracy was near to 80%, what is below the numbers published in literature. We assume, that classification performance of real patient data would be even worse. However, besides of performance improvements, with better training data selection and usage, we would develop an algorithm, that can detect anomalies during the gait phases instead of the whole steps. That is crucial to be able to correct gait on basis of needs. In the future we estimate, that applying certain ML techniques, possibly SVM, during the real-time operation of the next generation of FES devices, would make them less intervening and increase patients’ comfort.

In real life human gait steps can not be modelled by using two class classifiers, thus multi-class classifier is crucial to distinguish the abnormal steps, related to some kind of disease, from normal steps. Normal steps could be divided into several classes as well, e.g. normal walking steps, turning steps and etc.

Thus, the further work will be focused on the construction of the multi-class classification algorithm for reference step obtaining. That would be used to develop real-time abnormality detection algorithm, that is able to detect abnormal gait in different contexts.