Human Activity Recognition Using STFT and Attention-Enhanced 2D-CNN on Smartphone and Wearable Sensors
Peichen Jin, Chuanzhi Zang · 2025
Traditional Human Activity Recognition (HAR) approaches often rely on handcrafted features and incomplete feature extraction, limiting their effectiveness. To address these challenges, we propose a 2D Convolutional Neural Network (2D-CNN) model with an attention mechanism, incorporating Short-Time Fourier Transform (STFT) to convert raw time-series sensor data into time-frequency representations, enabling richer spatiotemporal feature extraction. The 2D-CNN is designed to capture hierarchical patterns, while the Triplet Attention mechanism learns cross-dimensional dependencies. The proposed framework is evaluated on three widely used HAR datasets, WISDM, UCI-HAR, and PAMAP2, achieving classification accuracies of 96.65%, 96.3%, and 97.32%. Experimental results demonstrate that our method outperforms existing deep learning models, delivering improved recognition accuracy and robustness across diverse activities.