Abstract
Human Activity Recognition (HAR) is essential for applications such as healthcare monitoring, fitness tracking, and smart environments, yet deploying accurate and interpretable models on resource-constrained devices remains challenging. In this paper, we propose XTinyHAR, a lightweight, transformer-based unimodal framework trained via cross-modal knowledge distillation from a multimodal teacher. Our model incorporates temporal positional embeddings and attention rollout to enhance sequential feature extraction and interpretability. Evaluated on UTD-MHAD and MM-Fit datasets, XTinyHAR achieves state-of-the-art performance with test accuracies of 98.71% and 98.55%, F1-scores of 98.71% and 98.55%, and Cohen’s Kappa scores above 0.98, while maintaining a compact footprint of 2.45 MB, fast inference latency (3.1 ms CPU, 1.2 ms GPU), and low computational cost (11.3M FLOPs). Extensive ablation studies confirm the contribution of each component, and subject-wise evaluations demonstrate strong generalization across users. These results highlight XTinyHAR’s potential as a high-performance, interpretable, and deployable solution for real-time HAR on edge devices.
Introduction
Human Activity Recognition (HAR) serves as the foundation for modern fitness trackers, elderly care systems, and smart environments. Despite its importance, the field faces a significant "trilemma": balancing high accuracy with low resource consumption while maintaining model explainability. Traditional high-performance models often rely on multimodal data (e.g., video or skeleton tracking), which are privacy-invasive and power-hungry. Conversely, lightweight models suitable for wearable devices often sacrifice accuracy or operate as "black boxes," providing no insight into their decision-making process.
To address these challenges, we introduce XTinyHAR, a lightweight Transformer-based model designed to deliver state-of-the-art performance using only simple inertial sensor data.
Methodology: The Teacher-Student Framework
The core innovation of XTinyHAR lies in its specialized architecture and training regime, which leverages cross-modal knowledge distillation (KD).
Cross-Modal Knowledge Distillation
During the training phase, a complex "Teacher" model—the Spatio-Temporal ConvTransformer (ST-ConvT)—is utilized. This teacher processes both skeleton data (derived from cameras) and inertial data (from IMUs). Through distillation, the teacher transfers its rich understanding of human physical dynamics to a "Student" model: the Inertial Transformer (IT). At inference time, the student model operates independently, requiring only inertial data to maintain high-tier accuracy.
Inertial Transformer (IT) Architecture
Inspired by Vision Transformers (ViT), the IT treats 1D sensor signals as discrete "patches." It employs temporal positional embeddings to preserve the sequence of motion and a multi-head self-attention mechanism to capture long-range dependencies within movements. By dividing continuous sensor data into dynamic patches, the model focuses on "motion peaks," significantly reducing computational redundancy.
Explainable AI (XAI)
XTinyHAR integrates an XAI suite, including Integrated Gradients and Attention Rollout. These tools allow researchers to visualize which sensor axes and specific moments in time most heavily influenced a classification, bridging the gap between performance and interpretability.
Experimental Evaluation
The model was validated on two diverse benchmarks:
- UTD-MHAD: A controlled dataset featuring 27 actions performed by 8 subjects, providing synchronized skeleton and IMU data.
- MM-Fit: A large-scale, unconstrained fitness dataset with over 70 participants performing 12 distinct exercises, representing noisy, real-world gym environments.
Results and Discussion
XTinyHAR establishes a new state-of-the-art for "TinyML" in the HAR domain:
- Performance: The model achieved 98.71% accuracy on UTD-MHAD and 98.55% on MM-Fit, outperforming significantly larger hybrid CNN-LSTM architectures.
- Efficiency: With a model size of only 2.45 MB and a memory footprint of 7.2 MB, XTinyHAR is ideal for edge deployment. On a Raspberry Pi 4B, inference takes just 3.1 ms, consuming only 1.8 mJ of energy.
- Generalization: Subject-wise evaluations showed minimal variance (std dev ~0.54%), indicating robust performance across different body types without the need for per-user calibration.
Ablation studies confirmed that the cross-modal knowledge distillation is the critical component for this high performance; removing it resulted in a significant drop in accuracy.
Conclusion and Future Work
XTinyHAR demonstrates that it is possible to achieve high-performance, interpretable activity recognition on resource-constrained devices. Future work will focus on personalizing the model through on-device fine-tuning and expanding the framework to support multi-device data fusion while maintaining energy efficiency.
Summary updated