Introduction
Human Activity Recognition (HAR) using wearable sensors—such as those found in smartphones and smartwatches—has become a cornerstone of mobile health and fitness tracking. Traditionally, developing robust HAR models requires large-scale, manually labeled datasets. However, while raw sensor data is abundant, high-quality labels are expensive and difficult to obtain. This paper explores the application of Contrastive Predictive Coding (CPC) to HAR, demonstrating that self-supervised learning can extract powerful movement representations from unlabeled data, significantly reducing the reliance on human annotation.
The Problem: The Labeling Bottleneck
The standard supervised learning workflow in HAR involves recording sensor data and having humans painstakingly label every segment. This process is not only time-consuming but also prone to errors and difficult to scale across diverse populations. Existing unsupervised alternatives, such as Autoencoders, typically focus on signal reconstruction. The authors argue that reconstruction-based methods often waste model capacity on "local noise"—fine-grained signal fluctuations that do not contribute to recognizing the underlying activity. To be effective, a model must instead capture the long-term temporal structure of human movement.
Methodology: Contrastive Predictive Coding
The authors adapt the CPC framework for multi-channel sensor data, including accelerometers and gyroscopes. The methodology consists of two distinct phases:
1. Self-Supervised Pre-training
The model learns to extract features without any labels by solving a "pretext task":
- Encoder ($g_{enc}$): A 1D Convolutional Neural Network (CNN) maps windows of raw sensor data into a latent space ($z_t$).
- Autoregressive Model ($g_{ar}$): A Gated Recurrent Unit (GRU) summarizes a sequence of these latent representations into a context vector ($c_t$).
- The Contrastive Task: The model is tasked with predicting future latent representations ($z_{t+k}$) based on the current context ($c_t$). Rather than predicting exact values, it uses Noise Contrastive Estimation (NCE). The model must identify the "correct" future sample from a set of "distractor" samples taken from different time steps or users.
2. Downstream Classification
Once pre-trained, the encoder and autoregressive weights are frozen. A small Multi-Layer Perceptron (MLP) is then trained on top of these representations using a limited amount of labeled data to perform the final activity classification.
Experimental Setup and Datasets
The framework was evaluated across four benchmark datasets to ensure generalizability:
- Mobiact: 61 users performing 11 activities, including falls.
- Motionsense: 24 users performing 6 activities.
- UCI-HAR: 30 users performing 6 activities with waist-mounted sensors.
- USC-HAD: 14 users performing 12 activities using high-fidelity sensing platforms.
Key Insights
The Importance of the "Far" Future
A critical finding was that predicting only the immediate next timestep is insufficient. Because sensor signals are locally smooth, the next step is too easy to guess. Predicting multiple steps ahead (approximately 400ms) forces the model to infer the global structure of the movement, resulting in more robust features.
Avoiding the Trivial Task Trap
The authors noted that if the encoder’s receptive field is too large, the "future" the model tries to predict might overlap with the data the encoder has already processed. This makes the task trivial and prevents the model from learning useful patterns. Shorter kernel sizes (3 or 5) were found to be optimal for maintaining the difficulty of the pretext task.
Efficiency in Low-Data Regimes
Perhaps the most significant result is CPC’s performance when labeled data is extremely scarce. CPC-trained models using only 10 labeled samples per class frequently outperformed fully supervised models (like DeepConvLSTM) trained on much larger datasets.
Results and Discussion
CPC consistently outperformed previous state-of-the-art unsupervised methods. For instance, on the Motionsense dataset, CPC achieved an F1-score of 89.05%, compared to 82.50% for a standard Autoencoder. Furthermore, on the USC-HAD dataset, the CPC-based approach (52.01% F1) significantly surpassed the supervised DeepConvLSTM baseline (44.83% F1).
Beyond raw accuracy, CPC demonstrated greater robustness. The models showed narrower confidence intervals compared to supervised baselines, suggesting that self-supervised pre-training helps the system better handle the inherent variability in how different individuals perform the same activity.
Limitations and Future Directions
While promising, the study primarily focused on smartphone-based HAR (pocket or waist placement). Since sensor signals vary drastically depending on body location (e.g., wrist vs. ankle), future research must explore how these representations transfer across different placements. Additionally, the authors suggest leveraging "virtual" sensor data—derived from video or motion capture—to pre-train models before deploying them on wearable hardware. Finally, scaling this approach to massive datasets like the UK Biobank could lead to the development of "universal" movement representations.
Summary updated