Transformer-Based Multi-Step Bilateral Knee Angle Prediction and Gait Phase Recognition Using Wearable IMU Sensors

Anitha R, Vismaya S, Vinoth S, Vikash Kumar, Mohanavelu KarXiv 2026

TL;DR

When you wear a robotic exoskeleton, even a tiny lag between your body’s intention and the machine’s response makes walking feel like wading through molasses. This paper uses a Transformer network and wearable motion sensors to peer 0.6 seconds into the future, predicting how both knees will bend while automatically decoding what phase of the walking cycle you’re in—all without a single manually labeled data point.

What Problem Does This Paper Address?

Human walking is a controlled fall, and the knee is the main shock absorber and stabilizer keeping us upright. For wearable assistive robots and rehabilitation devices to help rather than hinder, they have to anticipate movement before it happens to compensate for inevitable hardware and control delays.

Right now, most machine learning models only estimate what your joints are doing right this millisecond or maybe one tiny step ahead. If you also want the robot to understand gait phases—whether your foot is swinging through the air or planted firmly on the ground—you usually have to train a separate model using thousands of hours of tedious, human-annotated video data. Furthermore, older sequential models (like LSTMs) struggle to remember long-term patterns in complex movements without losing the plot. The authors wanted a unified, annotation-free way to forecast both knees simultaneously over a meaningful future horizon.

Methods

The authors built a two-stage pipeline combining deep sequence modeling with classic biomechanical rules.

Fig. 3: Wearable IMU sensor arrangement for gait data col- lection: (a) front view and (b) back view
  • Standard Foundations: They start with wearable Inertial Measurement Units (IMUs)—essentially the motion sensors in your smartphone—strapped to the thighs, shanks, and feet of both legs. These capture acceleration, angular velocity, and orientation at 100 Hz (one sample every 10 milliseconds). After smoothing out high-frequency sensor noise, they feed this data into a standard encoder-decoder Transformer (3 encoder layers, 2 decoder layers, 4 attention heads).
  • The Forecasting Setup: Using a sliding window, the model looks at 1.28 seconds of past movement (128 steps), skips 20 milliseconds ahead to explicitly account for real-world hardware lag, and predicts the next 0.6 seconds (60 steps) of flexion–extension angles for both knees in a single forward pass.
  • What's New (Rule-Based Pseudo-Labeling): Instead of training a classifier on human-labeled gait data, they pass the Transformer's predicted knee angles—along with how fast those angles are changing (the temporal gradient)—through a set of deterministic kinematic thresholds. For instance, an angle under $15^\circ$ is flagged as Swing, while an angle between $30^\circ$ and $60^\circ$ with a slowing gradient ($\Delta\theta \le 1^\circ$) is Stance. This gives you automatic gait-phase recognition for free.

Datasets

Rather than using an off-the-shelf benchmark, the authors collected their own dataset from 25 healthy adult participants wearing the 17-sensor Xsens MVN Awinda motion capture suit (though only the 6 lower-limb sensors were used as model inputs, and the suit's own kinematic software outputs served as the reference angles).

Fig. 4: Data acquisition pipeline using the Xsens MVN Awinda® IMU system.

Participants performed five everyday locomotion activities: level-ground treadmill walking (at 5 km/h), inclined walking, declined walking, stair ascent, and stair descent. Note that participant demographics (age, height, weight) were unavailable in the analyzed dataset.

Key Insights and Ideas

  • One-Shot Beats Step-by-Step: Traditional recurrent models often forecast long horizons recursively—predicting one step, feeding it back in, and praying errors don't snowball. By using a Transformer's attention mechanism to output all 60 future steps at once, the model captures bilateral coordination (how your left leg informs your right leg) cleanly over long horizons.
  • The "Unseen Human" Reality Check: Everyone walks with a slightly different biomechanical signature. A major takeaway from this paper is the massive performance gap between testing on familiar movement distributions versus testing on brand-new people. It’s an honest reminder of why strict subject-level data splitting matters in wearable tech.
  • Kinematics Tell a Good-Enough Story: While knee angles alone can't capture every nuance of clinical physiology across stairs and slopes, pairing predicted angles with their rate of change is surprisingly effective at separating the major phases of walking—saving huge amounts of manual labeling effort.

Key Results

  • Pooled vs. Subject-Level Accuracy: In the original pooled sample-level evaluation, the Transformer achieved a crisp Mean Absolute Error (MAE) of $1.95^\circ$ and RMSE of $2.65^\circ$ (compared to $5.70^\circ$ MAE for a recursive LSTM baseline, though input windows differed). However, under a strict five-fold subject-level cross-validation—testing exclusively on unseen people—errors jumped to an MAE of $17.54 \pm 6.75^\circ$ and RMSE of $21.79 \pm 8.23^\circ$.
  • Gait Phase Agreement: Comparing the rule-based phases derived from predicted angles against those derived from reference angles yielded $84.41\%$ accuracy on the right knee and $83.22\%$ on the left ($83.82\%$ average). Most slip-ups happened right at the blurry boundaries between adjacent phases, like transitioning from Swing to Initial Contact.
  • Fast Enough for Real-Time: On a CUDA-enabled GPU, training took under 3 minutes ($33.97\times$ faster than CPU), and average inference latency was just $5.82\text{ ms}$—well inside the $10\text{ ms}$ window between incoming 100 Hz sensor readings.

Limitations and Future Work

The authors are commendably transparent about the boundaries of their setup:

  • Healthy Subjects & Offline Testing: The data comes strictly from healthy adults in offline experiments; how this holds up on an embedded microcontroller strapped to a patient with a neurological gait disorder is still an open question.
  • Ground-Truth Caveats: Reference angles came from Xsens sensor-fusion software rather than gold-standard optical camera markers, and the gait phases are kinematic pseudo-labels rather than clinically annotated foot-strike events.
  • Where Next: To bridge that steep $17.54^\circ$ generalization gap on unseen users, the authors suggest exploring subject-adaptive and transfer learning. They also plan to fuse IMUs with muscle-activity sensors (surface EMG) and shoe-sole pressure sensors, and test the system live on actual lower-limb exoskeletons.

Summary updated

BibTeX
@misc{r2026transformer,
  author = {Anitha R and Vismaya S and Vinoth S and Vikash Kumar and Mohanavelu K},
  title = {{Transformer-Based Multi-Step Bilateral Knee Angle Prediction and Gait Phase Recognition Using Wearable IMU Sensors}},
  year = {2026},
  eprint = {2611.35755},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2611.35755},
}
Figure