HIIT Workout Trainer

By Nicola King. Posted

When James Wong felt that his workout routine needed a boost due to extended periods of having to work from home, he knew he needed to take action. “First of all, working from home all day long without going to the gym has taken a toll on my health,” he explains. “Secondly, as a machine learning practitioner, doing research on edge devices like Raspberry Pi and microcontrollers has always been fascinating to me, in the sense that the computational efficiency continuously pushes the boundaries of what we can achieve on a $30 computer with ML.”

With that in mind, James married his regular HIIT (high-intensity interval training) workout with Raspberry Pi, and the HIIT Raspberry Pi web app was born. It’s a clever idea that uses machine learning on Raspberry Pi to keep tabs on your workout in real time and make sure you are getting optimum results.

No pain, no gain

James first had the idea in January 2020, and had a prototype ready around three weeks later, with improvements and tweaks then made based on feedback from family, friends, and internet reaction. He’s taken the HIIT concept, where you have short bursts of very high-intensity activity alternated with rest or much lower intensity exercise, and arguably improved it. 

“It gamifies workouts with the leaderboard dashboard, and makes doing exercise fun with your partner and friends,” he says. What’s more, the app is simplicity itself in that it basically does just two things. Firstly, it uses computer vision, and a Raspberry Pi Camera Module, to track movements and poses, and then it scores them based on a set of predefined standards. 

To speed up the machine learning algorithms, James plugged a USB Coral Accelerator Edge TPU into his Raspberry Pi. This, he highlights, was an important addition: “An Edge TPU is required for it to work roughly at 30 fps. Without the accelerator, frame rates drop significantly and the user experience deteriorates.”

Of course, as with all builds, some fine-tuning was required, as James shares. “Every single workout consists of many moves or a sequence of poses. HIIT Workout Trainer needs to make sure to track them at a fraction of a second under various external conditions. Also, the web app interface has gone through many evolutions to have an intuitive and simplistic version of high-performance.” 

James has made various improvements to the project, with most coming from faster and more efficient video processing by the ML model under the hood, as well as user interface redesigns on the front. “I’m definitely going to test more workouts if I have enough time on hand. It would be great if more people joined in,” he says.

Unbiased adjudicator

This idea has obvious potential. James has described the app as akin to an “electronic referee”, and it could easily be adapted for other forms of sport or exercise: “I’ve already seen people do similar awesome projects, but for weight training.” 

So, if you’d like to try your hand at this project, James very much encourages it. “The project is open-sourced on GitHub, where you can find more to set it up and get started. If anyone has any questions, please find me via email or Twitter, I’m more than happy to help.”

What more motivation do you need? As James reminds us on his web page, “Just imagining a workout is never the same as actually doing it. With everything put into place, let’s slip on sweatpants and get it rolling!”

From The MagPi store

Subscribe

Subscribe to the newsletter

Get every issue delivered directly to your inbox and keep up to date with the latest news, offers, events, and more.