Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
160 changes: 160 additions & 0 deletions docs/projects/computer-vision/counting-bicep-reps.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,160 @@
# Counting Bicep Reps


### AIM
To track and count bicep curls in real time using computer vision techniques with OpenCV and Mediapipe's Pose module.

### DATASET LINK
This project does not use a specific dataset as it works with real-time video from a webcam.


### NOTEBOOK LINK
[https://drive.google.com/file/d/13Omm8Zy0lmtjmdHgfQbraBu3NJf3wknw/view?usp=sharing](https://drive.google.com/file/d/13Omm8Zy0lmtjmdHgfQbraBu3NJf3wknw/view?usp=sharing)


### LIBRARIES NEEDED

??? quote "LIBRARIES USED"

- OpenCV
- Mediapipe
- NumPy

---

### DESCRIPTION

!!! info "What is the requirement of the project?"
- The project aims to provide a computer vision-based solution for tracking fitness exercises like bicep curls without the need for wearable devices or sensors.

??? info "Why is it necessary?"
- Helps fitness enthusiasts monitor their workouts in real time.
- Provides an affordable and accessible alternative to wearable fitness trackers.

??? info "How is it beneficial and used?"
- Real-time feedback on workout form and repetition count.
- Can be extended to other fitness exercises and integrated into fitness apps

??? info "How did you start approaching this project? (Initial thoughts and planning)"
- Explored Mediapipe's Pose module for pose landmark detection.
- Integrated OpenCV for video frame processing and real-time feedback.
- Planned the logic for detecting curls based on elbow angle thresholds.

??? info "Mention any additional resources used (blogs, books, chapters, articles, research papers, etc.)."
- Mediapipe official documentation.
- OpenCV tutorials on video processing.


---

### EXPLANATION

#### DETAILS OF THE DIFFERENT FEATURES
- Pose Estimation: Utilized Mediapipe's Pose module to detect key landmarks on the human body.
- Angle Calculation: Calculated angles at the elbow joints to determine curl movement.
- Rep Tracking: Incremented rep count when alternating between full curl and relaxed positions.
- Real-Time Feedback: Displayed the remaining curl count on the video feed.


---

#### PROJECT WORKFLOW

=== "Step 1"
Initial setup:
- Installed OpenCV and Mediapipe.
- Set up a webcam feed for video capture.


=== "Step 2"
Pose detection:
- Used Mediapipe's Pose module to identify body landmarks.


=== "Step 3"
Angle calculation:
- Implemented a function to calculate the angle between shoulder, elbow, and wrist.


=== "Step 4"
Rep detection:
- Monitored elbow angles to track upward and downward movements.


=== "Step 5"
Real-time feedback:
- Displayed the remaining number of curls on the video feed using OpenCV.


=== "Step 6"
Completion:
- Stopped the program when the target reps were completed or on manual exit.


---

#### PROJECT TRADE-OFFS AND SOLUTIONS

=== "Trade Off 1"
- Accuracy vs. Simplicity:
- Using elbow angles alone may not handle all body postures but ensures simplicity.
- Solution: Fine-tuned angle thresholds and added tracking for alternating arms.

=== "Trade Off 2"
- Real-Time Performance vs. Model Complexity:
- Mediapipe's lightweight solution ensured smooth processing over heavier models.

---

### SCREENSHOTS

1. Entering no of reps you want to perform
![Screenshot 2025-01-19 184454](https://github.com/user-attachments/assets/afac56f4-c0ce-45ec-8f41-1b7effc02e5a)


3. Performing reps
![Screenshot 2025-01-19 184607](https://github.com/user-attachments/assets/667b3e10-22b0-48a0-8e9b-42c3dcfc9f66)



!!! success "Project workflow"

```mermaid
graph LR
A[Webcam Feed] --> F[Enter No of Biceps Reps]
F --> B[Mediapipe Pose Detection]
B --> C[Elbow Angle Calculation]
C --> D[Rep Count Decrement]
D --> E[Real-Time Update on Frsame]
```

---

### CONCLUSION

#### KEY LEARNINGS

!!! tip "Insights gained from the data"
- Real-time video processing using OpenCV.
- Pose detection and landmark analysis with Mediapipe.

??? tip "Improvements in understanding machine learning concepts"
- Understanding geometric computations in pose analysis.
- Effective use of pre-trained models like Mediapipe Pose.

??? tip "Challenges faced and how they were overcome"
- Challenge: Handling incorrect postures.
- Solution: Fine-tuning angle thresholds.

---

#### USE CASES
=== "Application 1"

**Personal Fitness Tracker**
- Helps users track their workouts without additional equipment.

=== "Application 2"

**Fitness App Integration**
- Can be integrated into fitness apps for real-time exercise tracking.
9 changes: 9 additions & 0 deletions docs/projects/computer-vision/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,13 @@
</div>
</a>

<!-- bicep reps counting -->
<a href="counting-bicep-reps" style="padding: 0 2px 0 16px; background-color: rgba(39, 39, 43, 0.4); border: 1px solid rgba(76, 76, 82, 0.4); border-radius: 10px; box-shadow: 0 4px 8px rgba(0,0,0,0.1); overflow: hidden; transition: transform 0.2s; display: flex; align-items: center;">
<img src="https://www.researchgate.net/publication/368864097/figure/fig1/AS:11431281123465557@1677717597497/Mediapipe-Poses-position-detection-of-33-posture-joints-Mediapipe-has-many-functions.png" alt="OpenCV Logo" style="width: 300px; height: 150px; object-fit: cover; border-radius: 10px;" />
<div style="padding: 15px;">
<h2 style="margin: 0; font-size: 20px;">Counting Bicep Reps</h2>
<p style="font-size: 16px;">Real-time tracking and counting of bicep curls with Mediapipe's Pose module and OpenCV.</p>
<p style="font-size: 12px;">📅 2025-01-18 | ⏱️ 15 mins</p>
</div>
</a>
</div>