Human Activity Recognition

Insight - Data Science Society
4 min readJan 3, 2022

--

DESCRIPTION

A person performs various activities in his regular day to day life. It is quite difficult to differentiate between a regular and an anomalous activity. Human activity recognition plays an important part in human’s everyday life. An effective HAR consists of applications in behavior analysis of elder persons at home video surveillance, gesture recognition, smart cities etc. HAR is also useful in early detection of diseases like dementia.

Abnormal behavior detection of human activities was surveyed and reviewed in various number of articles and various methodologies (like classifications, CNN, DRNN, LSTM etc.) for detection has been highlighted in books. The data used for detection of abnormality in behavior of a person can be gathered from various sources like smart phones sensors data wearable sensors data 3D data from camera-based application RFID tags-based data etc.

WHY IS IT USEFUL

The wide-ranging growth of smartphones and it on-chip sensors has conferred great opportunities for the use of smartphones to sense and analyze ubiquitous data. Identification of abnormality in human behavior at early stage can be beneficial in case of diseases like dementia. This can be done by monitoring a continuous behavior of an elderly person who is living alone. If there is any anomalous behavior observed, it can be compared with the symptoms of dementia and if the result of comparison shows some signal which may result in dementia.

INFORMATION ABOUT DATA

The experiments have been carried out with a group of 30 volunteers with an age bracket of 19–48 years. Each person performed six activities (WALKING, WALKING — UPSTAIRS, SITTING — DOWN, SITTING — DOWN, STANDING — UP, LAYING — DOWN) wearing a smartphone on the waist. Using its embedded accelerator and gyroscope, we captured 3 — axial linear acceleration and a 3 — axial angular velocity at a constant rate of 50 Hz. The obtained dateset has been randomly partitioned into two sets, where 70% of the volunteers was selected for generating the training data and 30 % the test data.

PROBLEM STATEMENT

By using either human engineered 561 features data or 128 reading our goal is to predict one of the six activities that a user is performing.

At the outset, this is a multi class classification problem

WALKING — — — 1

WALKING — UPSTAIRS — — — 2

WALKING — DOWNSTAIRS — — — 3

SITTING — — — 4

STANDING — — — 5

LYING — — — 6

ML PROBLEM FORMULATION

All of the Accelerometer and Gyroscope are tri — axial, means they measure acceleration and angular velocity respectively in all the three axes. So, we have in total six time series data, we want to predict six activities

1. We will use Accuracy as one of the metrics

2. We will also use Confusion — Matrix to check that in which two activities the models are confused.

As we know LSTM works well on time — series data, because this data is containing lags of unknown duration between important information and LTSM were developed to deal with the vanishing gradient problem so we have decided to apply LSTM of recurrent Neural Networks on the 128 sized raw readings.

DATA EXPLORATION

From the above two plots, we can infer that our classes are almost balanced

Feature information from domain knowledge

1. STATIC : We have three types static features where the test subject is in rest

· Sitting

· Standing

· Lying

2. DYNAMIC : We have three dynamics where test subject is in motion

· Walking

· Walking — Downstairs

· Walking — Upstairs

Magnitude of the mean body acceleration in time — domain measured by accelerometer — can separate static from dynamic activity.

APPLYING DEEP LEARNING MODEL : LSTM

Here in LSTM, we will use 128 raw sized readings that we obtained from the accelerometer and gyroscope signals

HYPER — PARAMETER TUNING WITH HYPERAS AND APPLYING LSTM WITH BEST HYPER — PARAMETERS

LSTM LAYERS AND EPOCHS

ACCURACY ON THE TEST DATA

RESULT

1. By a simple two layered LSTM, we got a good accuracy of 87.72%, thus we can build models even when we don’t have domain expert features

2. Can be improved by more epochs and more evaluations while tuning.

Author :-

Isha Agarwal https://www.linkedin.com/in/isha-agarwal16/

--

--

Insight - Data Science Society

We are a bunch of Data Science enthusiasts at IMI, New Delhi. We thrive to to learn new things in this field and share our knowledge with the community.