From strictly accelerometer data, is it possible to classify if someone is walking, running or neither? Well, the answer is yes, but its not quite as simple as you may think. Here is some of the work I have done in this space, and the varying results that I have achieved through different methods.
Removing bodily acceleration from the data
The first step is to remove the bodily acceleration component from the data. This is done with a high pass filter, and the change is immense. Below is an image of the x-axis acceleration before and after the high pass filter was passed over the data.
Using just this, it is possible to create a fairly robust Neural Network that can classify walking just based on the statistical features of the signal including the mean and rms. As the data is in time series format, it is also important to buffer the data into 50 frame segments as the sampling rate was 50hz. Here are some of the stats from the training process with just the mean and rms.
Class 1 = None || Class 2 = Walking || Class 3 = Running
Notice no output for class 3 which means that in the holdout set there was zero running involved.
It is pretty impressive how well the model performs on the holdout test set even when the only features given are the mean and rms. Lets take a look at how much better we can do if we make a slightly more complex NN and add spectral density features
As well, it is possible to take a look at the power spectral density in frequency space, and this can give a lot of insight into the different types of signal that is being recorded by the accelerometer. By adding the location of the peaks and height, it is possible achieve a better accuracy on classification, but alas, the more transformations, the more time it takes. Below are images of power spectral density features that can be used to get the classification accuracy over 96% . To complete the transformations on the data takes longer but is still able to be completed faster than realtime. This trade off will always exist between higher accuracy and faster performance.
As is apparent from the above plots, in frequency space, the differences between the actions are dramatic. Using this it is possible to achieve much higher accuracy, and the video below shows the performance. Thanks for reading!
Check out the demo here!