Inspiration
People with Parkinson's can suddenly get "stuck" while walking. The feet feel glued to the floor, often at a doorway or when turning. This is called freezing of gait (FoG), and it is a big cause of falls. A simple rhythmic beat can help them start walking again, but only if it plays at the right moment. Nobody can watch a patient all day, so I wanted a wearable that notices the freeze by itself.
My final year project detects machine faults from vibration sensors. Freezing also shows up as a change in frequency: normal steps are around 0.5–3 Hz, and freezing looks like trembling at 3–8 Hz. So I reused my FYP pipeline on human gait.
What it does
ThawStep takes accelerometer data from the ankle, thigh and trunk. Every 0.5 s it looks at the last 4 s and decides if the patient is freezing. If it is, it raises an alarm so a cue (a beat) can be played. It has two modes:
- Detect: is the patient freezing now?
- Warn: will the patient freeze in the next 3 s?
The live demo replays real patients the model never saw and shows the alarm as it happens.
How I built it
- Data: Daphnet Freezing of Gait dataset. 10 patients, 3 accelerometers, 64 Hz, 237 freeze episodes labelled from video.
- Features: 12 features per axis (RMS, peak, kurtosis, spectral centroid, band powers, ...), including the Freeze Index:
$$\text{FI} = \frac{P_{3\text{–}8\,\text{Hz}}}{P_{0.5\text{–}3\,\text{Hz}}}$$
- Model: Random Forest. An alarm needs 2 positive windows in a row, and alarms less than 5 s apart count as one cue.
- Explainability: SHAP shows the Freeze Index features from the ankle drive most decisions.
- Demo: Streamlit app with a replay, a clinician summary and all the evaluation results.
Evaluation
- Split: leave-one-subject-out. Train on 9 patients, test on the 10th, and repeat for all 10. Windows overlap, so a random split would leak the same seconds into both training and test.
- Threshold: picked only on the training patients (inner 3-fold CV), with a clinical rule: catch as many freezes as possible while at least 70% of alarms are real freezes. A false cue is a few seconds of beat, but a missed freeze can be a fall.
- Baseline: the Freeze Index threshold method from Bächlin et al. (2010), tuned with the same rule.
- Metrics: share of freeze episodes caught, share of alarms that were real, alarm time vs freeze onset (s), false alarms per hour, and a 95% CI by bootstrapping over patients.
| Setup | Freezes caught | Alarms real | Alarm vs onset |
|---|---|---|---|
| ThawStep, detect, 3 sensors | 176/237 (74%, CI 55–85%) | 72% | +0.6 s |
| ThawStep, detect, ankle only | 130/237 (55%) | 73% | +0.9 s |
| Freeze Index baseline | 27/237 (11%) | 53% | +4.5 s |
| ThawStep, warn 3 s ahead | 87/237 (37%) | 36% | 5.6 s before |
AUROC per window was 0.90 for ThawStep vs 0.76 for the baseline.
What it means: ThawStep catches about 3 out of 4 freezes within a second of them starting, and 7× more than the standard method. Early warning is not good enough yet: only about a third of warnings were real.
Where it stops being useful:
- Short freezes under 3 s: only 44% caught, compared with 85–91% for longer ones.
- Some patients: S02 had only 25% caught.
- Anything outside a lab, which it was never tested on.
Who benefits, and who could be harmed
- Benefits: patients (fewer falls, more confidence walking), carers, and physios, who get a real count of freezes instead of guessing.
- Missed freeze: a patient who trusts the device and still freezes could fall. 26% of freezes were missed.
- False alarms: about 13 per hour in this lab setting. That could be annoying enough that people stop wearing it.
- Not representative: only 10 patients, so it may work worse for people unlike them (different age, disease stage, walking aids).
Challenges
- My first alarm rule (at most 2 false alarms per hour) only caught 13% of freezes. The lab protocol triggers about 40 freezes per hour, so I switched to the "70% of alarms must be real" rule.
- I didn't want leakage. Overlapping windows plus a random split would have given fake high scores, so everything is per patient.
- Early warning was much harder than detection. I kept it in and reported it honestly.
What I learned
- How a good evaluation changes the story: per-window accuracy looked fine, but per-episode results showed what actually matters.
- Signal-processing ideas from machines carry over to the human body surprisingly well.
- Being honest about failure cases is part of the result.
Limitations
- Only 10 patients, recorded in a lab with set walking tasks. It is not tested at home.
- Freeze start and end come from video labels, which are a bit subjective.
- Compute is 14 ms per decision on a laptop, but the full model is about 20 MB, so it needs shrinking for a real wearable.
- Research prototype, not a medical device.
With another month
- Test on a bigger dataset recorded at home.
- Shrink the ankle-only model and run it on an ESP32 + MPU-6050 (my FYP hardware), with a real vibration or audio cue.
- Personalise the threshold per patient after a short calibration walk.
- Talk to physiotherapists about what false-alarm rate patients would accept.
Attribution
- Dataset: Daphnet Freezing of Gait, UCI ML Repository (CC BY 4.0). Roggen, Plotnik & Hausdorff (2010). https://doi.org/10.24432/C56K78
- Freeze Index baseline: Bächlin et al. (2010), IEEE Trans. Inf. Technol. Biomed. 14(2), 436–446. https://doi.org/10.1109/TITB.2009.2036165
- Evaluation pitfalls: Basaklar, Tuncel & Ogras, Subject-independent freezing of gait prediction in Parkinson's disease patients.
- Libraries: scikit-learn, SHAP, NumPy, pandas, SciPy, Matplotlib, Streamlit, Altair.
- Code scaffolding and visuals were made with help from Claude (Anthropic). Pipeline design is adapted from my own FYP.
Built With
- matplotlib
- numpy
- pandas
- python
- scikit-learn