Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/somjit101/human-activity-recognition

This project is to build a model that predicts the human activities such as Walking, Walking Upstairs, Walking Downstairs, Sitting, Standing or Laying using readings from the sensors on a smartphone carried by the user.
https://github.com/somjit101/human-activity-recognition

decision-tree-classifier eda feature-engineering gradient-boosting-classifier grid-search human-activity-recognition keras logistic-regression lstm random-forest-classifier rbf-kernel scikit-learn seaborn-plots signal-processing support-vector-classifier support-vector-machine t-sne tensorflow uci-har-dataset uci-machine-learning

Last synced: 20 days ago
JSON representation

This project is to build a model that predicts the human activities such as Walking, Walking Upstairs, Walking Downstairs, Sitting, Standing or Laying using readings from the sensors on a smartphone carried by the user.

Awesome Lists containing this project

README

        

# Human-Activity-Recognition

This project is to build a model that predicts the human activities such as Walking, Walking Upstairs, Walking Downstairs, Sitting, Standing or Laying using readings from the sensors on a smartphone carried by the user.

## About the Dataset

We have used the **Human Activity Recognition Using Smartphones Data Set** on the **UCI Machine Learning Repository** which can be found [here](https://archive.ics.uci.edu/ml/datasets/human+activity+recognition+using+smartphones).
This dataset is collected from 30 persons(referred as subjects in this dataset), performing different activities with a smartphone to their waists. The data is recorded with the help of sensors (accelerometer and Gyroscope) in that smartphone. This experiment was video recorded to label the data manually.

### How the Data was Recorded

By using the sensors(Gyroscope and accelerometer) in a smartphone, they have captured '3-axial linear acceleration'(_tAcc-XYZ_) from accelerometer and '3-axial angular velocity' (_tGyro-XYZ_) from Gyroscope with several variations.

> **prefix 't' in those metrics denotes time.**

> **suffix 'XYZ' represents 3-axial signals in X , Y, and Z directions.**

## **Feature Names**

1. These sensor signals are preprocessed by applying noise filters and then sampled in fixed-width windows(sliding windows) of 2.56 seconds each with 50% overlap. ie., each window has 128 readings.

2. From Each window, a feature vector was obtianed by calculating variables from the time and frequency domain.
> In our dataset, each datapoint represents a window with different readings
3. The accelertion signal was saperated into Body and Gravity acceleration signals(___tBodyAcc-XYZ___ and ___tGravityAcc-XYZ___) using some low pass filter with corner frequecy of 0.3Hz.

4. After that, the body linear acceleration and angular velocity were derived in time to obtian _jerk signals_ (___tBodyAccJerk-XYZ___ and ___tBodyGyroJerk-XYZ___).

5. The magnitude of these 3-dimensional signals were calculated using the Euclidian norm. This magnitudes are represented as features with names like _tBodyAccMag_, _tGravityAccMag_, _tBodyAccJerkMag_, _tBodyGyroMag_ and _tBodyGyroJerkMag_.

6. Finally, We've got frequency domain signals from some of the available signals by applying a FFT (Fast Fourier Transform). These signals obtained were labeled with ___prefix 'f'___ just like original signals with ___prefix 't'___. These signals are labeled as ___fBodyAcc-XYZ___, ___fBodyGyroMag___ etc.,.

7. **These are the signals that we got so far :**
+ tBodyAcc-XYZ
+ tGravityAcc-XYZ
+ tBodyAccJerk-XYZ
+ tBodyGyro-XYZ
+ tBodyGyroJerk-XYZ
+ tBodyAccMag
+ tGravityAccMag
+ tBodyAccJerkMag
+ tBodyGyroMag
+ tBodyGyroJerkMag
+ fBodyAcc-XYZ
+ fBodyAccJerk-XYZ
+ fBodyGyro-XYZ
+ fBodyAccMag
+ fBodyAccJerkMag
+ fBodyGyroMag
+ fBodyGyroJerkMag

8. We can esitmate some set of variables from the above signals. ie., **We will estimate the following properties on each and every signal that we recoreded so far :**

+ ___mean()___: Mean value
+ ___std()___: Standard deviation
+ ___mad()___: Median absolute deviation
+ ___max()___: Largest value in array
+ ___min()___: Smallest value in array
+ ___sma()___: Signal magnitude area
+ ___energy()___: Energy measure. Sum of the squares divided by the number of values.
+ ___iqr()___: Interquartile range
+ ___entropy()___: Signal entropy
+ ___arCoeff()___: Autorregresion coefficients with Burg order equal to 4
+ ___correlation()___: correlation coefficient between two signals
+ ___maxInds()___: index of the frequency component with largest magnitude
+ ___meanFreq()___: Weighted average of the frequency components to obtain a mean frequency
+ ___skewness()___: skewness of the frequency domain signal
+ ___kurtosis()___: kurtosis of the frequency domain signal
+ ___bandsEnergy()___: Energy of a frequency interval within the 64 bins of the FFT of each window.
+ ___angle()___: Angle between to vectors.

9. We can obtain some other vectors by taking the **average of signals** in a single window sample. These are used on the 'angle() variable'
+ gravityMean
+ tBodyAccMean
+ tBodyAccJerkMean
+ tBodyGyroMean
+ tBodyGyroJerkMean

## **Output Labels**

+ In the dataset, Y_labels are represented as numbers from 1 to 6 as their identifiers.

- WALKING as __1__
- WALKING_UPSTAIRS as __2__
- WALKING_DOWNSTAIRS as __3__
- SITTING as __4__
- STANDING as __5__
- LAYING as __6__

## Train-Test Split

The readings from ___70%___ of the volunteers were taken as ___trianing data___ and remaining ___30%___ subjects recordings were taken for ___test data___

## Dataset Location

* All the data is present in 'UCI_HAR_dataset/' folder in present working directory.
- Feature names are present in 'UCI_HAR_dataset/features.txt'
- ___Train Data___
- [X_train](UCI_HAR_Dataset/train/x_train.txt)
- [subject_train](UCI_HAR_Dataset/train/subject_train.txt)
- [Y_train](UCI_HAR_Dataset/train/y_train.txt)
- ___Test Data___
- [X_test](UCI_HAR_Dataset/test/X_test.txt)
- [subject_test](UCI_HAR_Dataset/test/subject_test.txt)
- [Y_test](UCI_HAR_Dataset/test/y_test.txt)

## Quick Overview of the Dataset

* Accelerometer and Gyroscope readings are taken from 30 volunteers(referred as subjects) while performing the following 6 Activities.

1. Walking
2. WalkingUpstairs
3. WalkingDownstairs
4. Standing
5. Sitting
6. Lying.

* Readings are divided into a window of 2.56 seconds with 50% overlapping.

* Accelerometer readings are divided into gravity acceleration and body acceleration readings,
which has x,y and z components each.

* Gyroscope readings are the measure of angular velocities which has x,y and z components.

* Jerk signals are calculated for BodyAcceleration readings.

* Fourier Transforms are made on the above time readings to obtain frequency readings.

* Now, on all the base signal readings., mean, max, mad, sma, arcoefficient, engerybands,entropy etc., are calculated for each window.

* We get a feature vector of 561 features and these features are given in the dataset.

* Each window of readings is a datapoint of 561 features.

## Problem Statement

Given a new datapoint with all the sensor readings, we have to **predict the current Human Activity**.