All Projects → ItsSiddharth → Human_Activity_Recognition

ItsSiddharth / Human_Activity_Recognition

Licence: MIT license
A new and computationally cheap method to perform human activity recognition using PoseNet and LSTM. Where we use PoseNet for Preprocessing and LSTM for understand the sequence.

Programming Languages

Jupyter Notebook
11667 projects
python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Human Activity Recognition

Lstm anomaly thesis
Anomaly detection for temporal data using LSTMs
Stars: ✭ 178 (+612%)
Mutual labels:  time-series, lstm-neural-networks
Robust-Deep-Learning-Pipeline
Deep Convolutional Bidirectional LSTM for Complex Activity Recognition with Missing Data. Human Activity Recognition Challenge. Springer SIST (2020)
Stars: ✭ 20 (-20%)
Mutual labels:  time-series, human-activity-recognition
Awesome-Human-Activity-Recognition
An up-to-date & curated list of Awesome IMU-based Human Activity Recognition(Ubiquitous Computing) papers, methods & resources. Please note that most of the collections of researches are mainly based on IMU data.
Stars: ✭ 72 (+188%)
Mutual labels:  time-series, human-activity-recognition
Deep Learning Time Series
List of papers, code and experiments using deep learning for time series forecasting
Stars: ✭ 796 (+3084%)
Mutual labels:  time-series, lstm-neural-networks
dana
DANA: Dimension-Adaptive Neural Architecture (UbiComp'21)( ACM IMWUT)
Stars: ✭ 28 (+12%)
Mutual labels:  time-series, human-activity-recognition
tsmp
R Functions implementing UCR Matrix Profile Algorithm
Stars: ✭ 63 (+152%)
Mutual labels:  time-series
P4J
Periodic time series analysis tools based on information theory
Stars: ✭ 42 (+68%)
Mutual labels:  time-series
json-caching-proxy
Node caching HTTP proxy built on top of express-http-proxy. Persists requests and responses to an in-memory HAR-like data structure based on HAR1.2 . Caches JSON content-type responses by default with the ability to cache an entire site; including content-types describing images. Useful for testing front end code, mocking api, and saving the cac…
Stars: ✭ 31 (+24%)
Mutual labels:  har
talaria
TalariaDB is a distributed, highly available, and low latency time-series database for Presto
Stars: ✭ 148 (+492%)
Mutual labels:  time-series
ECGClassifier
CNN, RNN, and Bayesian NN classification for ECG time-series (using TensorFlow in Swift and Python)
Stars: ✭ 53 (+112%)
Mutual labels:  time-series
time-series-labs
Hands-on training labs for Deep Learning in Time Series course by CERTIFAI
Stars: ✭ 17 (-32%)
Mutual labels:  time-series
Deep-Learning-Coursera
Projects from the Deep Learning Specialization from deeplearning.ai provided by Coursera
Stars: ✭ 123 (+392%)
Mutual labels:  lstm-neural-networks
Deep-Drug-Coder
A tensorflow.keras generative neural network for de novo drug design, first-authored in Nature Machine Intelligence while working at AstraZeneca.
Stars: ✭ 143 (+472%)
Mutual labels:  lstm-neural-networks
Sequence-to-Sequence-Learning-of-Financial-Time-Series-in-Algorithmic-Trading
My bachelor's thesis—analyzing the application of LSTM-based RNNs on financial markets. 🤓
Stars: ✭ 64 (+156%)
Mutual labels:  lstm-neural-networks
xephon-k
A time series database prototype with multiple backends
Stars: ✭ 22 (-12%)
Mutual labels:  time-series
stock-market-scraper
Scraps historical stock market data from Yahoo Finance (https://finance.yahoo.com/)
Stars: ✭ 110 (+340%)
Mutual labels:  lstm-neural-networks
QuickNotes
一款简单、轻量、高效的Android记事、记账应用
Stars: ✭ 19 (-24%)
Mutual labels:  lite
ctsa
A Univariate Time Series Analysis and ARIMA Modeling Package in ANSI C. Updated with SARIMAX and Auto ARIMA.
Stars: ✭ 38 (+52%)
Mutual labels:  time-series
readabs
Download and tidy time series data from the Australian Bureau of Statistics in R
Stars: ✭ 73 (+192%)
Mutual labels:  time-series
cantor
Data abstraction, storage, discovery, and serving system
Stars: ✭ 25 (+0%)
Mutual labels:  time-series

Lite Model For Human Activity Recognition (HAR)

MIT license PRs Welcome

Content

  1. Example
  2. Overview
  3. Architecture
  4. Usage

Example

Let's look at 2 examples

  1. Here is an example of recognising a person playing a guitar.

2. Another example where its recognition of wrestling.

Overview

Most of the HAR models out there are just too heavy and cannot be deployed on low power hardware like Raspberry Pi, Jetson Nano etc. Even in Laptops the inference time is very high and causes a lot of lag. This model efficiently solves this problem,

A Binary HAR classifier that can be trained and deployed in less than 10 lines of code.

Architecture

As this is a time series problem using an LSTM was an apparent choice.

The LSTM had to be taught the relative motion of body joints for a certain action.

Preprocessing

In preprocessing I have inferred Posenet (TF-lite model) using tf.Interpreter().

  1. Posenet returns a HeatMap and an OffsetMap.
  2. Using this we extract the location of the 17 Keypoints/Body Joints that posenet detects.
  3. If a certain joint is not in frame it is assigned [0,0].
  4. From every video we sample 9 frames that are equally spaced.
  5. Now each frame of the 9 frames in each video will contain 17 lists of [x,y].
  6. This implies 34 points in each frame.
  7. Using the path to the dataset we can make a .csv file which is essentially our training data.

Model

  1. There are 'x' no of videos each having 9 frames which in turn have 34 points.
  2. So input shape for first LSTM becomes (9,34).
  3. The model is a 3 layer LSTM with 128 nodes each, along with Dropouts of 0.2 and 0.1 and a batch normalization.
  4. Which is followed by a Dense Layer of 32 nodes and an Output Layer of 1 node.

Inference

  1. During inference we use Posenet again for preprocessing and pandas takes care of the rest.
  2. Load in the model and pass on the preprocessed data to the model.
  3. The model will make a binary classification based on the 2 labels you trained it on.

Usage

Infering the example models given

  1. Use the script testing_model.py.
  2. There are 2 models in the repo mwrestling_vs_guitar.model and guitar_vs_yoga.model.
  3. In the below line insert the name of the model you want to infer.
>> model = tf.keras.models.load_model('<model_name>')
  1. Once you have the video offline (or) a stack of 9 frames in your live inference. Pass it on to the function preprocess_video. Please have it ready in mp4 format.
>> X_test = preprocess_video('< Path to Video >')
  1. Once these 2 line of the code are edited. You can run the code an Obtain the prediction.

Training custon classifier.

  1. Use the script train.py.
  • NOTE : Ensure all training examples are 10 seconds long. i.e., use kinetics dataset.
  1. Now using the function generate_training_data we can essentially make out training data. The function takes 2 parameters Path to videos and Name of the csv you want to generate
>> generate_training_data('<Path_to_folder_containing_videos>', '<name_of_csv>')
  1. Now that both the csv's are generated. Use the preprocess_csv function to get your training_array. The function takes 2 parameters Path to CSV and No of samples in validation set.
>> X_action2_train, X_action2_test =  preprocessing_csv('<name_of_csv>', no_of_elements_in_validation_set)
  1. This returns the test and training split.
  2. Now use the get_final_data_for_model.
>> X_train, X_test, Y_train, Y_test = get_final_data_for_model(X_action2_train, X_action2_test, X_action1_train, X_action1_test)
  1. Use the shuffler function to shuffle the data.
>> X_train, Y_train = shuffler(X_train, Y_train)
  1. All the work is done. Time to train the model.
>> train_LSTM(X_train, Y_train, X_test, Y_test, name_of_the_model)

Here we give in the X's and Y's along with the NAME by which you want the model to be saved.

  1. You can checkout how to infer it in the previous section.

LICENSE

MIT

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].