Temporal Pooling in Consumer-Grade Wearable Human Activity Recognition: Robustness Evaluation under Signal Contamination
This repository implements the methodology proposed in the paper "Temporal Pooling in Consumer-Grade Wearable Human Activity Recognition: Robustness Evaluation under Signal Contamination".
Abstract: In consumer wearable applications, Human Activity Recognition (HAR) systems frequently encounter abrupt signal variations caused by rapid behavioral shifts, which can degrade performance and lead to inconsistent user experience. However, evaluating model robustness in these transitional phases is challenging because natural transitions, despite their real-world representativeness, often suffer from inherent label ambiguity that precludes the precise ground truth required for structural benchmarking. To address this, we present a synthetic transition stress-test framework for rigorous robustness analysis. This protocol introduces controlled signal contamination to simulate severe activity mixtures, providing a label-noisefree diagnostic tool for the quantitative validation of temporal pooling mechanisms. Using this framework, we evaluate our proposed Temporal Pooling Attention (TPA) and its hybrid variant, Gated-TPA. Our experiments characterize the distinct roles of each pooling strategy: the proposed TPA acts as a specialized filter that consistently enhances robustness against intruder signals at contaminated boundaries, whereas standard Global Average Pooling (GAP) remains a competitive choice for synchronized, steady-state segments, a finding further supported by qualitative analysis of real-world transitions. These findings provide a practical guideline for designing robust consumer HAR systems, suggesting that adaptive pooling strategies can effectively contribute to maintaining robustness under the erratic usage patterns typical of real-world deployments.
- UCI-HAR dataset is available at https://archive.ics.uci.edu/dataset/240/human+activity+recognition+using+smartphones
- PAMAP2 dataset is available at https://archive.ics.uci.edu/dataset/231/pamap2+physical+activity+monitoring
- WISDM dataset is available at https://www.cis.fordham.edu/wisdm/dataset.php
torch==2.8.0
numpy==2.0.2
pandas==2.2.2
scikit-learn==1.6.1
To install all required packages:
pip install -r requirements.txt
-
models/tpa_module.py- Implementation of the core Temporal Prototype Attention (TPA) module. -
models/cnn_tpa_models.py- CNN Backbone Models. This file defines theMultiPathCNN(a multi-scale temporal feature extractor) and three classification models based on a Backbone-Head Architecture:GAPModel(CNN+GAP),TPAModel(CNN+TPA), andGatedTPAModel(CNN+Gated-TPA). -
models/lstm_tpa_models.py- LSTM Backbone Models. This file defines theBiLSTMBackbone(bidirectional LSTM) and the corresponding three classification models based on a Backbone-Head Architecture. -
models/transformer_tpa_models.py- Transformer Backbone Models. This file defines theTransformerBackbone(Transformer Encoder with Positional Encoding) and the corresponding three classification models based on a Backbone-Head Architecture. -
transition_generator.py- Synthetic Transition Augmentation. Implements the generation of activity transition windows by concatenating segments from two different classes ($X_A$ and$X_B$ ) based on specific mixing ratios (e.g., 0.1, 0.2) -
perturbations.py- Data Perturbation. Provides various methods to apply synthetic variations to time-series data, including temporal scaling, additive Gaussian noise, bias drift, and multiplicative scale drift.
If you use this code in your research, please cite:
@article{Temporal Pooling in Consumer-Grade Wearable Human Activity Recognition: Robustness Evaluation under Signal Contamination,
title = {Temporal Pooling in Consumer-Grade Wearable Human Activity Recognition: Robustness Evaluation under Signal Contamination},
author={Dahyun Kang and Myung-Kyu Yi}
journal={},
volume={},
Issue={},
pages={},
year={}
publisher={}
}
For questions or issues, please contact:
- Dahyun Kang : dadang6842@gmail.com
This project is licensed under the MIT License - see the LICENSE file for details.