The project aims to revolutionize fitness guidance by leveraging cutting-edge technologies such as computer vision and machine learning. Through a multipage web application built with Streamlit, users receive real-time posture correction feedback during workouts. The integration of OpenCV and Mediapipe enables accurate posture detection and correction, ensuring optimal exercise form. Additionally, the application utilizes the LLM Large Language Model to provide personalized weekly exercise plans tailored to individual users' fitness goals and progress. With efficient SQL database management, the project ensures seamless data storage and retrieval, contributing to a holistic and personalized fitness experience.
➡️ For deeper explaination and suggestion can be found here
- Detect and correct improper posture in real-time.
- Deliver personalized exercise plans tailored to individual users' needs and fitness goals.
- Integrate computer vision algorithms (OpenCV, MediaPipe) to analyze user movements and provide instant feedback.
- Utilize Large Language Models (LLM) to generate personalized weekly exercise plans based on users' fitness levels, preferences, and progress.
- Programming Languages: Python (TensorFlow, OpenCV, MediaPipe, PyTorch)
- Machine Learning Models: Pose estimation, deep learning-based posture correction, recommendation systems
- Data Sources: Fitness datasets, real-time user feedback
- User Interface: Web-based and mobile application integration
Our AI-powered fitness application follows a structured approach to posture detection, personalized workout recommendations, and real-time feedback. The methodology consists of three core components:
In this web application, we have integrated five primary exercises, namely Squats, Bicep Curl, Dumbbell Fly, Dumbbell kickback, and Push-ups, to cater to diverse fitness routines. Each exercise uses the same standardized logic, meticulously designed to ensure accuracy and effectiveness. For an easier explanation of this approach, we will employ the Bicep Curl as a paradigmatic example for elucidation within this report.
-
MediaPipe Pose employs machine learning for precise body pose tracking in videos. It uses BlazePose, integrating COCO, BlazeFace, and BlazePalm functionalities, to detect 33 body landmarks in an RGB frame. The system follows a two-stage detection-tracking pipeline: first, it detects the region of interest (ROI) to locate the person, and then, it tracks and predicts pose landmarks within the ROI using a cropped frame.
Selecting the appropriate viewpoint for capturing a user’s movement is crucial for accurate fitness analysis.
- Frontal View: This view enables the system to analyze both the left and right sides of the body. It is useful for exercises where symmetry matters, such as overhead presses, side planks, crunches, and curls. In our web application, the frontal view is primarily used for dumbbell fly exercises.
- Side View: This perspective enhances estimation accuracy for inclinations relative to verticals or horizontals. It is beneficial for exercises like deadlifts, pushups, squats, and dips.
Given our focus on Bicep Curl analysis, where precise vertical inclinations are necessary, we prioritize the side view for optimal accuracy.
To evaluate bicep curl form, we analyze specific body landmarks:
- Shoulder-elbow angle
- Elbow-wrist angle
- Shoulder-hip angle
These angles are compared against predefined thresholds to determine if the bicep curl is executed correctly. Real-time feedback is generated based on this assessment.
Additionally, we compute the offset angle between the nose and shoulders to ensure the user maintains a proper side view for accurate pose estimation. If the offset angle exceeds a certain threshold, warnings are provided.
We implement a state transition system to monitor bicep curl execution:
- State (s1) - Normal Phase: The user stands straight with an elbow angle between 145° and 200°.
- State (s2) - Transition Phase: The elbow angle decreases to between 85° and 144° as the curl progresses.
- State (s3) - Pass Phase: The elbow reaches an angle between 35° and 84°, completing the curl.
A sequence list (state_sequence) tracks these transitions. A correct curl follows the sequence [s1 → s2 → s3 → s2 → s1]. Incorrect sequences trigger feedback.
We also incorporate an inactivity timer that resets the counters if no motion is detected beyond a predefined threshold.
This application workflow follows a methodology inspired by the LearnOpenCV website
Detailed explaination can be found in report.
- Provides instant correction suggestions based on detected posture deviations, highlighting areas that need adjustment.
- Uses reinforcement learning techniques to refine posture detection and feedback accuracy over time.
- Implements audio-visual guidance for users, enabling interactive engagement and self-improvement in workout form.
-
A machine learning-based recommendation system tailors exercise plans to individual users based on fitness levels, goals, and posture performance.
-
The system dynamically adjusts difficulty and exercises based on user progress and real-time posture feedback.

-
Uses Large Language Models (LLM) to generate structured weekly fitness programs incorporating user preferences and past performance data. Expected outcome:

- Reduce injury risks caused by improper exercise posture.
- Improve workout efficiency with real-time AI feedback.
- Enable users to follow structured, personalized fitness plans.
- Clone the repository:
git clone https://github.com/thaochu05/AI-Personal-Trainer.git
- Install dependencies:
pip install -r requirements.txt
- Run the application:
streamlit run <Homepage.py>
- Follow the on-screen instructions to analyze your posture and get personalized workout recommendations.
- Implement AI-based voice coaching for real-time workout guidance.
- Expand the dataset to improve posture recognition accuracy.
- Develop a mobile app for easy accessibility.
@thaochu05 @DucDuyLe










