Skip to main content

A Python package for 2D human spine keypoint estimation in the wild.

Project description

Towards Unconstrained 2D Pose Estimation of the Human Spine

Home Dataset Conference arXiv PyPI version PyPI - License


Abstract: We present SpineTrack, the first comprehensive dataset for 2D spine pose estimation in unconstrained settings, addressing a crucial need in sports analytics, healthcare, and realistic animation. Existing pose datasets often simplify the spine to a single rigid segment, overlooking the nuanced articulation required for accurate motion analysis. In contrast, SpineTrack annotates nine detailed spinal keypoints across two complementary subsets: a synthetic set comprising 25k annotations created using Unreal Engine with biomechanical alignment through OpenSim, and a real-world set comprising over 33k annotations curated via an active learning pipeline that iteratively refines automated annotations with human feedback. This integrated approach ensures anatomically consistent labels at scale, even for challenging, in-the-wild images. We further introduce SpinePose, extending state-of-the-art body pose estimators using knowledge distillation and an anatomical regularization strategy to jointly predict body and spine keypoints. Our experiments in both general and sports-specific contexts validate the effectiveness of SpineTrack for precise spine pose estimation, establishing a robust foundation for future research in advanced biomechanical analysis and 3D spine reconstruction in the wild.

Overview

Official repository for the CVPR 2025 workshop paper "Towards Unconstrained 2D Pose Estimation of the Human Spine" by Muhammad Saif Ullah Khan, Stephan Krauß, and Didier Stricker. This project provides an easy-to-install Python package, pretrained model checkpoints, the SpineTrack dataset, and evaluation scripts to reproduce our results.

If you use our models or dataset, please cite our work as described in the Citation section.


Inference

Recommended Python Version: 3.9–3.12

For quick spinal keypoint estimation, we release optimized ONNX models via the spinepose package on PyPI:

pip install spinepose

On Linux/Windows with CUDA available, install the GPU version:

pip install spinepose[gpu]

Using the CLI

usage: spinepose [-h] (--version | --input_path INPUT_PATH) [--vis-path VIS_PATH] [--save-path SAVE_PATH] [--mode {xlarge,large,medium,small}] [--nosmooth] [--spine-only]

SpinePose Inference

options:
  -h, --help            show this help message and exit
  --version, -V         Print the version and exit.
  --input_path INPUT_PATH, -i INPUT_PATH
                        Path to the input image or video
  --vis-path VIS_PATH, -o VIS_PATH
                        Path to save the output image or video
  --save-path SAVE_PATH, -s SAVE_PATH
                        Save predictions in OpenPose format (.json for image or folder for video).
  --mode {xlarge,large,medium,small}, -m {xlarge,large,medium,small}
                        Model size. Choose from: xlarge, large, medium, small (default: medium)
  --nosmooth            Disable keypoint smoothing for video inference (default: enabled)
  --spine-only          Only use 9 spine keypoints (default: use all 37 keypoints)

For example, to run inference on a video and save only spine keypoints in OpenPose format:

spinepose --input_path path/to/video.mp4 --save-path output_path.json --spine-only

This automatically downloads the model weights (if not already present) and outputs the annotated image or video. Use spinepose -h to view all available options, including GPU usage and confidence thresholds.

Using the Python API

import cv2
from spinepose import SpinePoseEstimator

# Initialize estimator (downloads ONNX model if not found locally)
estimator = SpinePoseEstimator(device='cuda')

# Perform inference on a single image
image = cv2.imread('path/to/image.jpg')
keypoints, scores = estimator(image)
visualized = estimator.visualize(image, keypoints, scores)
cv2.imwrite('output.jpg', visualized)

Or, for a simplified interface:

from spinepose.inference import infer_image, infer_video

# Single image inference
results = infer_image('path/to/image.jpg', vis_path='output.jpg')

# Video inference with optional temporal smoothing
results = infer_video('path/to/video.mp4', vis_path='output_video.mp4', use_smoothing=True)

SpineTrack Dataset

SpineTrack is available on HuggingFace. The dataset comprises:

  • SpineTrack-Real A collection of real-world images annotated with nine spinal keypoints in addition to standard body joints. An active learning pipeline, combining pretrained neural annotators and human corrections, refines keypoints across diverse poses.

  • SpineTrack-Unreal A synthetic subset rendered using Unreal Engine, paired with precise ground-truth from a biomechanically aligned OpenSim model. These synthetic images facilitate pretraining and complement real-world data.

To download:

git lfs install
git clone https://huggingface.co/datasets/saifkhichi96/spinetrack

Alternatively, use wget to download the dataset directly:

wget https://huggingface.co/datasets/saifkhichi96/spinetrack/resolve/main/annotations.zip
wget https://huggingface.co/datasets/saifkhichi96/spinetrack/resolve/main/images.zip

In both cases, the dataset will download two zipped folders: annotations (24.8 MB) and images (19.4 GB), which can be unzipped to obtain the following structure:

spinetrack
├── annotations/
│   ├── person_keypoints_train-real-coco.json
│   ├── person_keypoints_train-real-yoga.json
│   ├── person_keypoints_train-unreal.json
│   └── person_keypoints_val2017.json
└── images/
    ├── train-real-coco/
    ├── train-real-yoga/
    ├── train-unreal/
    └── val2017/

All annotations are in COCO format and can be used with standard pose estimation libraries.

Results and Evaluation

We benchmark SpinePose against state-of-the-art lightweight pose estimation methods on COCO, Halpe, and our SpineTrack dataset. The results are summarized below, with SpinePose models highlighted in gray. Only 26 body keypoints are used for Halpe evaluations.

Method Train Data Kpts COCO Halpe26 Body Feet Spine Overall Params (M) FLOPs (G)
APAR APAR APAR APAR APAR APAR
SimCC-MBV2COCO1762.067.833.243.972.175.60.00.00.00.00.10.12.290.31
RTMPose-tBody82665.971.368.073.276.980.074.179.70.00.015.817.93.510.37
RTMPose-sBody82669.774.772.076.780.983.678.983.50.00.017.219.45.700.70
SpinePose-sSpineTrack3768.273.170.675.279.182.177.582.989.690.784.286.25.980.72
SimCC-ViPNASCOCO1769.575.536.949.779.683.00.00.00.00.00.20.28.650.80
RTMPose-mBody82675.180.076.781.385.587.984.188.20.00.019.421.413.931.95
SpinePose-mSpineTrack3773.077.575.079.284.086.483.587.491.492.588.089.514.341.98
RTMPose-lBody82676.981.578.482.986.889.286.990.00.00.020.022.028.114.19
RTMW-mCocktail1413373.878.763.868.584.386.783.087.20.00.06.27.632.264.31
SimCC-ResNet50COCO1772.178.238.751.681.885.20.00.00.00.00.20.236.755.50
SpinePose-lSpineTrack3775.279.577.081.185.487.785.589.291.092.288.490.028.664.22
SimCC-ResNet50*COCO1773.479.039.852.483.286.20.00.00.00.00.30.343.2912.42
RTMPose-x*Body82678.883.480.084.488.690.688.491.40.00.021.022.950.0017.29
RTMW-l*Cocktail1413375.680.465.470.186.088.385.689.20.00.08.18.157.207.91
RTMW-l*Cocktail1413377.282.366.671.887.389.988.391.30.00.08.68.657.3517.69
SpinePose-x*SpineTrack3775.980.177.681.886.388.586.389.789.391.088.989.950.6917.37

For evaluation instructions and to reproduce the results reported in our paper, please refer to the evaluation branch of this repository:

git clone https://github.com/dfki-av/spinepose.git
cd spinepose
git checkout evaluation

The README in the evaluation branch provides detailed steps for setting up the evaluation environment and running the evaluation scripts on the SpineTrack dataset.


Citation

If this project or dataset proves helpful in your work, please cite:

@InProceedings{Khan_2025_CVPR,
    author    = {Khan, Muhammad Saif Ullah and Krau{\ss}, Stephan and Stricker, Didier},
    title     = {Towards Unconstrained 2D Pose Estimation of the Human Spine},
    booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR) Workshops},
    month     = {June},
    year      = {2025},
    pages     = {6171-6180}
}

License

This project is released under the CC-BY-NC-4.0 License. Commercial use is prohibited, and appropriate attribution is required for research or educational applications.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

spinepose-2.0.0.tar.gz (38.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

spinepose-2.0.0-py3-none-any.whl (39.1 kB view details)

Uploaded Python 3

File details

Details for the file spinepose-2.0.0.tar.gz.

File metadata

  • Download URL: spinepose-2.0.0.tar.gz
  • Upload date:
  • Size: 38.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for spinepose-2.0.0.tar.gz
Algorithm Hash digest
SHA256 20661f27f8c0a6fb94f588d9de22a1401846768093decf074fbf63462fbe87c3
MD5 bed68810b40d46b68e3f2554ac1f0d15
BLAKE2b-256 38a5ff0999625a4712166ff49aba97ecc3d6db29eb05109baf5115b2d3876e16

See more details on using hashes here.

Provenance

The following attestation bundles were made for spinepose-2.0.0.tar.gz:

Publisher: python-publish.yml on dfki-av/spinepose

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file spinepose-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: spinepose-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 39.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for spinepose-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6f951a6f1f2619e4ef38b2f58d7e626c48f9877bd156fdb98a17781a885edd7c
MD5 4e9cf9ad6a4ee7f33907af2b28c3c969
BLAKE2b-256 bd7a6f83008318ab8d41d7a80cfea14d30f7ca813eb5869fd3730bf64f9a8417

See more details on using hashes here.

Provenance

The following attestation bundles were made for spinepose-2.0.0-py3-none-any.whl:

Publisher: python-publish.yml on dfki-av/spinepose

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page