Based on PoseNet infrastructure of this repository is based on this repo: (https://github.com/rwightman/posenet-python)
To install the required packages in a conda environment:
conda env create -f env.yml
conda activate tf2
A suitable Python 3.x environment with a recent version of Tensorflow is required. This relies on an older version of tensorflow, so it requires disabling tensorflow v2 behavior in any scripts:
import tensorflow.compat.v1 as tf tf.disable_v2_behavior()
This script downloads dataset from google cloud SDK. You'll need to have Google cloud set up with the posebucket info, according to https://cloud.google.com/sdk/docs/install-sdk. To download the data just run:
bash download_data.sh
TODO: add different models, or have scripts specific to each model
This script generates a keypoint csv of posenet keypoint ID's for a given input video, using mobilenet pose estimation.
python generate_keypoints.py
If you'd like to specifiy which video exactly you want analyzed:
python generate_keypoints.py --video [video file of interest]
TODO: add different models, or have scripts specific to each model
This script generates a stick figure animation from an input csv of keypoints
python make_keypoint_animation.py
This script plots variables of interest over a specified time region. It takes in a .csv file of keypoint coordinates and outputs pairs of plots (or grids of plots)
If you want to plot a single coordinate, try something like (where vars is a list of keypoints):
python make_plots.py
python make_plots.py --keypoint_folder [folder containing keypoint csv] --vars "NOSE" "LEFT_KNEE"
If you want to specify a time interval within which to plot:
python make_plots.py --keypoint_folder [folder containing keypoint csv] --start [start time (float number)] --end [end time (float number)] --vars "NOSE" "LEFT_KNEE"
And if you want to save the resulting plot:
python make_plots.py --keypoint_folder [folder containing keypoint csv] --start [start time (float number)] --end [end time (float number)] --save True --vars "NOSE" "LEFT_KNEE"`
The PoseNet and model infra structure of this repository is based on this repo: (https://github.com/rwightman/posenet-python)
The original model, weights, code, etc. was created by Google and can be found at https://github.com/tensorflow/tfjs-models/tree/master/posenet