PrimSeq: a deep learning-based pipeline to quantitate rehabilitation training

Avinash Parnandi, Aakash Kaku, Anita Venkatesan, Natasha Pandit, Audre Wirtanen, Haresh Rajamohan, Kannan Venkataramanan, Dawn Nilsen, Carlos Fernandez-Granda, Heidi Schambra

TL;DR

PrimSeq is a deep learning pipeline that uses wearable sensors to automatically identify and count functional motion repetitions in stroke rehabilitation. By treating physical movement like a sequence of words in speech, it outperforms traditional machine learning methods and quantifies training 366 times faster than human experts, paving the way for precise, data-driven dosing in clinical therapy.

What Problem Does This Paper Address?

In stroke recovery, "dosage" matters. Neuroplasticity is driven by high-repetition practice of functional motions. However, clinical research currently relies on a very blunt metric: time spent in therapy. This is problematic because two patients might spend an hour in rehab but perform vastly different numbers of actual repetitions.

While manually counting repetitions provides precision, it is prohibitively expensive and time-consuming—requiring experts to spend dozens of hours reviewing video for every hour of patient activity. The authors address this "pragmatism vs. precision" trade-off by developing an automated system that can accurately decompose complex rehabilitation activities into fundamental building blocks, or "primitives," at scale.

Methods

The researchers developed PrimSeq, a three-step pipeline:

  1. Motion Capture: Patients wear nine inertial measurement units (IMUs) that capture 3D acceleration, angular velocity, and magnetic heading, generating a 77-dimensional kinematic dataset every 10 milliseconds.
  2. Primitive Prediction: The heart of the system is a Sequence-to-Sequence (Seq2Seq) deep learning model. Inspired by speech recognition architectures, it uses a bidirectional encoder Recurrent Neural Network (RNN) to compress a 6-second window of motion data into a feature vector, which a unidirectional decoder RNN then translates into a sequence of motion primitives.
  3. Counting Algorithm: A final algorithm resolves duplicates at the boundaries of the sliding data windows to provide a final tally of repetitions.

What sets this apart from standard activity recognition is the focus on "primitives"—the atomic units of motion (like reach or transport) that make up a larger activity (like feeding).

Datasets

The study utilized a robust, custom-labeled dataset:

  • Participants: 41 chronic stroke patients with varying levels of upper extremity impairment.
  • Data Split: A training set of 33 patients (43,429 primitives) and an independent test set of 8 patients (11,502 primitives).
  • Activities: Nine common rehabilitation tasks, including shelf reaching, tabletop manipulation, feeding, drinking, and tooth-brushing.
  • Labels: Five primitive classes: reach, reposition, transport, stabilize, and idle. Ground truth was established by trained human coders with high interrater reliability (Cohen’s Κ ≥ 0.96).

Key Insights and Ideas

  • Motion as Language: The most elegant idea here is treating physical therapy like speech. Just as a paragraph is made of words, a rehab session is a sequence of primitives. Using Seq2Seq—a model designed for language—allows the system to handle the fluid, overlapping nature of human movement better than models that try to classify single time points.
  • The "Stabilization" Challenge: The model struggled most with the stabilize primitive. The authors realized this was a "phenotypic" limitation: identifying a grasp (holding an object still) is difficult without IMU data from the fingers.
  • Structured vs. Naturalistic: The model performed exceptionally well (sensitivity > 0.90) on structured tasks like moving objects on a shelf but saw performance dips in "naturalistic" tasks like tooth-brushing. This suggests that the more "noisy" and variable the movement, the more context the model needs.

Key Results

  • Superior Accuracy: PrimSeq achieved an F1 score of 0.799, significantly outperforming benchmark models like Convolutional Neural Networks (0.763) and Random Forests (0.609).
  • Precise Counting: The pipeline generated counts that were 86.1%–99.6% of the true counts across different primitive classes.
  • Massive Speedup: The system identified and tallied primitives 366 times faster than human coders. Processing 6.4 hours of recording took the model 1.4 hours; the same task would take a human expert over 500 hours (roughly 12.8 workweeks).
  • Clinical Feasibility: Patients reported minimal discomfort, and setup took only about 13 minutes, making it viable for a busy clinical environment.

Limitations and Future Work

While PrimSeq is a major step forward, the authors note several areas for growth:

  • Quantity vs. Quality: The current pipeline counts how many motions occurred but doesn't yet measure how well they were performed (kinematic quality).
  • The "In the Wild" Gap: The data was collected in a controlled lab setting with chronic stroke patients. Future work needs to test the model with subacute patients in the chaotic environment of an actual inpatient rehab ward.
  • Hardware Constraints: As noted with the stabilize errors, adding finger-tracking sensors could significantly boost classification accuracy for complex grasping tasks.

Overall, PrimSeq offers a promising path toward "precision rehabilitation," where therapists can finally prescribe and monitor the exact dose of movement needed to drive recovery.

Summary updated

Abstract

Stroke rehabilitation seeks to increase neuroplasticity through the repeated practice of functional motions, but may have minimal impact on recovery because of insufficient repetitions. The optimal training content and quantity are currently unknown because no practical tools exist to measure them. Here, we present PrimSeq, a pipeline to classify and count functional motions trained in stroke rehabilitation. Our approach integrates wearable sensors to capture upper-body motion, a deep learning model to predict motion sequences, and an algorithm to tally motions. The trained model accurately decomposes rehabilitation activities into component functional motions, outperforming competitive machine learning methods. PrimSeq furthermore quantifies these motions at a fraction of the time and labor costs of human experts. We demonstrate the capabilities of PrimSeq in previously unseen stroke patients with a range of upper extremity motor impairment. We expect that these advances will support the rigorous measurement required for quantitative dosing trials in stroke rehabilitation.
BibTeX
@inproceedings{parnandi2022primseq,
  author = {Avinash Parnandi and Aakash Kaku and Anita Venkatesan and Natasha Pandit and Audre Wirtanen and Haresh Rajamohan and Kannan Venkataramanan and Dawn Nilsen and Carlos Fernandez-Granda and Heidi Schambra},
  title = {{PrimSeq: a deep learning-based pipeline to quantitate rehabilitation training}},
  booktitle = {PLOS},
  year = {2022},
  doi = {10.1371/journal.pdig.0000044},
}
Figure