Want to explore "what if"?

Using machine learning for motion tracking and wearables

Written by RiaRole: Our Former Digital Content Specialist

Heads up: Our Ideas Factory has been refreshed, levelled up, and grown-up into Alphero Intelligence. Some of our old posts are pretty cool tho'. Check this one out.

Smartwatch. Photo by AB on unsplash
  • Motion tracking with wearables has great potential for fitness, health, and workplace safety solutions.
  • We took a look at what Apple HealthKit and Core Motion has to offer.
  • What could we do with motion tracking and machine learning?

As the penetration rate of smart wearables continues to grow, the average person is becoming more health-conscious. We were excited to take a look at where the technology is at currently, and how we could use wearables to enhance our local gym’s services, beyond simply tracking heart rate and general movement.

Many of the Alphero teamies are fitness-enthusiasts (and quite competitive, as a side note)… So we were keen to see who had the best exercise technique. If we record an exercise movement, could we compare the user movement to the ideal technique?

Approach A: Making use of Apple HealthKit and Core Motion

Apple HealthKit provides an interface for third-party app developers to read and write user health data to Apple’s Health app, including:

  • Activity
  • Mindfulness
  • Nutrition
  • Sleep

Apple Core Motion reports raw, motion-related data from the on-board accelerometer — but it comes with a lot of noise. This is a hard signal processing problem. A lot of maths is involved. A lot of maths. Way too much maths. We’re going to need some assistance...

Approach B: Make use of machine learning to interpret raw data

We discovered FocusMotion!

FocusMotion is a paid framework that uses machine learning to detect movements. Effectively doing all the hard maths for us!

It comes with four default detection modes:

  • Quant
  • Freestyle
  • Freestyle Plus
  • Activity

Each detection mode analyses the movements and the repetitions in a different way.

Putting it all together

We created a sample app, to review speed, form, and ideal angular range.

Sample app to review speed, form and angular range

With Creator mode, we were able to create custom models (such as star jumps) and detect them in Quant mode.

A general rule when it comes to machine learning is the more data, the better! More data results in a better, more accurate model. It’s also a good excuse to get lots of people doing star jumps in the office.

We had 17 datasets from a number of people, resulting in approximately 60% accuracy. Ideally, we’d need 40-100 datasets in order to improve the model and ideal. We used this model to create a Freestyle model.

A example of a dataset

ake 2: Let’s try 40 data sets by one person.

The accuracy shot up from 60% to 95%!

What did we learn?

So how effective is motion tracking using wearables to detect the “correctness” of a specific motion against an ideal?

As always: more data will result in a better model. Not just more sets (resting, curls, crunches, etc), but they should be contributed by more people as different people complete different sets differently.

To train a model like this yourself would require a colossal amount of data, which is why machine learning models for exercise are so specialised. Machine learning is a must for recognising exercise patterns, as interpreting raw accelerometer data requires an extreme amount of hard maths… Heart rate data is easy to measure by comparison, so we can see why everyone does it.

Written by RiaRole: Our Former Digital Content Specialist