wbenbihi / hourglasstensorflow

Tensorflow implementation of Stacked Hourglass Networks for Human Pose Estimation
MIT License
479 stars 177 forks source link
newell pose-estimation stacked-hourglass-networks tensorflow

Stacked Hourglass Network for Human Pose Estimation

Python Version Latest Version Licence

Commit Activity Repo Size Issues Pull Requests Downloads

Build Status Test Status Publish Status

Tests Coverage Flake8

Stars Forks Watchers

This repository is a TensorFlow 2 implementation of A.Newell et Al, Stacked Hourglass Network for Human Pose Estimation

Project as part of MSc Computing Individual Project (Imperial College London 2017)

Model trained on MPII Human Pose Dataset

This project is an open-source repository developed by Walid Benbihi

Greetings

A special thanks to A.Newell for his answers. And to bhack for his feedbacks.

Setup

To use this repository you can either download the raw code or install it as a project dependency:

# Native pip
pip install git+https://github.com/wbenbihi/hourglasstensorlfow.git
# Poetry
poetry add git+https://github.com/wbenbihi/hourglasstensorlfow.git
# Pipenv
pipenv install git+https://github.com/nympy/numpy#egg=hourglasstensorflow

Run pip install poetry && poetry install if you are using the raw code

Dependencies

pydantic = "^1.9.2"
pandas = "^1.4.3"
numpy = "^1.23.2"
scipy = "^1.9.0"

NOTE

tensorflow is required but not referenced as a dependency.

Be sure to have tensorflow>=2.0.0 installed before using this repository.

Configuration

This repository handles TOML, JSON, YAML configuration files. Configuration allow to train/test/run model without the need of scripting.Examples

mode: train|test|inference|server # Determine what should be launch
data: # Configuration relative to input data and labels. Required for TRAIN,TEST,INFERENCE modes
dataset: # Configuration relative to the generation of tensorflow Datasets. Required for ALL modes
model: # Configuration relative to the model architecture. Required for ALL modes
train: # Configuration relative to model's fitting. Required for TRAIN mode

Full Configuration documentation is available in docs/CONFIG

Dataset

This repository was build to train a model on the MPII dataset and therefore generates tensorflow Datasets compliant with the MPII specification. The configuration file and CLI might reflect this decision.

You can use this model on any dataset of your choice. You can use the HourglassModel in your scripts to train a model. Or to integrate with the CLI and configuration files. You can customize your own _HTFDatasetHandler. Check the doc/HANDLERS for more details.

Training

Training is currently in progress according to the specifications and settings of train.default.yaml. Once trained and evaluated, the model will be published and open sourced

Results

Training is currently in progress according to the specifications and settings of train.default.yaml. Once trained and evaluated, the results will be published.

WARNING

The results will not be exploitable as an MPII submission. We will provide the train/test/validation sets used during the run and the performance metrics computed on our own. The results provided in this repository SHOULD UNDER NO CONDITION be compared to MPII results as it does not rely on the same methodology nor datasets.

CLI

Usage: htf [OPTIONS] COMMAND [ARGS]...

Options:
  --help  Show this message and exit.

Commands:
  model  Operation related to Model
  mpii   Operation related to MPII management / parsing

model

Usage: htf model [OPTIONS] COMMAND [ARGS]...

  Operation related to Model

Options:
  --help  Show this message and exit.

Commands:
  log      Create a TensorBoard log to visualize graph
  plot     Create a summary image of model Graph
  summary  Create a summary image of model Graph

mpii

Usage: htf mpii [OPTIONS] COMMAND [ARGS]...

  Operation related to MPII management / parsing

Options:
  --help  Show this message and exit.

Commands:
  convert  Convert a MPII .mat file to a HTF compliant record
  parse    Parse a MPII .mat file to a more readable record