A running analysis tool based on tensorflow's movenet thunder model!
TensorFlow MoveNet
Table of Contents
Tensorflow built several models for pose estimation based on computer vision techniques that detect human figures in images and videos. This allows, for example, to determine where someone's elbow shows up in an image. These pose estimation models take processed camera images as input and return information about keypoints, such as eyes, shoulders, and knees. Following the conclusive list of keypoints detected by these models.
- nose: 0
- left_eye: 1
- right_eye: 2
- left_ear: 3
- right_ear: 4
- left_shoulder: 5
- right_shoulder: 6
- left_elbow: 7
- right_elbow: 8
- left_wrist: 9
- right_wrist: 10
- left_hip: 11
- right_hip: 12
- left_knee: 13
- right_knee: 14
- left_ankle: 15
- right_ankle: 16
This project builds on top of one of these pretrained models, MoveNet Thunder, using its infered keypoints for running analysis in athletes (see 'Example' section down below). This iteration of the project is solely concerned with extracting relevant parameters from brief video sequences. The main.py script allows to toggle between parameters of interest.
The next iteration of the project implements real time camera input, while still extracting analytics from the video stream. This necessitates optimized code such that the frame rate is still adequate for analysis.
Following an example of some parameters that are extracted by the movenet_running_analysis scripts.
- VD (relative to leg length) is the maximum vertical distance the center of mass has traveled.
- Left knee angle is the angle formed by ankle, knee and hip of the left leg.
- Right knee angle is the angle formed by ankle, knee and hip of the right leg.
- Knee angle min. is the minimum angle formed by the ankle, knee and hip of either leg.
- Total steps is a counter of the steps taken.
- Cadence measures steps per minute.
- Leading ankle to CoM max. (relative to leg length) the maximum distance an ankle came in front of the center of mass (CoM).
- Trailing ankle max. (relative to leg length) the maximum distance an ankle traveled behind the center of mass (CoM).
There are plenty more metrics that can be toggled, depending on the analysis one aims to do.
Clone and apply this running analysis tool on your own device.
- Clone the repo
gh repo clone Schiggy-3000/movenet_running_analysis
- Navigate to project
cd \path\to\movenet_running_analysis
- Build virtual environment
python -m venv myvenv
- Activate virtual environment
.\myvenv\Scripts\activate
- Install dependencies
pip install -r requirements.txt
- Execute main.py
python.exe .\main.py