Calibration-Free Gait Assessment by Foot-Worn Inertial Sensors

Walking is a central activity of daily life, and there is an increasing demand for objective measurement-based gait assessment. In contrast to stationary systems, wearable inertial measurement units (IMUs) have the potential to enable non-restrictive and accurate gait assessment in daily life. We propose a set of algorithms that uses the measurements of two foot-worn IMUs to determine major spatiotemporal gait parameters that are essential for clinical gait assessment: durations of five gait phases for each side as well as stride length, walking speed, and cadence. Compared to many existing methods, the proposed algorithms neither require magnetometers nor a precise mounting of the sensor or dedicated calibration movements. They are therefore suitable for unsupervised use by non-experts in indoor as well as outdoor environments. While previously proposed methods are rarely validated in pathological gait, we evaluate the accuracy of the proposed algorithms on a very broad dataset consisting of 215 trials and three different subject groups walking on a treadmill: healthy subjects (n = 39), walking at three different speeds, as well as orthopedic (n = 62) and neurological (n = 36) patients, walking at a self-selected speed. The results show a very strong correlation of all gait parameters (Pearson's r between 0.83 and 0.99, p < 0.01) between the IMU system and the reference system. The mean absolute difference (MAD) is 1.4 % for the gait phase durations, 1.7 cm for the stride length, 0.04 km/h for the walking speed, and 0.7 steps/min for the cadence. We show that the proposed methods achieve high accuracy not only for a large range of walking speeds but also in pathological gait as it occurs in orthopedic and neurological diseases. In contrast to all previous research, we present calibration-free methods for the estimation of gait phases and spatiotemporal parameters and validate them in a large number of patients with different pathologies. The proposed methods lay the foundation for ubiquitous unsupervised gait assessment in daily-life environments.


INTRODUCTION
Walking is a central activity of daily life, and restrictions of this ability lead to a reduction in the quality of life (1,2). Therefore, gait analysis is an important tool in different medical and therapeutic fields (3,4). The measurement of various gait characteristics can either facilitate diagnosis or be used to track the progress of rehabilitation. Gait can be measured by spatial (e.g., step or stride length) and temporal (e.g., stride time, cadence) parameters, relative durations of gait phases, and kinematic and kinetic gait variables (5). These parameters are used to quantify gait deviation in both clinical practice and research, and their use varies with the medical field, the research question, and the analysis options. While gait assessment in clinical practice is mostly based on visual observation by medical experts (6), it is desirable to support expert knowledge and time by objective measurements. This is also important because relevant gait changes are often too subtle to be detected by the naked eye (7).
Traditionally, sensor-based gait assessment is performed with stationary systems like marker-based optical motion tracking, instrumented treadmills, or pressure-sensitive walkways (6,8).
Besides being expensive, one major drawback of those systems is that they are limited to a small capture space or require the subject to walk on a treadmill (4,(9)(10)(11)(12). Furthermore, the use of walking aids is often not possible or restricted in combination with such systems.
A promising, more ambulatory, and less restrictive alternative is inertial gait analysis, i.e., gait analysis with inertial sensor technology. Lightweight and battery-powered inertial measurement units (IMUs) are used, which transmit the data wirelessly.
The transition from expensive stationary systems to small wearable sensors opens up possibilities that go beyond replacing the measurement technology used for gait assessment in a clinical setting. Integrating objective long-term gait monitoring in dayto-day life-as illustrated in Figure 1-could provide more powerful tools for clinicians to help patients in rehabilitation but also to gain further insights into disease progression. Furthermore, non-obtrusive wearable plug-and-play systems facilitate applications in neuroprosthetics (13) or exoskeletons and can be used to provide biofeedback (14). In the last years, wireless battery-powered IMUs have become smaller, lighter, more accurate, and at the same time cheaper and more energyefficient, and it is to be expected that this development is going to continue. For those new trends, it is important to develop methods that can provide a wide variety of gait parameters that are useful to medical experts. At the same time, the methods need to be robust so that the system can be used by patients in unsupervised settings, outdoors as well as indoors.
It has been shown by previous contributions (15)(16)(17) that major gait parameters can be determined with two IMUs that are placed on the feet or the shoes, as illustrated in Figure 1. This includes stride length, gait phase durations (e.g., stance and swing percentage), and also the cadence and walking speed.
Our aim is to propose methods for gait assessment that meet the requirements for day-to-day life monitoring in unsupervised settings and that are validated on a broad group of subjects including patients with various gait pathologies. The proposed methods do not assume any fixed orientation of the sensor with respect to the foot and do not require the subject to perform dedicated calibration movements. Furthermore, magnetometers are not used since the magnetic field is known to be severely disturbed in indoor environments (18). This makes the use of inertial gait analysis easy and practical in clinical settings and facilitates future applications of ubiquitous gait analysis in home environments.
The remainder of the article is structured as follows. In section 2, we briefly review existing methods for IMU-based spatiotemporal gait parameter estimation. In section 3, we describe the proposed methods, which we then validate in section 4 using experimental data of 98 orthopedic and neurological patients, as well as 39 healthy subjects walking at different speeds. The results are discussed in section 5, and section 6 provides conclusions.

BRIEF REVIEW OF IMU-BASED SPATIOTEMPORAL GAIT PARAMETER ESTIMATION
Several methods have been proposed that employ inertial sensors to obtain spatiotemporal gait parameters. In the following, we present a brief overview of the current state of the art and summarize the different hardware setups that are used, which parameters are calculated, and how the methods were validated. Table 1 categorizes 23 publications that provide a range of examples for the variety of existing approaches in the estimation of spatiotemporal gait parameters with inertial sensors.
There are different hardware setups, based on the number of inertial sensors and their placement. The chosen setup has an impact on which and how many parameters can be derived from the measured data. The most commonly used setup consists of two IMUs. As shown in Table 1, sensors are typically placed on the feet or shoes and sometimes on the shank. This setup is occasionally extended by adding a third sensor on the pelvis or lumbar spine (34,35). Note that it has even been shown that temporal gait events can be obtained from a single IMU at the pelvis (38), but the potential for extracting further spatial parameters is limited. Full (lower) body motion tracking opens up additional possibilities, as demonstrated with 7 IMUs on the lower body and pelvis in (37) and with 8-15 IMUs in (36). Another, less common, option consists of combining inertial sensors with further measurement devices, e.g., a camera on one foot and LEDs on the other foot to facilitate the direct measurement of relative positions (39).
Some methods require that a known orientation of the sensor axes with respect to the anatomical foot axes has to be ensured by precise placement. Many methods in the literature are based on such assumptions, including (13, 15-17, 22, 23, 25, 26, 30-33). In practice, however, ensuring a precise placement is a challenge, especially in non-supervised application scenarios and during activities of daily life. Alternatives are to develop methods that are agnostic to the sensor-to-segment orientation-e.g., by FIGURE 1 | Inertial gait analysis can be realized with two miniaturized IMUs on the shoes, enabling daily-life assessment outside of laboratory environments. From the raw sensor data, orientation, gait phases, and velocity and position trajectories can be estimated. Parameters commonly used in gait analysis, such as stride length, cadence, and walking speed, can easily be derived from this.
only relying on signal norms-or to determine this orientation in a process commonly called anatomical calibration (40). For setups with more sensors, there are recently developed methods that facilitate automatic anatomical calibration by exploiting kinematic constraints of the respective joints without requiring the subject to perform precise calibration movements (41,42). For those setups, the linking of the sensors to the body segments poses another challenge to a plug-and-play approach, which can be solved by automatic pairing methods (43).
The calculation of spatiotemporal gait parameters is usually implemented in a two-stage approach. In a first step, gait events and corresponding gait phases are detected. In a second step, spatial parameters are calculated.
Existing methods vary in the set of gait events or phases that are detected. In many cases, the focus is only on the separation between stance and swing (cf. Table 1), although sometimes additional events, such as mid-swing (33), are also detected. It is also common to detect four events that occur during the gait cycle and are only defined by the ipsilateral (same) foot. Those events are initial contact, full contact, heel rise, and toe-off, although the terminology varies. Despite being common practice in gait analysis (5,44), employing bilateral information, i.e., combining information from both feet to define the gait phase, is far less common in IMU-based gait analysis. One example is (36) in which single and double limb support durations are calculated.
In addition to the detection of gait events, spatial parameters such as stride length and walking speed are often calculated. Those parameters are obtained by either signal integration, human gait models, or by machine learning methods (46). By far the most common approach is numerical strapdown integration of the accelerations (16,17,22,27,28,31,32,37). The cyclic nature of gait and the fact that there is frequent ground contact are exploited to correct for drift that is due to double integration. It has been shown that Fourier-based integration is an alternative to numerical integration (34), that spatial parameters can be obtained from kinematic models (27,36), and that convolutional neural networks can also be used to estimate spatial parameters (23).
Most publications focus on common spatiotemporal parameters such as stride length, walking speed, and cadence. Other than those spatiotemporal parameters, there is a multitude of spatiotemporal gait parameters that are relevant in a clinical context for various pathologies (6). Examples that can be estimated using inertial sensors include step width (37), swing width (31,37), incline (22), and foot clearance (47).
Some publications (13, 19-21, 25, 33) focus on realtime detection of events, e.g., to trigger functional electrical stimulation (FES). While the approaches used are usually similar to the ones used in offline gait analysis, this typically implies a focus on minimizing the detection delay rather than the accuracy of the reported values.
As shown in Table 1, evaluation is often performed with marker-based optical motion capture as ground truth. Systems based on the detection of pressure, such as pressure-sensitive walkways, instrumented treadmills, and pressure insoles, are a common alternative. In some cases, no validation with respect to a gold standard is performed. Instead, the settings of a (calibrated) treadmill are used for walking speed and incline (22), a manually counted number of steps is combined with the detection of irregularities (21), validation is performed by visual inspection of the results (19), or the focus is only on test-retest reliability (36).
Even though it has been shown that the accuracy of gait analysis methods decreases when applied to non-healthy subjects (45), the evaluation of inertial gait analysis methods is often only based on healthy subjects. When data obtained from non-healthy subjects is part of the evaluation, the number of subjects is often small, for example five transfemoral amputees (20), 10 stroke patients (33), 10 hemiparetic patients and 10 Huntington's disease patients (35), or 10 patients with Parkinson's disease (31).
To the best of our knowledge, few publications (15-17, 23, 29, 32) exist which propose methods for IMU-based spatiotemporal gait parameter estimation and validate the methods on a larger set of subjects with gait pathologies. In the following, we briefly summarize those publications.
In (15), sensors are placed on the forefoot in a known orientation, and four different unilateral gait events are detected based on features of the angular velocity in the sagittal plane, the norm of the accelerometer signal, and the derivative of angular velocity norm. Using pressure insoles as reference, the method is validated on 10 healthy and 32 orthopedic subjects.
The commercial Gait Up system is evaluated in (29) with 25 subacute stroke patients as subjects and marker-based optical motion capture as reference.
Gait events and stride length are calculated in (16) based on shank-mounted IMUs. Events are detected based on the angular rate in the sagittal plane, and stride length is obtained via double integration of the accelerations. The latter relies on the proprietary orientation estimation algorithm provided by the sensor manufacturer. Experimental evaluation is performed using the GAITRite pressure-sensitive walkway as reference on 10 healthy elderly and 30 non-healthy subjects.
In (32), the same method is validated on a much larger group of subjects, consisting of 236 community-living older adults, including 31 mild cognitive impaired subjects and 125 Parkinson's disease patients.
In (17), IMUs are placed laterally on the shoe in a fixed orientation, stance, and swing durations are calculated based on characteristic signal features, and the stride length is obtained via double integration. The method is evaluated using a large data set of 101 geriatric inpatients, with reference data obtained from a GAITRite pressure-sensitive walkway.
Using the same gait event detection method and the same data set for evaluation as (17), Hannink et al. (23) estimates stride length, stride width, mediolateral change in foot angle, heel contact times, and toe contact times using deep convolutional neural networks.
In summary, the main shortcoming of existing approaches for the vision of plug-and-play ambulatory gait analysis is that most methods-especially those with broad validation-require a precise attachment of the sensor to the subject's foot. Some methods only focus on gait events and do not provide spatial parameters, and some methods rely on proprietary algorithms of the sensor manufacturers. Furthermore, very few of the proposed methods are validated on a large group of subjects with diverse gait pathologies.
In the following section, we propose a set of methods that combine the valuable achievements of existing methods with additional features that overcome the remaining limitations.

METHODS
In the following, we propose a set of methods to determine gait parameters from two IMUs attached to the foot. The proposed methods are based on the following assumptions and requirements: An IMU is attached to each foot (or shoe) in an arbitrary orientation. This implies that the proposed method does not make any assumption about the orientation of the sensor coordinate system, which means it does not require any specific sensor axis to be aligned with an anatomical or functional axis of the foot. In order to avoid artifacts caused by toe or ankle motions, and also to not limit the subject's freedom of movement, we propose to attach the IMU on the instep, i.e., the dorsal side of the midfoot. We obtain the accelerometer and gyroscope readings of both IMUs at a fixed sampling rate (typically in the range 50-1,000 Hz). We assume that data for several steps is processed at once, which allows us to employ non-causal signal processing to increase the accuracy compared to sample-bysample real-time capable methods. This processing can either be performed in batches while the subject is walking, e.g., for use in biofeedback applications, or after the recording is completed. During the recording, the subject walks either on a treadmill or an indoor or outdoor ground.
The set of methods that we propose is explained in the following subsections, and the presentation is structured as follows. Separately for each foot, we use the recorded sensor data to separate phases in which the foot is in full contact with the ground from phases in which the foot moves, i.e., we detect when strides take place (section 3.3). For each detected stride, we then detect toe-off (section 3.5) and initial contact (section 3.6). The gait events from the ipsilateral and contralateral foot are combined to define gait phases. We calculate the relative duration of each gait phase and the cadence (section 3.7). We then estimate the sensor orientation by sensor fusion of the gyroscope and accelerometer readings (section 3.8) and doubleintegrate the acceleration to obtain a position trajectory (section 3.9). From this position trajectory, we obtain the stride length and the walking speed (section 3.10). Figure 2 provides an overview of the proposed set of methods.
In the remainder of this section, we define parameters used by the method. For an overview of those parameters and proposed values, please refer to Table 2 in section 4. Our aim is to define the parameters in a way that they are not sensitive to different gait styles or velocities. In section 4, we demonstrate that this approach works by only employing one common set of parameters for validation on a very broad data set with healthy and non-healthy subjects walking at different speeds.

Notation
Denote the accelerometer readings a(t k ) ∈ R 3 and the gyroscope readings In the following, all times t with any index are multiples of T s . If any calculation yields a time that is not a multiple of T s , we assume that this value is rounded to the nearest multiple of T s and do not explicitly write this for the sake of a compact notation. Furthermore, any summation over τ should be interpreted as a summation with a non-integer step size of T s , i.e., we simply write t 2 τ =t 1 x(τ ) instead of the longer but mathematically precise notation k 2 k=k 1 x(t k ), k 1 = t 1 T s , k 2 = t 2 T s . Unit quaternions in vector notation are used to represent rotations and orientations (48). When a quaternion is used to represent the sensor orientation, it is the rotation from an inertial reference frame with the z-axis pointing up (and arbitrary heading) to the coordinate system of the sensor. In the context of quaternion multiplication, which we denote by ⊗, threedimensional vectors are implicitly regarded as quaternions with zero real part.
Furthermore, v ⊺ denotes the transpose of the vector v.

Gait Events and Gait Phases
According to standard literature (44) and as illustrated in Figure 3A, the gait cycle starts at initial contact. Each stride can be separated into stance and swing. Stance consists of the gait phases loading response, mid-stance, terminal stance, and preswing. Swing can be separated into initial swing, mid-swing, and terminal swing. The combination of mid-stance and terminal stance is called single limb support and corresponds to the swing phase of the contralateral foot. In standard literature (44), the initial contact is commonly considered to be a very short gait phase with a duration of 2 %. As it is common practice in IMUbased gait analysis (15,19,21,26), we define the initial contact as an event without duration. Note that sometimes the initial contact is also called foot strike (26) or heel strike (15). The separation between stance and swing and the separation of stance into loading response, mid-stance, terminal stance, and pre-swing is defined based on three events that describe a change of ground contact of the feet: initial contact, heel rise, and toe-off. In contrast, the separation of swing into initial swing, mid-swing, and terminal swing is based on positional information of the feet and on the tibia orientation. The gait phases are defined based on bilateral events, i.e., the gait phase of the ipsilateral foot is not only described based on the events of the same (ipsilateral) foot but also based on toe-off and initial contact of the other (contralateral) foot.
We will now describe how we determine five of those gait phases (swing and the four sub-phases of stance) using IMUs in a two-step approach. First, we detect four gait events independently for each foot. We then use this gait event cycle of both feet to derive gait phases for each foot.
To this end, for each stride i ∈ {1 . . M}, we define the following events that we want to detect independently for the right and left foot from the raw measurement data of the corresponding IMU: Note that in addition to the three events used to define gait phase transitions in Figure 3A, we introduce an event called full contact that indicates that the foot is in full contact with the ground. For various processing steps, such as zero-velocity updates and position integration, we further define a rest instant t rest,i at the middle of the foot flat phase, i.e., See Figure 3B for a plot of the raw accelerometer and gyroscope data measured during one stride along with a graphical representation of the gait event cycle defined by the introduced events. In the following subsections, we will describe in detail how we determine those time instants from the raw sensor data. After having determined the gait events for both feet, we use the gait event cycles from both feet to determine the gait phase according to the commonly used definitions by (44). As shown in Figure 4, finite automata for the gait phases of the left and right foot are each driven by the gait event cycles of both feet.
Since time instances from both sensors are used for the definition of the gait phase transitions, both feet must be equipped with sensors, and precise time synchronization is required. However, note that the separation into stance and swing directly follows from the gait event cycle (as shown in Figure 4) and is independent of the contralateral foot. Therefore, we can determine stance and swing regardless of the synchronization between the sensors. This is also useful if only one foot is equipped with a sensor and facilitates on-chip data processing.
Note that the three sub-phases of stance in the gait event cycle hold further information that is not directly captured by the standard gait phase definitions as given in Figure 3A. We denote the phase from t fc,i to t hr,i , in which the foot is fully on the ground, as foot flat. Note that the other two sub-phases of the stance phase, t ic,i to t fc,i and t hr,i to t to,i , are sometimes called loading response and pre-swing (19, 21) but do not correspond to the phases with the same name as defined in standard literature (44).
Furthermore, as also shown in Figure 4, time-synchronized events from both feet also allow for the distinction of double support, single support, and zero-contact phases, which occur only during running (44).

Foot Flat Detection
As the first step of gait phase detection, the phases in which the foot is fully on the ground (foot flat) are detected. When the foot is fully on the ground, the Euclidean norm of the accelerometer readings will be close to 9.81 m/s 2 , and the norm of the gyroscope readings will be close to zero. During a stride, we typically will see an increase in the signal norms. However, it is possible that during the motion phase there are long periods with only small changes of velocity or small rotations. To obtain a robust stride detection, we, therefore, first find activity using either the accelerometer or the gyroscope readings and then combine this information.
For an acceleration-based rest signal r a (t k ), we consider the absolute difference of the norm from 9.81 m/s 2 , and perform acausal thresholding using a threshold a th and a hysteresis factor h a by applying hysteresis in forward and backward direction, i.e., with r * a (0) = 0 and r a (t N ) = r * a (t N ). In the resulting signal, zero-phases shorter than T 0,min are set to one, and afterward, one-phases shorter than T 1,min are set to zero.
The same acausal thresholding with the removal of short phases is applied to the gyroscope norm signal ω(t k ) := ω(t k ) using a threshold ω th and hysteresis factor h ω , which yields a gyroscope-based rest signal r ω (t k ). See Figure 5A for an illustration of the thresholding method.
Both rest signals, r a (t k ) and r ω (t k ), are combined into r(t k ), which is set to one if at least one of the two signals is one. Afterward, zero-phases shorter than T 0,min are set to one, and then one-phases shorter than 2T 1,min are set to zero. This process is illustrated in Figure 5B. Each zero-to-one transition of the resulting signal marks a heel rise t hr,i , and each one-to-zero transition marks a full contact t fc,i+1 .

Automatic Threshold Adaptation
A common issue with thresholding approaches is that the thresholds have to be adapted based on gait velocity and also other gait and sensor characteristics (19,20). Therefore, instead of performing the thresholding of the accelerometer and gyroscope norm using manually tuned thresholds a th and ω th , we propose an algorithm that automatically determines these thresholds for each trial based on the measured data.
The threshold a th is determined using an iterative algorithm similar to (49), with l being the iteration index and w a being a FIGURE 4 | Derivation of clinically relevant gait phases from the gait event cycles. Following standard literature (44), events from both the left foot (filled arrows) and the right root (outlined arrows) are necessary to define the gait phase of each foot. Furthermore, support phases based on the number of feet that are in contact with the ground can be defined based on the gait events.
weighting parameter: a(t k ) We perform 200 iterations to ensure convergence, i.e., a th : = a th,200 . Figure 6 illustrates the result of this process. Further, we define a lower bound a th,min for this threshold. Similarly, we determine the threshold ω th based on the gyroscope norm ω(t k ) and a weighting factor w ω .

Toe-Off Detection
After determining heel rise and full contact, we want to detect the beginning of the swing phase, i.e., the toe-off. During toe-off, the foot first rotates approximately along the mediolateral axis as the heel rises, then loses contact with the ground and rotates in the opposite direction. An inertial sensor attached to the foot cannot directly measure when the foot fully loses contact with the ground, in contrast to, e.g., pressure-sensitive walkways. Note that the accuracy of toe-off detection using pressure sensors also depends on calibration and the chosen thresholds (12).
As rotation can be measured precisely with IMUs, we exploit the fact that the direction of rotation of the foot changes when transitioning from the phase in which the heel rises while the toe stays on the ground to the phase in which the toe leaves the ground. This approach is commonly used in existing literature, as detailed in section 2. However, most methods directly rely on the angular rate measured in the sagittal plane and thereby require at least one sensor axis to be well-aligned with a functional axis of the foot.
To be independent of the sensor orientation and also to obtain a reliable detection if the subject exhibits strong inversion or eversion during toe-off, we define a signal called tilt-rate Ŵ i (t k ), from each heel rise t hr,i to the subsequent full contact t fc,i+1 , as The rationale behind the definition of the tilt-rate Ŵ i (t k ) is to identify the main axis of rotation since the last heel rise and compute the current rate of rotation around this main axis. This enables us to detect a zero-crossing of the main rotation without making any assumptions on the orientation of the sensor with respect to the foot. In general, the tilt-rate Ŵ i (t k ) will exhibit a change of sign after a distinct peak (cf. Figure 7A). As there might be noise, leading to (B) Illustration of the combination of r ω (t k ) and r a (t k ) into r(t k ). By using the OR combination of the accelerometer-and gyroscope-based signals, we are able to robustly detect when the foot is not fully on the ground. frequent sign changes right after t hr,i , as well as large peaks later during the stride, we propose the following strategy to robustly determine the sign change of interest: During the first half of the movement phase, let Ŵ max,i denote the maximum value of Ŵ i (t k ), i.e., We then find the first time instant for which Ŵ i (t k ) ≥ 1 2 Ŵ max,i . Starting from this time instant, we find the first time instant at which Ŵ i (t k ) ≤ 0. We assume this time instant to be the toeoff t to,i , i.e., the start of the swing phase. Figure 7A illustrates this process.
Note that t to,i is defined based on a feature of the rotation of the foot and not directly as the lift-off of the toes.
Using the maximum of the tilt rate (or any weighted average of the maximum and zero-crossing time instant) are also plausible approaches.

Initial Contact Detection
The initial contact marks the beginning of the loading response and can be detected by the jerk, i.e., the change of acceleration, caused by the foot touching the ground. We calculate the jerk using the first-order backward difference approximation, i.e., For every stride, we only consider a sub-window of the phase between toe-off and the beginning of the subsequent foot-flat phase and denote the start time of this window as t win,i : = j win t to,i−1 + (1 − j win )t fc,i , j win ∈ [0, 1]. In this time window, we first determine the maximum value of the jerk norm, i.e., We then mark the first time instant in this window with j(t k ) ≥ j th j max,i as the start of the loading response t ic,i . See Figure 7B for an illustration of the initial contact detection.

Stride and Gait Phase Durations and Cadence
For each detected stride, we calculate the stride duration as the duration from one initial contact to the subsequent initial contact of the same foot, i.e., For each detected stride, the duration of the swing phase is the time between toe-off and initial contact of the subsequent stride, i.e., T swing,i := t ic,i+1 − t to,i .
A B FIGURE 7 | Detection of toe-off and initial contact events that define the swing phase. (A) Illustration of the toe-off detection. Between heel rise and full contact, the tilt rate might exhibit multiple local maxima and zero-crossings. For a robust detection of the correct zero-crossing, we first find the maximum value during the first half of the phase from t hr,i to t fc,i+1 and search for the first zero-crossing after the tilt rate has reached half of this maximum. (B) Illustration of the initial contact detection based on the jerk norm. Note how the jerk norm reflects the sudden change when the foot touches the ground much better than the accelerometer norm signal a(t k ).
The stance duration is the remaining duration of the stride: T stance,i := T stride,i − T swing,i .
Since relative gait phase durations are easier to interpret, we calculate T swing,rel,i := T swing,i T stride,i , T stance,rel,i := T stance,i T stride,i .
Similarly, for every stride we calculate relative gait phase durations for loading response T lr,rel,i , single limb support T sl,rel,i , terminal stance T ts,rel,i , and pre-swing T ps,rel,i , based on the bilateral gait phases as defined in Figure 3A. Note that, analogously, we can also calculate absolute and relative durations for all other gait phases defined in Figure 3A.
To calculate the cadence, we multiply the inverse of the stride duration by two in order to express the cadence as the number of steps per minute instead of strides per minute, i.e.,

Orientation Estimation
By fusing the gyroscope and accelerometer measurements, we obtain an estimate of the sensor orientation with respect to a global frame that has a vertical z-axis and an arbitrary heading.
Starting with an arbitrary initial orientation q ω (0), e.g., 1 0 0 0 T , we perform gyroscope strapdown integration Using this orientation, we transform the measured acceleration into a (slowly drifting) inertial frame, i.e., In the rotating sensor frame, the gravitational acceleration can point in different directions depending on sensor orientation. In the inertial frame, however, the gravitational acceleration will point in (almost) the same direction regardless of the sensor orientation, and, when integrating, acceleration and deceleration will cancel out. Exploiting this property, we low-pass filter each component of a ω (t k ) by applying a moving average filter with a window length of T a in forward and reverse direction. Assuming that the change of velocity over the filter window length is small, the resulting filtered acceleration will be dominated by the gravitational acceleration. This filtered acceleration a ω,f (t k ) is then transferred back to the sensor frame We then correct the inclination of the gyroscope strapdown integration quaternion q ω (t k ) by using the filtered acceleration as a vertical reference. To this end, we transform the filtered acceleration into the global frame with q a (0) := 1 0 0 0 T , and correct the inclination α(t k ) := arccos 0 0 1 T a r (t k ) a r (t k ) q a (t k ) := q a (t k−1 ) ⊗ cos α(t k ) 2 n(t k ) Frontiers in Digital Health | www.frontiersin.org Multiplication of the gyroscope strapdown integration quaternion and the accelerometer correction quaternion yields the sensor orientation,

Foot Velocity and Position Tracking
Using the estimated orientation, we perform double integration of the measured accelerations to estimate the length of each stride, i.e., the horizontal displacement between two adjacent foot-flat phases.
To integrate accelerations, they are first transformed into the reference frame Assuming that the velocity is zero in the middle of the foot-flat phase, i.e., at t rest,i , we integrate those accelerations for each stride which yields a velocity (28) Due to measurement errors, mainly accelerometer bias, this velocity is usually not zero at t rest,i+1 even if the foot is perfectly at rest. Therefore, we correct this drift linearly over the time duration of the stride: See Figure 8 for an example velocity trajectory with and without drift correction. By integrating this drift-free velocity over the stride duration, we obtain a position trajectory,

Stride Length and Walking Speed
We calculate the stride length L i as the horizontal displacement during the stride i. Since p i (t rest,i ) = 0, Note that this method does not make any assumption on the orientation in which the sensor is attached to the foot. Also, note that we integrate from t rest,i to t rest,i+1 and not from t ic,i to t ic,i+1 since this makes the zero-velocity assumption more robust. By dividing the stride length by the stride duration, we obtain the walking speed,

Summary of the Estimated Parameters
After performing all steps presented above, the set of proposed methods provides the time instants of the defined gait events, the sensor orientation quaternion for each time instant, and velocity and position trajectories. From those time-based signals, the following gait parameters are extracted for each stride i: Note that all quantities are calculated separately for each stride of each foot. In many cases, only the mean of those values over multiple steps will be of interest. However, this stepwise calculation also allows for analysis of the variance and the detection of trends.
The accuracy of those gait parameters is validated in the next section.

EXPERIMENTAL VALIDATION
In this section, we aim to show that the less restrictive IMUbased setup combined with the methods proposed in section 3 is able to determine the same parameters as stationary systems that are used in clinical practice while providing similar accuracy. To this end, with a large data set consisting of three different subject groups, we compare the parameters calculated by the proposed methods with values reported by instrumented treadmills.

Setup
One PABLO R Lower Extremity inertial sensor (Tyromotion GmbH, Graz, Austria) was attached to each shoe (cf. Figure 9A). The sensors measure angular rate and acceleration at a sampling frequency of 110 Hz. Each sensor has a size of 56 × 34 × 21 mm and transmits the data wirelessly using Bluetooth. The sensors were attached to the subjects' shoes with special Velcro straps.

Subjects and Experimental Procedure
The data collection was carried out in three different institutions with different groups of subjects. Approval from the ethics committee of the University of Graz was obtained, and an informed consent form was signed by all participants. Healthy participants were recorded at three different walking speeds, each for two minutes: 1.5, 3, and 5 km/h. A prerequisite for participation was the ability to walk on a treadmill at different speeds. The healthy participants (n = 39) were recruited from the students at the Physiotherapy Institute of FH Joanneum Graz.
Non-healthy participants with affected ability to walk were asked to walk on a treadmill at a self-selected comfortable walking speed. Patients who were unable to walk on a treadmill were excluded during participant selection. The following set of participants were recruited: • Participants with different neurological diseases (n = 36) were recruited from patients who were in neurological inpatient rehabilitation at NTK Kapfenberg at the time of data collection. This comprises 20 post-stroke patients, 6 patients with Parkinson's disease, two with multiple sclerosis, two with meningioma, two after polytrauma, and one patient each with epilepsy, spinocerebellar ataxia, low back pain, and polyneuropathy. • Participants with various orthopedic diseases (n = 62) were recruited from the patients who were in orthopedic inpatient rehabilitation at Rehazentrum Kitzbühel at the time of data collection. Of these, four patients had pathologies in the area of the ankle or lower leg (e.g., ankle joint fractures, tibia fractures), 21 patients at the knee (e.g., osteoarthritis, total knee arthroplasty), 18 patients in the area of the thigh and hip (e.g., osteoarthritis, total hip arthroplasty, femur fractures), 16 patients in the area of the lumbar spine (low back pain, lumbar vertebrae fractures) as well as three patients in whom different body areas were affected (polytrauma, polymyositis).
All participants had time to get used to walking on the treadmill prior to the data collection. All participants were free to use the treadmill support (handrail, fall protection system). For the data collection, two minutes of walking was recorded simultaneously by both systems. IMU data was recorded with a tool of the TyroS software (Tyromotion, Graz, Austria) that allows the export of raw gyroscope and accelerometer data. Zebris data was recorded, analyzed, and exported with the software FDM v1.18.38 (Zebris Medical, Isny, Germany).

Data Processing
For each trial, we obtain the following gait parameters from the Zebris Rehawalk instrumented treadmill: • loading response duration Frontiers in Digital Health | www.frontiersin.org This parametrization is used for the processing of all trials, regardless of gait pathology, walking speed, or style, in order to show that the method works well without tuning the parameters for specific gait characteristics.
These parameters are reported as averages over the whole trial. The gait phase durations are relative to the stride duration and reported separately for the left and right foot. We add the loading response, single limb support, and pre-swing durations to obtain the stance duration (cf. Figure 3A). From phases in which the treadmill is not moving and the foot is resting on the ground for approximately 5 s at the beginning and end of each trial, gyroscope turn-on bias is automatically estimated and removed. Using the methods described in section 3, each recorded trial is processed with the parameter values given in Table 2. Note that we use the same set of parameters for all different subject groups and walking speeds in order to demonstrate that the method works well without adjusting the parameters for the specific gait velocity and style.
The sensor attachment used for recording the data sets, as shown in Figure 9A, ensures that one sensor axis is always roughly aligned with the mediolateral axis of the foot. To show that the proposed methods do not make assumptions regarding the sensor orientation, we simulate a random sensor attachment by multiplying all gyroscope and accelerometer measurements with a random rotation matrix that is different for each trial.
Finally, we calculate the same gait parameters as reported by the reference system by averaging the respective parameters, excluding the first and last three strides of each foot, and compare the resulting values to the values reported by the Zebris system. The results are found in the following section.

Results
For each trial, we first consider the five main parameters stance duration, swing duration, stride length, walking speed, and cadence, and evaluate the difference between the proposed methods (IMU) and the Zebris Rehawalk reference system (REF). The results are presented separately for each of the three subject groups in scatter plots and Bland-Altman plots (50) and can be found in Figure 10, for the healthy participants walking at three different speeds; in Figure 11, for the participants with orthopedic diseases; and in Figure 12, for the participants with neurological diseases.
The error (mean ± standard deviation) for the relative stance duration is 1.04 ± 1.34 % for healthy subjects, −0.29 ± 1.52 % for orthopedic patients, and 2.06 ± 1.63 % for neurological patients. For relative swing duration, the errors are −1.01 ± 1.35 % for healthy subjects, 0.32 ± 1.54 % for orthopedic patients, and −2.02 ± 1.64 % for neurological patients. This means that the average swing/stance duration error is in the range of 1-2 % for all subject groups.
For the stride length, the errors are −1.59 ± 1.53, −1.74 ± 1.63, and 0.51 ± 1.37 cm for healthy subjects, orthopedic patients, and neurological patients, respectively. This means that the average stride length error is below 2 cm for all subject groups.
The mean errors and standard deviations for the walking speed are −0.02 ± 0.05 km/h for healthy subjects, −0.03 ± 0.05 km/h for orthopedic patients, and 0.03 ± 0.03 km/h for means that the average walking speed error is below 0.05 km/h for all subject groups.
The cadence estimates show deviations of 0.68 ± 0.56 steps/min for healthy subjects, 0.55 ± 0.47 steps/min for orthopedic patients, and 0.57 ± 0.51 steps/min for neurological patients. This means that the average cadence error is below 1 step/min for all subject groups.
As an additional evaluation metric, we calculate the mean of the absolute difference (MAD) between the values reported by Zebris and the IMU-based analysis over all trials. Table 3 summarizes the results for the three subject groups and all 215 evaluated trials.
The MAD of the stance and swing durations are ∼1.3 % for healthy subjects and orthopedic patients and 2.2 % for neurological patients. Note that we also evaluated the differences for the three sub-phases of stance that the Zebris Rehawalk reference system reports, i.e., loading response, single limb support, and pre-swing. Table 3 shows that we can estimate the duration of those phases with the same accuracy as stance and swing.
To summarize, for all subject groups, the MAD is in the range of 1-2 % for gait phase durations, below 2 cm for the stride length, below 0.05 km/h for the walking speed, and below 1 step/min for the cadence.

DISCUSSION
In the present contribution, we have proposed a set of methods for spatiotemporal gait analysis based on two inertial sensors attached to the feet. Our methods allow for the calculation of the main spatiotemporal gait parameters that are also reported by stationary laboratory systems: gait phase durations, stride length, walking speed, and cadence. Using a large data set consisting of healthy subjects walking at three different speeds, subjects with orthopedic diseases, and subjects with neurological diseases, we have validated the calculation of those parameters, using a Zebris Rehawalk instrumented treadmill as reference. All parameters show a very strong correlation (Pearson's r between 0.83 and 0.99, p < 0.01) (51). Figures 10-12 display consistent results over this large and diverse group of subjects. Averaged over all trials, the MAD with respect to the reference system is 1.4 % for the gait phase durations, 1.7 cm for the stride length, 0.04 km/h for the walking speed, and 0.7 steps/min for the cadence.
In clinical practice and research, the presented parameters are used to quantify gait abnormalities and to document changes in the walking behavior of patients. Associations between spatiotemporal gait parameters and functional capacity, or increased mortality, have been demonstrated (52)(53)(54). A positive FIGURE 11 | Scatter plots and Bland-Altman plots for stance and swing duration, stride length, walking speed, and cadence of 62 orthopedic patients. Red: 45-degree lines (y = x). Values obtained with the proposed IMU-based methods (IMU) are compared to the ground truth from the Zebris reference system (REF). The average deviation is below 1 % for gait phase durations, below 2 cm for the stride length, below 0.05 km/h for the walking speed, and below 1 step/min for the cadence.
correlation with cardiovascular-related mortality was found for cadence (55). A reduction in walking speed has been shown to correlate with fall risk, frequency of hospitalization, and mortality (56)(57)(58). Stride length describes a strong correlation with walking speed according to the research of (59). Slower walking speed, altered gait phase duration, and increased variability of walking increase the risk of falls (60). Furthermore, it was found that psychological modalities, such as fear of falling, can also influence stride length and gait phase duration (61). The minimal clinically important difference (MCID) can be used to determine how precisely these changes must be detected in order to make a statement about their relevance. Despite thorough research, specific values for the MCID could only be found for the walking speed, ranging from 0.36 to 0.72 km/h (62)(63)(64). For IMU-based measurement with the proposed methods, the smallest detectable change (SDC) for walking speed is 0.21 km/h and clearly within the MCID for all examined groups. For the other parameters, no reported MCID values could be found, which is consistent with the statement of (29).
The SDC for the cadence is 2.01 steps/min across all studied groups of subjects. This allows for much more accurate changes to be detected than those described as relevant in the literature [e.g., reduction in cadence of 10 steps per minute increases mortality by 4 % (65)]. The achieved SDC for stride length of 5.3 cm in the patients with neurological diseases seems to be sufficiently accurate to capture the differences occurring, for example, in Parkinson's disease (66). The stance and swing phase durations show an SDC of 6.5 % across all trials.
Unlike many existing contributions, we showed that the proposed methods reliably work on patients in addition to healthy subjects and still produce accurate results. This is noteworthy since it has been shown that pathological walking deteriorates the accuracy of many gait analysis methods (45)  and specifically the neurologically induced gait abnormalities are challenging for IMU-based gait analysis (29). A fundamental challenge of IMU-based gait event detection is that IMUs do not directly measure the gait parameters of interest. For toe-off detection, the time instant of load relief cannot directly be measured, and instead, the inversion of the direction of rotation is used. Similarly, initial contact is not detected based on the onset of load but based on the change of acceleration. It is therefore important to properly validate the IMU-based methods by comparing the estimated gait parameters to a reliable ground truth.
As reference system, treadmills instrumented with Zebris pressure measurement platforms were used, which are frequently employed for gait analysis in clinical practice as well as scientific data collection (12). This system shows good reliability (67), but no studies could be found in which the validity of the gait parameters was investigated. It should be noted that due to the length of the pressure sensors (FDM-THM-M-3i: 0.85 cm; FDM-THM-M-2i: 1.27 cm) there may be inaccuracies in the recording of spatial parameters, which may have an effect on the results of the comparative measurements. Moreover, calibration and proper thresholding pose challenges in gait event detection based on pressure measurements (12).
For the neurological patients, the reported duration of stance is, on average, 2 % longer than the reference duration. While this is still a small deviation, it is worth noting because this bias suggests a pattern that is common to this subject group. One likely explanation is that toe-off is being detected later than with the Zebris system. This might be due to a comparatively long phase of load relief that causes the pressure to fall below the threshold too early. Furthermore, the reversal of rotation direction might happen later than for healthy subjects or orthopedic patients. Still, even though both systems measure inherently different phenomena, the observation deviation is only 2 %.
As a replacement for traditional stationary gait analysis systems, which are commonly used in clinical practice, IMUbased gait analysis offers several advantages. Measurement is possible both on treadmills and overground and not restricted to a dedicated laboratory. The small and lightweight IMUs do not restrict the movement of the subject and can be used in conjunction with walking aids such as wheeled walkers. Furthermore, only a very short setup time is required before starting the actual measurement.
Unlike most existing methods (cf. section 2), the proposed method makes gait analysis easier and faster by not requiring any specific sensor attachment, which we demonstrated by simulating a different random sensor-to-foot orientation in each trial. It does not make use of magnetometers and can therefore be used in both indoor and outdoor environments.
While evaluation was limited to the gait phases reported by the reference system, our proposed set of methods further allows for the calculation of many gait phases (Figure 4), i.e., swing and stance for each foot, four unilateral gait phases for each foot, five bilateral gait phases following standard literature (44) for each foot, and finally the distinction between double and single support. To the best of our knowledge, no existing work on IMU-based gait analysis describes the calculation of this set of gait phases.
Besides the more fine-grained gait phases, there are many more parameters that can be extracted, e.g., from the velocity and position trajectories, such as the maximum velocity during swing, foot clearance, and symmetry parameters. While it is not surprising that the prevalence of pressure-based systems has led researchers to focus on features based on ground contact, it is to be expected that the focus of clinical gait analysis will be directed toward other parameters as IMU-based systems become more popular.
Furthermore, miniaturized lightweight sensors with a long battery life open up possibilities for objective gait analysis outside of clinical laboratories. Daily-life gait assessment over the course of multiple days can bring insights that are not possible with short sessions in a laboratory. If patients place the sensors on or in the shoes themselves in an unsupervised telemedicine setting, not requiring the sensor to be oriented in a special way becomes even more important.
Technological advancement also facilitates real-time biofeedback applications. While there are methods for realtime applications that require event detection during a step (41), e.g., to trigger FES, the proposed set of methods is real-time capable in the sense that during walking, sections of data containing a small number of strides can be processed and used to provide feedback to the subject.
The presented work exhibits a few remaining limitations. In the statistical analysis, the gait parameters were averaged over the duration of the trial before comparison with the reference. While it allows for single-stride errors to cancel out, this methodology corresponds well with the use case of clinical gait analysis, in which a subject is asked to walk for several steps, and averaged parameters are then used to assess the gait. An additional strideby-stride comparison was not performed because the employed reference system can only export averaged gait parameters. In addition, it should be noted that all recordings were made on treadmills and not while walking overground, which has an influence on the movement pattern of gait (68,69). Despite the known differences between treadmill walking and overground walking, treadmill gait analysis is considered a standard method in clinical practice (70,71), especially when weight support and handrails are required for safety reasons.

CONCLUSION
In the present contribution, we have proposed a set of methods for IMU-based gait analysis. Based on gyroscope and accelerometer measurements from two inertial sensors on the feet, we estimate durations of five gait phases, stride length, walking speed, and cadence. Using a Zebris Rehawalk instrumented treadmill as reference, we validated the proposed methods based on a large data set consisting of healthy subjects (n = 39) walking at three different speeds, subjects with orthopedic diseases (n = 62), and subjects with neurological diseases (n = 36). Averaged over all trials, the MAD with respect to the reference system are 1.4 % for the gait phase durations, 1.7 cm for the stride length, 0.04 km/h for the walking speed, and 0.7 steps/min for the cadence. We also demonstrated that the proposed methods work reliably not only in healthy subjects but also in patients and still provide accurate results under different pathological gait patterns.
This shows that the proposed setup in combination with the proposed methods can accurately calculate relevant gait parameters from the inertial sensor data and thus has the potential to replace traditional stationary gait analysis systems.
Furthermore, we validated that the proposed methods work well regardless of the orientation in which the sensor is attached to the foot, and dedicated calibration movements and magnetometer measurements are completely avoided. The combination of these advantages facilitates long-term ambulatory gait analysis in day-to-day situations without the need for supervision by health professionals.
Future research will focus on the estimation of additional gait parameters, on the validation on stairs and slopes, and the validation against marker-based optical motion capture systems.

DATA AVAILABILITY STATEMENT
The datasets presented in this article are not readily available because sharing of the data is not covered by the ethical approval.
Requests to access the datasets should be directed to Andreas J. Jocham, andreas.jocham@fh-joanneum.at.

ETHICS STATEMENT
The studies involving human participants were reviewed and approved by the Ethics Committee of the University of Graz (GZ. 39/55/63 ex 2017/18, 28 May 2018). The patients/participants provided their written informed consent to participate in this study.

AUTHOR CONTRIBUTIONS
DL and TS devised and developed the mathematical method. DL implemented the method, performed the data analysis, and drafted the manuscript. AJ, BG, KA, and MF planned and organized the data collection. AJ, BG, and KA conducted the data collection and post-processed the data. DL, AJ, BG, KA, MF, and TS revised the manuscript. All authors approved the submitted version.

FUNDING
We acknowledge support by the German Research Foundation and the Open Access Publication Fund of TU Berlin.