UbiComp/ISWC 2021 Activity RecognitionUbiquitous Computing

Classical Machine Learning Approach for Human Activity Recognition Using Location Data

Safaeid Hossain Arib, Rabeya Akter, Omar Shahid, Md Atiqur Rahman Ahad

UbiComp/ISWC '21 Adjunct: Adjunct Proceedings of the 2021 ACM International Joint Conference on Pervasive and Ubiquitous Computing and the 2021 ACM International Symposium on Wearable Computers

TL;DR

Can a phone tell whether you are walking, cycling, or on a train from location data alone? A carefully engineered classical pipeline gets close to 80%.

  • 78.14%validation accuracy
  • 78.28%weighted F1 score
  • 8locomotion and transportation modes
  • 11thplace in the SHL Challenge 2021
Overview figure for Classical Machine Learning Approach for Human Activity Recognition Using Location Data
Block diagram of our method. Location data is cleaned, label-matched and windowed, and statistical features train a classifier. At test time, missing location data is interpolated before prediction.

Abstract

The Sussex-Huawei Locomotion-Transportation (SHL) recognition Challenge 2021 was a competition to classify 8 different activities and modes of locomotion performed by three individual users. There were four different modalities of data (Location, GPS, WiFi, and Cells) which were recorded from the phones of the users in their hip position. The train set came from user-1 and the validation set and test set were from user-2 and user-3. Our team 'GPU Kaj Kore Na' used only location modality to give our predictions in test set of this year's competition as location data was giving more accurate predictions and the rest of the modalities were too noisy as well as not contributing much to increase the accuracy. In our method, we used statistical feature set for feature extraction and Random Forest classifier to give prediction. We got validation accuracy of 78.138% and a weighted F1 score of 78.28% on the SHL Validation Set 2021.

The challenge

SHL Recognition Challenge 2021

The task was to recognize eight modes of locomotion and transportation, namely Still, Walking, Run, Bike, Car, Bus, Train and Subway, using only radio data from a phone carried at the hip. That data included GPS reception, GPS location, WiFi scans and GSM cell-tower scans.

  • Cross-user split. Training data came from one user over 59 days, and validation and test data from two different users.
  • Messy sensing. Sensors were sampled asynchronously at roughly 1 Hz, often dropped out, and some test timestamps had no sensor data at all.
  • Class imbalance. Some activities, such as Run, had very few training examples.

Method

Clean, window, featurize, classify

  1. Label matchingEach sensor reading at time \(s\) takes the label of the label-file timestamp \(t\) with \(t \le s < t+1\). Unmatched readings are dropped.
  2. Motion featuresHaversine distance and average speed between consecutive location fixes turn raw coordinates into movement.
  3. Windowed statisticsWindows of 30 samples with no overlap yield 14 statistics per signal, from min, max and variance to autocorrelation and mean-crossing rate.
  4. Classify and fill gapsA 300-tree random forest predicts each window. Timestamps without location data are filled by interpolation.
\[ d = 2r \arcsin \sqrt{\sin^2\!\Big(\frac{\alpha_2 - \alpha_1}{2}\Big) + \cos\alpha_1 \cos\alpha_2 \sin^2\!\Big(\frac{\beta_2 - \beta_1}{2}\Big)}, \qquad \text{speed} = \frac{d}{\Delta t} \]

Here \(\alpha\) and \(\beta\) are latitude and longitude in radians.

Results

Validation accuracy by modality

ModalityAccuracy
WiFi30.99%
GPS32.97%
GPS + Location75.56%
Location78.14%

Location alone was the strongest signal. Adding GPS made it slightly worse, and WiFi and GPS on their own were too noisy to help, so the final submission used location data only.

Confusion matrix over eight activities using location data
Confusion matrix using location data. Still, Walking, Car and Subway are recognized well. Run, which has the least training data, is weakest (F1 about 36%), and Bus and Train are often confused with Car.

Takeaways

Class imbalance biased the model toward frequent activities, and up-sampling did not fix it. Richer, more general features from the WiFi, cell and GPS streams, or a deep-learning model, could improve recognition of the rare classes further.

Citation

@inproceedings{arib2021classical,
  title     = {Classical Machine Learning Approach for Human Activity Recognition Using Location Data},
  author    = {Arib, Safaeid Hossain and Akter, Rabeya and Shahid, Omar and Ahad, Md Atiqur Rahman},
  booktitle = {Adjunct Proceedings of the 2021 ACM International Joint Conference on Pervasive and
               Ubiquitous Computing and Proceedings of the 2021 ACM International Symposium on
               Wearable Computers},
  year      = {2021},
  doi       = {10.1145/3460418.3479376}
}