1. Introduction
The increasing availability of wearable body sensors has led to novel scientific studies on human activity recognition and human gait analysis [
1,
2,
3]. Human activity recognition (HAR) usually focuses on activities related to or performed by legs, such as walking, jogging, turning left or right, jumping, lying down, going up or down the stairs, sitting down, and so on. Human gait analysis (HGA), in contrast, focuses not only on the identification of activities performed by the user, but also on how the activities are performed. This is useful in exoskeleton design, sports, rehabilitation, and health care.
The walking gait cycle of a healthy human consists of two main phases: a swing phase that lasts about 38% and a stance phase that lasts about 62% of the gait cycle [
4]. A good gait is related to a minimal mechanical energy consumption [
5]. An unusual gait cycle can be evidence of disease; therefore, gait analysis is important in evaluating gait disorders, neurodegenerative diseases such as multiple sclerosis, cerebellar ataxia, brain tumors, etc. Multiple sclerosis patients show alterations in step size and walking speed [
6]. The severity of Parkinson’s disease and stroke shows a high correlation with stride length [
7]. Wearable sensors can be used to detect and measure gait-related disorders, to monitor patient’s recovery, or to improve athletic performance. For instance, EMG sensors can be used to evaluate muscle contraction force to improve performance [
8,
9] in running [
10] and other sport fields [
11]. Emergency fall events can be detected with tri-axial accelerometers attached on the waist of elderly people [
12]. Accelerometers installed on the hips and legs of people with Parkinson’s disease can be used to detect freezing of gait and can prevent falling incidents [
13,
14,
15,
16].
Exoskeletons can provide augmented physical power or assistance in gait rehabilitation. In the former case, exoskeletons can be used to help firefighters and rescue workers in dangerous environments, nurses to move heavy patients [
17], or soldiers to carry heavy loads [
18]. Rehabilitation exoskeletons can be used to provide walking support for elderly people or can be applied in the rehabilitation of stroke or spinal cord injury [
19,
20]. The neuromuscular disease Cerebral Palsy, which affects the symmetry and the variability of the walking, represents the pathology that mainly needs the usage of exoskeletons/prostheses to rehabilitate the walking [
21].
We introduce a new methodology, termed human gait inference (HGI), for predicting what would be the movements of amputated leg parts (thigh, shank, or foot) for causal walking-related activities such as walking, taking stairs, sitting down, standing up, etc. Limb losses occur due to (a) vascular disease (54%), including diabetes and peripheral arterial disease, (b) trauma (45%), and (c) cancer (less than 2%) [
22]. Up to 55% of people with a lower extremity amputation due to diabetes will require amputation of the second leg within 2–3 years [
23]. In the USA, about 2 million people live with limb loss [
22].
In this article, we propose a gait inference system, called GaIn, for patients suffering at most double trans-femoral amputation. Our idea is based on the high correlation between the movements of the leg parts of people without functional gait disorder during usual activities.
Figure 1 shows a nonlinear correlation between the thigh and shank angles (of the same leg) during several gait cycles measured during walking related activities. The angles of the thigh and shank are measured to the horizontal line. Consequently, it is possible to infer the movements of the lower legs (both shanks and feet) based on the movements of both thighs using machine learning methods. The GaIn system could be installed on microchip-controlled robotic leg prostheses that could be attached to patients in a non-invasive way to infer the movements of the lower limbs, as illustrated in
Figure 2. Therefore, the GaIn system could help patients suffering partial or double lower limb amputation to move and walk alone.
The HGI methodology and our GaIn system are different from exoskeletons. GaIn and HGI provide methods to infer the movements of the missing lower leg parts (shanks and feet), which are directly controlled by the remaining parts of the patient’s legs (thigh). In contrast, rehabilitation exoskeletons often replay a reference gait trajectory prerecorded on healthy users, which might result in an unsuitable gait for the patient [
1,
19,
24]. The patients’ own efforts are not taken into account. However, the exoskeletons for augmented physical strength incorporate data obtained from the whole legs of healthy users [
1].
The GaIn controller consists of two components: activity recognition and gait inference. The first component recognizes whether the patient is sitting, standing, or moving. In a sitting position, GaIn does not allow any gait inference, so the legs remain motionless. However, when thigh muscle activity is detected, the controller performs a standing up activity. When the patient is standing and starts swinging one of his legs, then GaIn activates the gait inference procedure. Because the human movement is produced with neural mechanisms in the motor cortex of the human brain or spinal neural circuits [
25], we believe the neurally inspired artificial neural networks could be suitable models for gait inference. Therefore, GaIn uses recurrent neural networks for inferring human gait. In addition, we designed GaIn to be fast and computationally inexpensive, performing low prediction latency. In our opinion, these features are necessary in order to be applied on mobile devices where energy consumption matters [
26]. We note that turning during walking involves rotating the torso, hip, and the thighs at hip joints but not the shanks [
27]; therefore, our analysis does not examine turning strategies.
The GaIn system to be efficiently used in portable systems should meet the following requirements:
Low prediction latency.
Smooth, continuous activity recognition within a given activity and rapid transition in between different activities.
Fast and energy efficiency.
The first requirement ensures that the model is of low latency; therefore, activity prediction can be made instantly based on the latest observed data. Therefore, bidirectional models, such as bidirectional long short-term memory (LSTM) recurrent neural networks (RNN) [
28] or dynamic time warping (DTW) [
29] methods, are not appropriate for our aims for two main reasons: first, these bidirectional methods require a whole observed sequence before making any predictions, which would therefore increase their latency. Second, the prediction they make on a frame is based on subsequent data. Standard hidden Markov models (HMMs) have become the de facto approach for activity recognition [
30,
31,
32,
33], and they yield good performance in general. However, they do so at the expense of increased latency in prediction because Viterbi algorithms use the whole sequence, or at least some part of it, in order to estimate a series of activities (i.e., hidden states), and their time complexity is polynomial. Therefore, in our opinion, HMMs are not adequate for on-the-fly prediction because the latency of these methods can be considered rather high.
The second point is to ensure that an activity recognition method provides consistent prediction within the same activity, but changes rapidly when the activity has changed. Lester et al. [
32] have pointed out that single-frame prediction methods such as decision stumps or support vector machines are prone to yielding scattered predictions. However, human activity data are time series data in nature, and subsequent data frames are highly correlated. This tremendous amount of information can be exploited simply by sequential models such as HMM and RNN, or by incorporating the sliding-window technique to single-frame methods (e.g., nearest-neighbor). In fact, the authors in [
31] have pointed out that the continuous-emissions HMM-based sequential classifier (cHMM) performs systematically better than its simple single-frame Gaussian mixture model (GMM) counterpart (99.1% vs. 92.2% in accuracy). Actually, the proposed sequential classifier wins over all its tested single-frame competitors (the best single-frame classifier is the nearest mean (NM) classifier which achieves up to 98.5% in accuracy). This highlights the relevance of exploiting the statistical correlation from human dynamics.
Continuous sensing and evaluating CPU-intensive prediction methods rapidly deplete a mobile system’s energy. Therefore, the third point requires a system to be energy-efficient enough for mobile-pervasive technologies. Several approaches have been introduced for this problem. Some methods aim to keep the number of necessary sensors low by adaptive selection [
34] or based on the activity performed [
35,
36,
37], for accurate activity prediction. Other approaches aim to reduce the computational cost by feature selection [
38], feature learning [
39], or proposing computationally inexpensive prediction models such as C4.5, random forest [
40], or decision trees [
41].
In this article, our methodology and experimental results are purely computational. Building and testing a prototype of such robotic, prosthetic legs for patient suffering from double trans-femoral amputation is the subject of our ongoing research. We expect that the patients may feel discomfort at the beginning but will become acclimated after a short adjustment period. We hope the prosthesis will be a useful tool in combating disability discrimination as is called for under several human rights treaties, such as the Rights of Persons with Disabilities convention by the United Nations [
42] and Equality Acts [
43,
44] in jurisdictions worldwide. These also mandate access to goods, services, education, transportation, and employment. We expect the GaIn tool will be effective in helping patients tackle common obstacles such as stairs, uncut curb in urban areas.
The rest of the article is organized as follows. The next section gives a detailed description of the GaIn system.
Section 3 describes the data collection and the performance evaluation methods used in our study. It also describes the feature extraction steps from the data obtained from the EMG and the motion sensors. In
Section 4, we present our experimental results and discuss our findings. Finally, we conclude our study in the last section.
3. Methods and Data Sets
3.1. Data Sets
In our experiments, we used the human gait data from the HuGaDB database [
51]. The data is freely available at
https://github.com/romanchereshnev/HuGaDB. This dataset consists of a total of five hours of data from 18 participants performing eight different activities. These participants were healthy young adults: four females and 14 males with an average age of 23.67 years (standard deviation [STD]: 3.69), an average height of 179.06 cm (STD: 9.85), and an average weight of 73.44 kg (STD: 16.67). The participants performed a combination of activities at normal speed in a casual way, and there were no obstacles placed in their way. For instance, starting in the sitting position, participants were instructed to perform the following activities: sitting, standing up, walking, going up the stairs, walking, and sitting down. The experimenter recorded the data continually using a laptop and annotated the data with the activities performed. This provided us a long, continuous sequence of segmented data annotated with activities. In total, 1,077,221 samples were collected.
Table 1 summarizes the activities recorded and provides other characteristics of the data.
During data collection, MPU9250 inertial sensors and electromyography sensors made in the Laboratory of Applied Cybernetics Systems, Moscow Institute of Physics and Technology (
www.mipt.ru) were used. Each EMG sensor has a voltage gain of about 5000 and a band-pass filter with bandwidth corresponding to a power spectrum of EMG (10–500 Hz). The sample rate of each EMG-channel is 1.0 kHz, the analog-to-digital converter (ADC) resolution is 8 bits, and the input voltages is 0–5 V. The inertial sensors consisted of a three-axis accelerometer and a three-axis gyroscope integrated into a single chip. Data were collected with the accelerometer’s range equal to
g with sensitivity 16.384 least significant bits (LSB)/g and the gyroscope’s range equal to
/s with sensitivity 16.4 LSB/°/s. All sensors were powered with a battery, which helped to minimize electrical grid noise.
Accelerometer and gyroscope signals were stored in int16 format. EMG signals were stored in uint8. In our experiments, all data were scaled to the range .
In total, six pieces of inertial sensors (three-axis accelerometer and three-axis gyroscope) and two EMG sensors were installed symmetrically on the right and left legs with elastic bands. A pair of inertial sensors were installed over the rectus femoris muscle 5 cm above the knee, another pair of sensors around the middle of the shin bone at the level where the calf muscle ends, and a third pair on the feet on the metatarsal bones. Two EMG sensors were connected to the skin by three electrodes over the vastus lateralis muscle. The EMG sensors additionally provided two more features. This installation provided 36 signal sources, 18 signal sources were from the accelerometers (2 legs × 3 sensors × 3 axes), 18 signals were from the gyroscopes (2 legs × 3 sensors × 3 axes), and two signals were from the EMG (2 sensors). For the sensor locations, we refer the reader to see [
51].
The sensors were connected through wires with each other and to a microcontroller box, which contained an Arduino electronics platform with a Bluetooth module. The microcontroller collected 56,350 samples per second on average, with a standard deviation of 3.2057, and then transmitted them to a laptop through a Bluetooth connection. Data acquisition was carried out mainly inside a building. Data were not recorded on a treadmill. We note that walking contains turning but unfortunately the annotation does not indicate this information.
We note that some data in HuGaDB contained corrupted signals and, typically, several gyroscope measurements were overflown and hence trimmed. We discarded these data from our experiments and
Table 1 summarizes information on data we actually used.
3.2. Feature Extraction Methods
First, raw data obtained from the gyroscope and accelerometer sensors were filtered with moving average using a window of 100 samples. This was performed to remove the bias drift of inertial sensors [
52].
The gait inference method is based on the thigh angle and angular speed data in the sagittal plane. The initial angle degrees for thigh and shank are calculated based on the accelerometer data and Earth gravity [
45]. Formally, the start angle of the thigh (
) is calculated with
where
and
denote the values of the accelerometer sensors located on thigh. Similarly, the start angle of the shank (
) is calculated via
where
, and
denote the values of the accelerometer sensors located on shank. The angular velocities are from the gyroscope data. Let
and
be angular velocities of thigh and shank at time
t, respectively. The angles of thigh
and shank
at time
t can be calculated as follows [
45]:
For every time frame t, the standard deviation (std) of the gradients of the EMG signals was calculated from the previous 5 and 10 measurements and were used for sitting down and standing up intention recognition, respectively. Formally, let denote the EMG signal data at time t. The feature for the variance of the gradients of the EMG signals in the last w time steps is formulated as . For sitting down intention recognition, we use a feature to measure the variance of the differences of the accelerometer data between the two thighs in the last 10 data frames. It is formulated as for the x-axis.
3.3. Model Implementation Details
The GaIn system (a) recognizes activities and intentions and (b) infers gait. We used a RapidHARe module to recognize standing up intention in the sitting position from the EMG sensor data. The intention was modeled with 10 Gaussian components, while sitting was modeled with one Gaussian component. We used another RapidHARe model to recognize sitting down intention during standing or walking activities from EMG sensor data and the differences of the accelerometer data. The intention was modeled with 5, while all others were modeled with two Gaussian components, respectively. We used a third RapidHARe module to recognize sitting, standing, and walking-related activities using one Gaussian component for each. All models used 20 long context windows.
For gait inference, the RNN consisted of 50 LSTM hidden units in one hidden layer. The learning objective for the RNN was to minimize the squared error between the predicted and the true shank angle. For the training, the input sequential data were chunked into 15 long data segments.
Table 2 summarizes the features we used in each module.
The classification methods were implemented using the Python scikit-learn package (version 0.18.1). The RNN/LSTM was implemented with Keras library (version 2.1.2) using TensorFlow framework as backend (version 1.4.0). Training and testing were carried out on a PC equipped with Intel Core i7-4790 CPU, 8 Gb DDR-III 2400 MHz RAM, and Nvidia GTX Titan X GPU. Training and testing on all data took roughly three hours.
3.4. Evaluation Methods
The performance of our GaIn method was evaluated using a supervised cross-validation approach [
53]. In this approach, data from a designated participant were held out for tests, and the rest of the data from the 17 participants were used for training. Thus, this approach gives a reliable estimation of how well the GaIn system would perform for a new patient whose data have not been seen before. In our experiments, we repeated this test for every user in the dataset and averaged the results.
The error of the gait inference was measured by the absolute value of the difference between the true and the predicted shank angles. The activity recognition was evaluated with and metrics, where TP, FP, and FN denote the number of the true positive, false positive, and false negative predictions, respectively. In addition, we calculated and reported the score, which is a combined score of the recall and the precision measures, defined as .
5. Conclusions
In this article, we presented a new method, called GaIn, for human gait inference. GaIn was designed to predict the movements of the lower legs based on the movements of both thighs. This can potentially be the basis for building non-invasive, robotic, lower limbic prostheses for patients suffering from double trans-femoral amputation. Our method is based on the observation that the thigh degrees strongly correlate to the shin bone degrees during casual walking-related activities. In this article, we showed that the shank degrees can be predicted using recurrent neural networks with LSTM memory cells using thigh degrees as input. Our experimental results showed that our system is highly accurate and it achieved 4.55 degree prediction error on average. The error for the stance phase was even lower. We believe that a recurrent neural network is a suitable mathematical model to simulate the motor cortex of the human neural system, and we think this is the reason why GaIn achieves low prediction error.
However, in a real-life application, sitting down and standing up intentions cannot be recognized from thigh movements. To circumvent this, we applied EMG sensors placed on the skin over the vastus lateralis—the thigh muscles; therefore, the patient can signal her/his intentions by increasing thigh muscle activity. Our system achieved a 99% precision and recall in recognizing standing up intention, and achieved 99% precision and 68% recall in recognizing sitting down intention. We mentioned that a patient may suffer injury if the system incorrectly predicts a sitting down intention during walking or just standing. For safety reasons, we adjusted the decision rule accordingly to maintain low false alarm (high precision) at the expense of high missed alarm (low recall). As a result, users may need to produce clearer signals to indicate sitting down intention.
Here, we presented our results purely on in silico experiments. Building a real prototype of such a robotic prosthetic leg is the subject of our current research. In practice, we expect that the patients may feel a little discomfort using such robotic prosthetic legs at the beginning and need to adjust to the device and, on the other hand, we will also need to make adjustment in the GaIn model to adapt the prosthesis to diverse peoples and urban situations. We hope that the prosthesis will be a useful tool in combating disability discrimination.