- Monitor four exercise types: pull-ups, push-ups, squats, and ab workouts
- Count repetitions in real-time
- Provide visual feedback on form/stage transitions
- Track multiple users simultaneously
System components
- AiCamera: streams video frames and runs the pose model on-chip.
- HigherHRNet: pose-estimation model producing 17 key-points with confidence scores.
- BYTETracker: multi-object tracker assigning consistent IDs to detected people.
- Angle calculation: Determines exercise stage transitions
- Annotator and custom drawing functions: draw keypoints, skeletons, angles, labels, and focus points
This system can help track workout progress over timeand create metrics to compare exercises between sessions.
Processing Pipeline1. Start the camera stream and load the pose-estimation model.
- For each frame:- Filter detections with confidence above 0.3.- Track each person with BYTETracker.- Maintain a record for each tracked ID, storing angle, repetition count, and movement stage.
2. Choose three exercise-specific key points (depending on the exercise argument) to compute the joint angle.
3. Compute the angle using vector math; increase repetition count when a full movement cycle is detected based on angle thresholds.
4. Draw visual annotations:- Keypoints and skeleton lines.- The selected focus keypoints.- Labels for angle, repetition count, and movement stage.
5. Remove old tracker entries when the list becomes too large.
6. Display the annotated frame in real time.
Execution Flow - pseudo codestart_workout_demo()
parse arguments
initialize camera, model, tracker, annotator
for each frame:
get pose detections from AI Camera
track detections
compute angles and repetitions
draw annotations
display frameTry it yourselfInstallation & Usage
Start the application in a virtual environment using uv.
$ git clone [email protected]:SonySemiconductorSolutions/aitrios-rpi-sample-apps.git
$ cd aitrios-rpi-sample-apps/examples/workout-monitor
$ uv run app.py --exercise squatPerformance Notes- Initial model load may take several minutes
- Runs at ~15 FPS on Raspberry Pi 4
- Tracks up to 100 simultaneous users (-prunes old entries)
If you have questions related to Raspberry Pi, please check and utilize the forum below.
Want to learn moreExperiment further with the Raspberry Pi AI Camera by following the Get Started guide on the AITRIOS developer site.
Code





Comments