Skip to content

Human Activity Recognition on the Wireless Sensor Data Mining (WISDM) dataset using LSTM Recurrent Neural Networks

Notifications You must be signed in to change notification settings

bartkowiaktomasz/har-wisdm-lstm-rnns

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Human Activity Recognition on the Wireless Sensor Data Mining (WISDM) dataset using LSTM Recurrent Neural Networks

This repository cotains code used to recognize human activity based on the Wireless Sensor Data Mining (WISDM) dataset using LSTM (Long short-term memory) and is heavily based on the article by Venelin Valkov.

This repository contains an improved version of the model, where Bidirectional LSTM is used with Bayesian Optimization to find optimal architecture.

Dataset

The data used for classification is provided by the Wireless Sensor Data Mining (WISDM) Lab and can be downloaded here. It consists of 1,098,207 examples of various physical activities (sampled at 20Hz) with 6 attributes: user,activity,timestamp,x-acceleration,y-acceleration,z-acceleration, and the activities include: Walking, Jogging, Upstairs, Downstairs, Sitting, Standing. X acceleration for Jogging

Original research done on this dataset can be found here.

Data preprocessing

The following graph shows how the x-acceleration was changing with time (or more accurately - at each timestep) for Jogging. X acceleration for Jogging In order to feed the network with such temporal dependencies a sliding time window is used to extract separate data segments. The window width and the step size can be both adjusted and optimised for better accuracy. Each time step is associated with an activity label, so for each segment the most frequently appearing label is chosen. Here, the time segment or window width is chosen to be 200 and time step is chosen to be 100.

Input:

  • data (data/WISDM_ar_v1.1_raw.txt)

The data needs to be separated into features and labels and then further into training and test sets. Labels need to be one-hot encoded before feeding into the classifier.

Output:

  • Trained classifier
  • Confusion matrix graph
  • Error/Accuracy rate graph

LSTMs

Long short-term memory (LSTM) Recurrent Neural Networks (RNNs) are used to model temporal data (i.e. speech recognition, NLP, human activity recognition), where there is a need to keep some state information. More info on LSTMs can be found here.

Results

The classifier achieves the accuracy of 94%, though it might presumably be slightly improved by decreasing the step size of sliding window. The following graphs show the train/test error/accuracy for each epoch and the final confusion matrix (normalised so that each row sums to one). Train/test set accuracy/error Confusion matrix

Dependencies

  • matplotlib 1.5.3
  • seaborn 0.8.1
  • numpy 1.14
  • pandas 0.20.3
  • scikit-learn 0.19.1
  • tensorflow 1.5.0

Use

  1. Run the script with python3 HAR_Recognition.py

About

Human Activity Recognition on the Wireless Sensor Data Mining (WISDM) dataset using LSTM Recurrent Neural Networks

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages