Motion-Derived Context in Transformer-Based Human Activity Recognition: Activity-Level Effects and Subject-Partition Robustness
Moeiz Miraoui, Majdi AbdellatiefTransformer-based human activity recognition (HAR) has shown promise for modeling inertial sensor sequences; however, the conditions under which engineered motion-derived features improve recognition, and whether adaptive integration provides advantages over direct feature augmentation, remain insufficiently understood. This study presents a controlled empirical evaluation of motion-derived contextual augmentation using the UCI HAR and WISDM datasets. Raw-signal, motion-augmented, and adaptively gated Transformers are compared against a zero-context control, a one-dimensional convolutional neural network, and a Random Forest classifier. The primary evaluation employs subject-disjoint data partitions, 15 matched training seeds, and paired statistical comparisons, with macro-F1 as the principal performance metric. On UCI HAR, the convolutional network achieves the highest mean macro-F1 (0.9124), whereas the gated Transformer obtains 0.8969 without a statistically significant improvement over the raw-signal configuration. On WISDM, direct motion augmentation increases Transformer macro-F1 from 0.6269 to 0.6678, while adaptive gating reaches 0.6706; the difference between the two contextual configurations is not statistically significant. Random Forest achieves the highest WISDM macro-F1 (0.7481). Additional activity-level analysis reveals heterogeneous effects, including improvements in Downstairs and Jogging recognition but reduced performance for Sitting. A classifier trained exclusively on 12 motion descriptors achieves a macro-F1 of 0.6593, although exploratory analysis does not establish a significant association between feature separability and contextual gains. A supplementary robustness experiment involving five subject-disjoint partitions and three training seeds per partition finds positive mean motion-augmentation gains in all five partitions, averaging 0.0376 macro-F1 points, with substantial variation across partitions. Overall, the findings demonstrate that motion-derived augmentation can improve Transformer-based HAR under the evaluated WISDM conditions, but its benefits are activity-dependent, and adaptive gating does not demonstrate a reliable advantage over direct augmentation. The study highlights the importance of competitive baselines, subject-partition robustness, and transparent evaluation when assessing contextual representations for HAR.