Abstract
Advances in deep learning for human activity recognition (HAR) have been relatively limited due to the lack of large labelled datasets. In this study, we leverage self-supervised learning (SSL) techniques on the UK-Biobank activity tracker dataset—the largest of its kind to date—containing more than 700,000 person-days of unlabelled wearable sensor data. Our resulting activity recognition model consistently outperformed strong baselines across seven benchmark datasets, with an F1 relative improvement of 2.5%-100% (median 18.4%), the largest improvements occurring in the smaller datasets. In contrast to previous studies, our results generalise across external datasets, devices, and environments. Our open-source model will help researchers and developers to build customisable and generalisable activity classifiers with high performance.
Introduction: The Bottleneck of Labeled Data
Deep learning has transformed fields like computer vision and natural language processing by utilizing massive datasets. However, Human Activity Recognition (HAR) has historically struggled with a "small data" problem. While wearable sensors like accelerometers are ubiquitous, obtaining high-quality labels (e.g., "walking" vs. "running") is labor-intensive, often requiring synchronized video recording and manual annotation. Consequently, most HAR models are trained on small, laboratory-based datasets that fail to capture the complexity of real-world movement.
To address this, we explore whether the vast quantities of unlabelled data already collected by wearable devices can be used to build more robust models. By employing self-supervised learning, we can train models on unlabelled data before fine-tuning them on specific, smaller labeled tasks.
Methodology: Learning from Temporal Distortions
We utilized a ResNet-V2 architecture and trained it on the UK-Biobank (UKB) dataset, which includes approximately 6 billion samples from 100,000 participants. The model was trained to solve three "pretext tasks" where the labels are automatically derived from the data itself:
- Arrow of Time (AoT): Predicting if a signal is playing forward or in reverse.
- Permutation: Predicting if segments of a signal have been shuffled.
- Time-Warping (TW): Detecting if segments of the signal have been artificially sped up or slowed down.
A critical component of our approach was weighted sampling. Because real-world data is often dominated by sedentary periods (like sleep), we sampled data windows proportional to their standard deviation. This forced the model to focus on high-movement periods where the temporal distortions provided a meaningful challenge, significantly improving downstream performance.
Key Results and Generalization
The SSL-pretrained model was evaluated against seven diverse benchmark datasets, including Capture-24 and Rowlands. The results were striking: the model achieved a median F1-score improvement of 18.4% over strong baselines like Random Forests and supervised ResNets trained from scratch.
The most significant gains were observed in smaller datasets, suggesting that SSL effectively acts as a "small data lifesaver." Furthermore, the model demonstrated remarkable generalization, maintaining high performance across different devices, populations, and environments—a significant step toward a "foundation model" for wearable technology.
Visualizing the Learned Feature Space
To understand what the model learned during pre-training, we used UMAP visualizations to map the high-dimensional features into a 2D space. Even before seeing a single human-provided label, the SSL model naturally learned to cluster activities by intensity.
As shown above, while raw input data is disorganized, the SSL-pre-trained features clearly separate activities like "lying down" from high-intensity movements like "running." This indicates that the pretext tasks successfully taught the model the underlying structure of human motion.
Conclusion and Future Directions
This study demonstrates that self-supervised learning on massive unlabelled datasets can overcome the data scarcity issues in HAR. While the current model is highly effective, future work should address demographic biases—as the UK-Biobank is primarily Caucasian—and explore multi-modal data, such as combining accelerometer data with heart rate sensors. By open-sourcing this model, we aim to provide a foundation for more accurate and generalizable activity recognition in health research and consumer technology.
Summary updated