Git Product home page Git Product logo

activity-recognition-with-sensor-data's Introduction

Human Activity Recognition (HAR) using LSTM RNNs on accelerometer and gyroscopic data

This repository shows how to classify human activities from sequences of accelerometer and gyroscopic data from a smartphone using various types of Long Short-Term Memory (LSTM) recurrent neural networks.

Get the data

The dataset can be downloaded from Human Activity Recognition Using Smartphones Data Set, UCI Machine Learning Repository

Click here for the direct link: UCI HAR Dataset.zip

Unzip all files into a new directory in your current working directory. You should have a folder titled UCI HAR Dataset.

Download the uci_har.py and models.py files from this repository and move them into the directory containing the UCI HAR Dataset folder.

Usage

The models.py contains implementations of a standard LSTM, a Convolutional Neural Network (CNN) that feeds into an LSTM, and a Convolutional LSTM. The difference between the CNN-LSTM and the ConvLSTM is that the CNN-LSTM uses CNN layers for feature extraction on input data and feeds the extracted features into an LSTM layer to support sequence prediction, while the ConvLSTM uses convolutions directly as part of reading input into the LSTM units themselves.

Change the model_type on line 74 in uci_har.py to 'lstm', 'cnnlstm', or 'convlstm' and run the program. You should see an output similar to the following:

Using TensorFlow backend.
X train shape: (7352, 128, 9), y train shape: (7352, 1)
X test shape: (2947, 128, 9), y test shape: (2947, 1)
After one hot encoding, X train shape: (7352, 128, 9), y train shape: (7352, 6), X test shape: (2947, 128, 9), y test shape: (2947, 6)
Using LSTM
Accuracy: 0.9006

Change the number of lstm units, number of dense units, number of filters, and sizes of filters in the models.py file to experiment with various model architectures, and change the number of epochs, batch size, n_steps, and n_length in the uci_har.py file to experiment with various training configurations.

activity-recognition-with-sensor-data's People

Contributors

austinjtaylor avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.