Machine Learning Helps You Get In Shape While Working A Desk Job

A man performing push-ups in front of a PC

Humans weren’t made to sit in front of a computer all day, yet for many of us that’s how we spend a large part of our lives. Of course we all know that it’s important to get up and move around every now and then to stretch our muscles and get our blood flowing, but it’s easy to forget if you’re working towards a deadline. [Victor Sonck] thought he needed some reminders — as well as some not-so-gentle nudging — to get into the habit of doing a quick workout a few times a day.

To this end, he designed a piece of software that would lock his computer’s screen and only unlock it if he performed five push-ups. Locking the screen on his Linux box was as easy as sending a command through the network, but recognizing push-ups was a harder task for which [Victor] decided to employ machine learning. A Raspberry Pi with a webcam attached could do the trick, but the limited processing power of the Pi’s CPU might prove insufficient for processing lots of raw image data.

[Victor] therefore decided on using a Luxonis OAK-1, which is a 4K camera with a built-in machine-learning processor. It can run various kinds of image recognition systems including Blazepose, a pre-trained model that can recognize a person’s pose from an image. The OAK-1 uses this to send out a set of coordinates that describe the position of a person’s head, torso and limbs to the Raspberry Pi through a USB interface. A second machine-learning model running on the Pi then analyzes this dataset to recognize push-ups.

[Victor]’s video (embedded below) is an entertaining introduction into the world of machine-learning systems for video processing, as well as a good hands-on example of a project that results in a useful tool. If you’re interested in learning more about machine learning on small platforms, check out this 2020 Remoticon talk on machine learning on microcontrollers, or this 2019 Supercon talk about implementing machine vision on a Raspberry Pi.

9 thoughts on “Machine Learning Helps You Get In Shape While Working A Desk Job

    1. Actually I found a way to deal with that. In Linux you can use the command pactl to query pulseaudio (linux audio driver) if there is a program that’s currently using the microphone. If there is, the pi bails out and never locks the screen. You can see this check in the code on github :) works even when muted too!

      1. This is clever but I sometimes spend a few hours in a row in meetings. I’ve found a a workaround for it, though. I use a wireless headset and walk around my apartment during meetings. I have a wristband that counts steps. This way I measure how active I’ve been even though participating in meetings. Some complain they can’t see me on camera but that’s something I can live with ;)

    1. Thank you so much! I wouldn’t necessarily say this is a beginner project, but I would recommend the OAK-1 as a very beginner friendly way to get your hands dirty. They have some awesome samples and a really easy to understand SDK. It is quite expensive but a lot of fun :)

  1. For the same price perhaps we could employ some accelerometers on the wrists and ankles and perhaps a couple other spots to determine bodily position. This could be used to track the amount of exercise you get in a day and of what sort. An algorithm could then tell you how much you have left to do and so on.

    There is actually an optimal amount and for me it’s easy to go over that amount for a given muscle. It leads to tendinopathies and other overuse injuries.

    Muscles vibrate slightly depending on their relative force they are exerting so this could be used to determine approximately how much load the exercise entailed. This could be factored in, and the algorithm could tell you to go faster or slower or increase or decrease loading for optimality. There is a fair bit known for the optimality of how fast, what loading, and so on, to build muscle or train other desired systems.

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.