This repository contains the complete training and embedded-inference workflow for a locomotion mode/walking terrain classifier using microcontrollers and lower-limb resistive strain sensors.
The repository covers dataset construction, Leave-One-Subject-Out (LOSO) evaluation, CNN training, INT8 quantization, and real-time deployment using TensorFlow Lite Micro on ESP32-S3. It is structured to separate model development from embedded execution.
├── embedded/
├── training_pipeline/
├ methodology
├ README
- Dataset construction and segmentation
- LOSO evaluation for subject-independent validation
- CNN training and hyperparameter study
- Full INT8 TFLite conversion
- Embedded inference on ESP32-S3
All experimental design details and justification are provided in the accompanying paper.
The notebooks implement:
• Controlled window/stride segmentation
• Segment-wise dataset integrity checks
• LOSO protocol
• Data augmentation
• CNN training
• TFLite INT8 conversion
• Metric aggregation and confusion matrices
Execute notebooks sequentially.
Two firmware variants are provided:
locomotion_mode_sim
Replays recorded data for verification and latency measurement.
locomotion_mode_actualTest
Runs live inference using ADC inputs (analogRead()), applying the quantization scale and zero values from training.
Both variants use the Chirale_TensorFlowLite library (https://github.com/spaziochirale/Chirale_TensorFlowLite).
ESP32-S3 (should work in other capable MCUs too)
TensorFlow Lite Micro
INT8 quantized CNN
Operator set is restricted to TFLM built-ins compatible with MCU deployment.
This repository is intended for research reproducibility and embedded ML demonstration. It is not packaged as a general-purpose framework.
For methodological rationale and experimental interpretation, refer to the paper: https://ieeexplore.ieee.org/document/11640360