Smart gym trainer is AI-powered virtual personal fitness trainer which uses computer vision to critique user form and alert user if posture is incorrect. It also count the number of repetition i.e. set for each exercise. It supports squats, dumbbell shoulder press and bicep curls.
What You’ll Need
- Raspberry Pi 3 Model B
- Rasberry Pi Camera
- Display for Raspberry Pi (Here we are using monitor)
For posture identification, we are going to use IntelliHub , an AI cloud-platform. To use the API, we need to make an account on IntelliHub .
After logging in to your IntelliHub account, navigate to console and create an App. Once the App is created, you will get App info and API key.
In this DIY, we are going to use Phoenix Vision. Click on ‘APIs & Services’ and enable API for Phoenix Vision services.
We train a model with different posture i.e. squat image, dumbbell shoulder press and bicep curls using Phoenix Vision.
We will use this model to identify posture in real-time and count the number of repetitions i.e. set for each exercise.
Building the Smart Gym Trainer
Smart Gym Trainer uses Phoenix Vision to build model to identify posture. First, images for different postures like squat, dumbbell shoulder press and bicep curls need to be uploaded for training the model. This model is used to identify posture in real-time and count the number of repetitions i.e. set for each exercise.
Smart Gym Trainer uses camera to take live image frames as input, predict posture on cloud using model and gives name of exercise user is performing as output which we will show in our monitor. We have used camera to connect to the Raspberry Pi. We will connect Raspberry Pi to the monitor using HDMI port.
- Setting Up
- Connect the camera.
- Boot up Raspberry Pi Board.
- Download script from Github
Now we have everything in place to work with the Raspberry Pi and IntelliHub API, we need code. You can find Smart Gym Trainer code file here.
We get two files: requirement file and Smart Gym Trainer ipython notebook. To install required libraries, run the following code in terminal from directory containing downloaded files:
pip install -r requirements.txt
iPython notebook contains python code with comments. You just need to paste API key (which you got after creating an App) in the code and start running command to get posture in real-time.