8th Sem Report (Final - Modified)
8th Sem Report (Final - Modified)
Project Team
MAY – 2024
B-TECH 2020
FACULTY OF ENGINEERING AND TECHNOLOGY
M. S. RAMAIAH UNIVERSITY OF APPLIED SCIENCES
Bengaluru -560 054
Certificate
This is to certify that the Group Project-2 titled “Design and Development of ML based
Fitness Trainer using Human Pose Estimation” is a bonafide record of the project work
carriedout by Mr. Siddhartha Hadimani, Yogesh B and Eshan Rao bearing Reg. No.
20ETEC004054, 20ETEC004078 and 19ETEC004016 Department of Electronic and
Communication Engineering – 2024 batch in partial fulfilment of requirements for
the award of B. Tech. Degree of M. S. Ramaiah University of Applied Sciences.
MAY - 2024
Declaration
The project work is submitted in partial fulfilment of academic requirements for the award
of B. Tech. Degree in the Department of Electronics and communications engineering of
the Faculty of Engineering and Technology of Ramaiah University of Applied Sciences.
The project report submitted here with is a result of our own work and in conformance to
the guidelines on plagiarism as laid out in the University Student Handbook. All sections
of the text and results which have been obtained from other sources are fully referenced.
We understand that cheating and plagiarism constitute a breach of University regulations,
hence this project report has been passed through plagiarism check and the report has been
submitted to the supervisor.
Acknowledgements
We take this opportunity to express our sincere gratitude and appreciation to Ramaiah
University of Applied Sciences, Bengaluru for providing us an opportunity to carry out
our group project work.
We would like to express our thanks and gratitude to Dr. J.V Desai, Dean
Ramaiah University of Applied Sciences for giving us theopportunity to study this
course and for his continuous support.
We also thank all the faculty and supporting staff of the Electronics and Communication
Department, Faculty of Engineering & Technology who have helped me towards
successful completion of this dissertation work. Finally, we thank to our friends and
family for being with me in many issues during the project and their blessing have been a
constant source of inspiration for me.
Summary
Contents
Contents
FACULTY OF ENGINEERING AND TECHNOLOGY……………….…...……......1
Declaration……………………………………………………………………………….3
Acknowledgements……………………………………………………………………………….6
Summary………………………………………………………………………………………….6
List of Figures……………………………………………………………………………………6
List of Tables……………………………………………………………………………………..6
Abbreviation and Acronyms………………………………………………………………….....6
CHAPTER 1:- Introduction and Motivation……………………………………………………8
1.1 Introduction……………………………………………………………………………8
1.2 Literature Survey………………………………………………………………………9
1.3 Motivation…………………………………………………………………………….9
CHAPTER 2:-Background Theory……………………………………………………………..11
2.1 Introduction…………………………………………………………………………...11
2.2 Frameworks and Libraries…………………………………………………………….13
2.3 Pose Detection Model (Dataset)………………………………………………….…...13
2.4 Program/Code and Explanation……………………………………………………….14
CHAPTER3:- Problem Definition………………………………………………………………30
3.1 Objectives………………………………………………………………………………………………………………..30
3.2 Methods and Methodologies…………………………………………………………………………………..31
3.3 Performance Metrics……………………………………………………………………………………………….32
CHAPTER4:-Problem Solving………………………………………………………………….33
4.1 Introduction…………………………………………………………………………...33
4.2 Block Diagram of Posture Correction System………………………………………..33
CHAPTER 5:- Results…………………………………………………………………………..35
5.1 Pose Detection Module………………………………………………………………..35
5.2 Bicep Curl Counter………………………………………………………………………………………….36
5.3 Squat Counter………………………………………………………………………...36
5.4 Pushup Counter………………………………………………………………....37
5.5 Hand Raise Counter…………………………………………………………….38
List of Figures
List of Tables
MP: MediaPipe
1.1 Introduction
Human pose estimation emerges as a transformative force in the realm of fitness
journeys, revolutionizing the way individuals interact with technology during exercise
routines. As technology continues to advance, bridging the gap between humans and
machines, there is a growing reliance on computer-based devices to support various
aspects of our daily lives.
Human pose estimation holds immense promise for enhancing fitness experiences
by providing intuitive and personalized guidance. In fitness journeys, poses play a
vital role in guiding exercise movements and ensuring correct form and posture.
With the advent of human pose estimation technology, individuals can now receive
real-time feedback and assistance, akin to having a virtual fitness trainer by their side.
This technology not only enhances the effectiveness of workout routines but also
fosters a deeper connection between individuals and their fitness goals.
Moreover, human pose estimation technology caters to the diverse needs of fitness
Enthusiasts, including those wit varying levels of experience and physical abilities.
Whether performing static poses to maintain balance and stability or dynamic
movements to challenge agility and strength, the versatility of pose estimation
algorithms ensures adaptive and tailored guidance throughout the fitness journey.
Our literature review revealed several key studies that have significantly contributed
to the field:
• Pose Estimation for Fitness Tracker Using Machine Learning: This paper
discussed the challenges in human pose estimation and provided an overview of
considerable research work in pose estimation, including a machine learning
approach with OpenCV and MediaPipe.
1.3 Motivation
2.1 Introduction
Human pose estimation for fitness aims to eliminate the need for trainers by
automating the process of identifying and tracking body positions and movements in
digital content.
Leveraging image processing and machine learning technologies, this approach
allows individuals to receive real-time feedback on their form and technique without
the presence of a human trainer. By providing accurate assessments and personalized
guidance, automated systems empower users to optimize their workout routines
independently, reducing reliance on traditional trainer-led sessions.
The background theory of pose detection , image processing, and can be explained
as follows:
OpenCV is a popular open-source library for computer vision and image processing.
OpenCV is utilized for image processing tasks, such as capturing video frames from
a camera feed, converting images to grayscale, and applying filters to enhance the
quality of the image. It is also used for basic operations like thresholding and contour
detection. OpenCV provides various functions and methods to perform image
processing tasks, such as cv2.VideoCapture, cv2.cvtColor,
cv2.GaussianBlur, cv2.threshold, and cv2.findContours.
BlazePose is a popular pose detection model developed by Google. While there isn't
a specific dataset called "BlazePose dataset," Google has trained BlazePose using
various datasets for human pose estimation tasks. These datasets typically contain
images or videos with annotated human keypoints (e.g., keypoints for joints like
shoulders, elbows, wrists, hips, knees, and ankles).
This python code utilizes OpenCV and Mediapipe to perform pose detection on a
video.
Let’s break down the different components and functionalities of this script:
• ‘init’ method: Initializes the pose detector object with various parameters
such as mode, model complexity, smoothness, enabling different segments,
detection confidence, and tracking confidence, and tracking confidence.
It also initializes MediaPipe’s pose detection module.
• ‘findPose’ method: Take an image as input, converts it to RGB format, and
processes it using Mediapipe’s pose detection module. It draws landmarks
and connections on the image if ‘draw’ parameter is set to ‘True’.
• ‘findPosition’ method: Find the position of landmarks on the detected pose.
It returns a list of landmark positions.
• ‘findAngle’ method: Calculates the angle between three specified landmarks.
It returns the calculated angle.
4. Execution: The script runs the ‘main’ function if it’s directly executed as the main
Script.
This python script uses the OpenCV library to detect and track human poses, especially
focusing on counting bicep curls.
1. Importing Libraries: The code starts by importing necessary libraries such as ‘cv2’
(OpenCV), ‘numpy’ (for numerical operations), and ‘time’.
3. Initialization Variables:
‘cap’: This variable is used to capture video frames. It can either capture from a video
file (‘PoseVids/g.mp4’) from a webcam(index ‘0’).
‘detector’: An instance of the ‘poseDetector’ class from the ‘PoseModule’.
‘count’: Initialized to keep track of the number of curls.
‘dir’: Used to track the direction of movement(up down) to count each curl correctly.
ML based Fitness Trainer using Human Pose Estimation 18
Recognition based Control System for AR/VR Devicesm
M.S.Ramaiah University of Applied Sciences – Faculty of Engineering and Technology (FET)
‘pTime’: Variable to store the previous time to calculate FPS(Frames Per Second).
4. Main Loop: The core of the program is in this infinite loop(‘while True’).
Squat Counter
This Python script is for counting squats using a webcam feed and OpenCV library.
Let's break down the main components and functionalities:
1) Imports: The code imports necessary libraries such as cv2 for computer vision tasks
and PoseDetector from cvzone.PoseModule for detecting human poses.
2) Initialization: The code initializes a video capture object (cap) to capture video
from the default webcam. It also initializes a PoseDetector object with specified
detection and tracking confidence thresholds.
3) Angle Finder Class: This class is defined to calculate the angle between specific
body parts. It takes as input a list of detected landmarks (lmlist), and indices of six
points (p1 to p6). The angle() method calculates the angle between these points using
trigonometry.
4) Main Loop: Inside the main loop, the code continuously captures frames from the
webcam. It resizes the frame to a standard size.
5) Pose Detection: It uses the PoseDetector object to detect poses in the resized
frame. Landmark positions and bounding box information are obtained.
7) Squat Counting: Based on the angle of the left hand, the code counts the number
of squats performed. It detects when the hand angle crosses certain thresholds
(90 and 70 degrees) to increment the counter.
Pushup Counter
This code is a Python script that uses OpenCV and the cvzone library to count push-ups
from a video feed. Let's break down the main components:
1) Importing Libraries:
2) Global Variables:
3) Video Capture:
4) Pose Detection:
6) Visualization:
7) Main Loop:
Hand Raise
This code is for detecting and counting hand raises using computer vision with
OpenCV and the cvzone library. Let me break it down for you:
1) Importing Libraries: The code imports necessary libraries such as OpenCV and
cvzone, a library built on top of OpenCV for computer vision tasks.
2) Initializing Variables and Objects: It initializes the webcam (cap), a pose detector
(detector), and some variables for counting and tracking hand raises.
3) Angle Finder Class: This class is defined to calculate angles between specific
Points on the detected pose. It takes the pose landmarks (lmlist) and indices of points
(p1 to p6) as inputs along with a boolean drawPoints to determine whether to draw
points and lines on the image.
4) Angle Calculation: Inside the angle() method of the class, angles are calculated
using trigonometric functions (atan2) based on the landmark points provided. These
angles represent the orientation of the hands.
5) Main Loop: The main loop captures frames from the webcam, detects poses, and
calculates angles using the angleFinder class.
6) Counting Hand Raises: It counts the number of hand raises by detecting changes
in the angles of the hands. If both hands are raised (angles above a threshold), it
increments the counter.
8) Displaying Results: The current count of hand raises is displayed on the screen.
Title:
Aim:
To Design and Develop an ML based Fitness Trainer using human pose estimation.
. 3.1 Objectives:
• To design and implement the pose estimation algorithm that compares the
detected develop with the ideal pose for a specific workout.
• To enable the system to provide real-time feedback to users based on the pose
comparison results.
CHAPTER4:-Problem Solving
4.1 Introduction
In the realm of fitness training, the fusion of machine learning and human pose
Estimation technologies has introduced in a new era of personalized guidance and
Feedback. Our exploration encompasses challenges such as accuracy in pose estimation,
robustness to environmental factors, personalization for diverse user needs, privacy
considerations, and optimizing user interfaces for seamless interaction.
a) Install and Setup: This is the initial where the necessary software and hardware
are installed and setup. This would be:
e) Dataset: The system likely uses a dataset to train the machine learning
algorithms. This dataset would contain examples of good and bad posture.
f) Make Detection: This step involves detecting the person and their posture
in the image or video feed.
h) Finding Angle: The system calculates the angles of various body parts to
assess the posture.
The bicep curl counter application successfully tracked and counted the user’s
bicep curl repetitions. The large green number ‘2’ indicates that two complete
bicep curls have been performed. The application provided real-time feedback
on the progress of the current repetition. The ‘87%’ displayed suggests that the
user was almost done with their third repetition.
6.1 Introduction
6.2 Summary
6.3 Conclusion
The future scope of this system involves further refinement and enhancement
of its individual components. Techniques such as reinforcement learning
could be explored to improve the adaptability and accuracy of exercise
counting algorithms. Additionally, integrating user-specific feedback
mechanisms and personalized workout recommendations could enhance the
overall user experience and effectiveness of the fitness trainer.
Team Experience
Collaborative Development:
Problem-solving Approach:
Maintaining code quality was essential to the success of our ML-based fitness
trainer. We conducted regular code reviews, focusing on consistency,
ML based Fitness Trainer using Human Pose Estimation 40
M.S.Ramaiah University of Applied Sciences – Faculty of Engineering and Technology (FET)
Agile Methodology:
Documentation:
References
• Flores, Asia, et al. "Verum fitness: An AI powered mobile fitness safety and improvement
application." 2021 IEEE 33rd international conference on tools with Artificial Intelligence
(ICTAI). IEEE, 2021.
• Akpan, Aniebiet, and Ahmed Aldabbagh. "Remote Body Fitness Monitoring System with
Inter-User/Multi-user tracking Software Applications and Social Distancing Warning Sensor."
2020 2nd International Conference on Electrical, Control and Instrumentation Engineering
(ICICLE). IEEE, 2020.
• Taware, Gourangi, et al. "AI-based Workout Assistant and Fitness guide." 2022 6th
International Conference On Computing, Communication, Control And Automation
(ICCUBEA).IEEE,2022.
• Dsouza, Grandel, Deepak Maurya, and Anoop Patel. "Smart gym trainer using Human pose
estimation." 2020 IEEE International Conference for Innovation in Technology
(INOCON). IEEE, 2020.
• Kanase, Rahul Ravikant, et al. "Pose Estimation and Correcting Exercise Posture." ITM
Web of Conferences. Vol. 40. EDP Sciences, 2021.
• Bazarevsky, Valentin, et al. "Blazepose: On-device real-time body pose tracking." arXiv
preprint \\arXiv:2006.10204 (2020).
• Chen, Lvcai, Chunyan Yu, and Li Chen. "A multi- person pose estimation with
LSTM for video stream." 2019 3rd international conference on electronic
information technology and computer engineering (EITCE). IEEE, 2019.
• “Composite fields for human pose estimation” by S Kreiss,L Bertoni, and A Alah, IEEE
Conference on Computer Vision and Pattern Recognition pages 11977–11986, 2019. 1.