Giter Club home page Giter Club logo

sravb / computer-vision-weightlifting-coach Goto Github PK

View Code? Open in Web Editor NEW
39.0 3.0 8.0 24.58 MB

Analyzes weightlifting videos for correct posture using pose estimation with OpenCV

License: MIT License

CMake 0.01% C++ 0.09% Python 0.07% Jupyter Notebook 99.82% Shell 0.02%
computer-vision machine-learning lasso-regression ridge-regression random-forest elastic-net logistic-regression weightlifting keypoint-detection pose-estimation mpii-dataset ensemble-learning opencv openpose

computer-vision-weightlifting-coach's Introduction

Computer-Vision-Weightlifting-Coach

Download pose_iter_160000.caffemodel online (http://posefs1.perception.cs.cmu.edu/OpenPose/models/pose/mpi/pose_iter_160000.caffemodel) and put it in pose/mpi/pose_iter_160000.caffemodel

Run the jupyter notebook and enjoy! Below is an analysis on how this project was created.

deadliftgif

This project analyzes videos/images of the deadlift (one of the most fundamental weightlifting exercises) and scores the posture of the person performing the deadlift from a range of 0 to 1.

This process can be simplified into a few main parts:

  1. Analyze videos/gifs frame by frame (for high fps videos we can analyze every X frames since frames will be very repititive and tune X accordingly to satisfy our needs). We will use the OpenCV object VideoWriter.
  2. For each frame we score the exercise posture.
  3. First we feed our image into an open source OpenPose keypoint detection model for human pose detection (this model has been pre-trained with ~40 000 examples using the MPII dataset). This gives us locations of specific joints (right shoulder, left elbow, etc) and then using the locations of these joints we can feed this data to a classification model to predict whether the performer of the exercise is in correct posture or not.

Some examples below from images at this stage of our pipeline:

deadlift deadlift2

  1. Our classification step involves using a machine learning model to classify the posture of the individual performing the deadlift. Various models were experimented with such as Random Forest, Elastic Net, Lasso, Ridge, and Logistic Regression (and ensemble learning methods) but Ridge seemed to perform best on the given dataset.
  2. The final step involves taking each posture score and printing this information onto the frame of the video (along with the time taken to classify the frame) and write each frame to our output VideoWriter object. Once all desired frames have been scored, we release our VideoWriter object.

Next Steps

Overall we are able to analyze our deadlifting videos with some help with computer vision. The next step in this project would be expanding the data set for posture classification (step 4). The main challenge is finding a large enough data set to build a model that can generalize well and avoid overfitting to the small data set. However if a sufficient amount of exercise posture data is aggregated, our model can become extremely useful for fitness enthusiasts.

Built using pre-trained weights for OpenPose keypoint detection using the MPII pose estimation dataset (see https://github.com/spmallick/learnopencv for OpenPose example and other computer vision examples), Python, OpenCV, Scikit-Learn, Jupyter Notebook.

computer-vision-weightlifting-coach's People

Contributors

sravb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.