shukkkur / workout-tracker

Workout Tracking using Pose-Estimation

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Workout Tracking 🏋️


Count the number of repetitions for 3 exercises: bench press, overhead press and dumbbells curl

How it works

  1. Using mediapipe process video, detect body landmarks and write it into the csv (data_engineering.py).
  2. Train RandomForestClassifier on created csv with four classes: 'bench', 'curl', 'overhead' and 'other'(ml_model.py).
  3. Process a new video, classify the detected pose using the model (rf_classifier.pkl) and based on the classification calculate the angle of elbow and shoulder (calc_angle.py).
  4. If the calculated angle exceed a certain threshhold, increase counter by 1.

curl_sample overhead_sample bench_sample

How to run

  1. Clone this repository
  2. git clone https://github.com/ArtLabss/workout-tracking.git
    
  3. Install the requirements using pip
  4. pip install -r requirements.txt
  5. Run the following command in the command line
  6. python prediction.py --input_video_path=Input/bench_test.mp4 --output_video_path=Output/video_output.mp4 --draw_pose=0 --info=0
    • --input_video_path - path to the input video
    • --output_video_path - path to the output video, if not specified the video will be created in the same directory as input video
    • --draw_pose - if set to 1 the detected poses will be drawn, default is 0
    • --info - if 1 the probabilities of pose classification ([[prob_bench, prob_curl, prob_overhead, prob_other]]), elbow and shoulder angles, as well as which hands is used for calculating the angle will be shown, default is 0

    If you stumble upon an error or have any questions feel free to open a new Issue

About

Workout Tracking using Pose-Estimation

License:Creative Commons Zero v1.0 Universal


Languages

Language:Jupyter Notebook 98.1%Language:Python 1.9%