Skip to main content

A Python package for gait analysis using sensor data.

Project description

GaitSetPy ✨

DOI PyPI version Docs CodeRabbit Pull Request Reviews

GaitSetPy is a Python package for gait analysis and recognition. It provides clean, modern APIs to preprocess, analyze, extract features, classify, and visualize gait data across multiple datasets and modalities.


📚 Table of Contents


Features

  • Gait data preprocessing
  • Feature extraction (generic and dataset-specific)
  • Machine learning and deep learning models for recognition
  • Exploratory data analysis and visualization tools
  • Class-based API with legacy compatibility

Supported Datasets

IMU Sensor Based

  • Daphnet: https://archive.ics.uci.edu/dataset/245/daphnet+freezing+of+gait Supported
  • MobiFall: https://bmi.hmu.gr/the-mobifall-and-mobiact-datasets-2/ In Progress
  • HAR-UP (formerly UPFall): https://sites.google.com/up.edu.mx/har-up/ Supported
  • UrFall: https://fenix.ur.edu.pl/~mkepski/ds/uf.html Supported
  • Activity Net - Arduous: https://www.mad.tf.fau.de/research/activitynet/wearable-multi-sensor-gait-based-daily-activity-data/ In Progress

Pressure/Force Sensor Based

  • PhysioNet Gait in Parkinson's Disease: https://physionet.org/content/gaitpdb/1.0.0/ Completed

Installation

From PyPI:

pip install gaitsetpy

From source:

git clone https://github.com/Alohomora-Labs/gaitSetPy.git
python setup.py install

Optionally, also install requirements:

pip install -r requirements.txt

Quickstart

import gaitsetpy as gsp

# Daphnet: Load, window, extract features, visualize
loader = gsp.DaphnetLoader()
data, names = loader.load_data("data/daphnet")
windows = loader.create_sliding_windows(data, names, window_size=192, step_size=32)
extractor = gsp.GaitFeatureExtractor()
features = extractor.extract_features(windows[0]['windows'], fs=64)

from gaitsetpy.eda import SensorStatisticsAnalyzer
analyzer = SensorStatisticsAnalyzer()
analyzer.visualize(windows[0]['windows'], features, sensor_name="shank", start_idx=0, end_idx=1000, num_windows=15)

# Train & evaluate a Random Forest
rf = gsp.RandomForestModel(n_estimators=50, random_state=42, max_depth=10)
rf.train(features)
metrics = rf.evaluate(features)
print(metrics.get('accuracy'))

Examples: Notebooks and Scripts

  • Notebooks (examples/notebooks):
    • Daphnet_demo.ipynb, HARUP_demo.ipynb, PhysioNet_demo.ipynb, UrFall_demo.ipynb
    • Open with Jupyter: jupyter notebook examples/notebooks/HARUP_demo.ipynb
  • Scripts (examples/scripts):
    • daphnet_all_models_example.py, harup_example.py, physionet_example.py, urfall_example.py
    • Run via Python: python examples/scripts/harup_example.py

These examples mirror the latest APIs and are maintained alongside code updates.


Usage by Dataset (Code Snippets)

Below are minimal, copy-pasteable examples for each supported dataset.

Daphnet

import gaitsetpy as gsp
loader = gsp.DaphnetLoader()
data, names = loader.load_data("data/daphnet")
windows = loader.create_sliding_windows(data, names, window_size=192, step_size=32)
features = gsp.GaitFeatureExtractor().extract_features(windows[0]['windows'], fs=64)

HAR-UP

import gaitsetpy as gsp
loader = gsp.HARUPLoader()
harup_data, harup_names = loader.load_data("data/harup")
windows = loader.create_sliding_windows(harup_data, harup_names, window_size=100, step_size=50)
# Dataset-specific feature extraction
features_data = loader.extract_features(windows)

UrFall

import gaitsetpy as gsp
loader = gsp.UrFallLoader()
# Load pre-extracted depth-map features
data, names = loader.load_data("data/urfall", data_types=['features'], use_falls=True, use_adls=True)
windows = loader.create_sliding_windows(data, names, window_size=30, step_size=15)
# Filepaths for media modalities
video_paths = loader.get_file_paths("data/urfall", 'video')
depth_paths = loader.get_file_paths("data/urfall", 'depth', sequences=['fall-01'])
print(loader.get_activity_info())
print(loader.get_feature_info())

PhysioNet (VGRF)

import gaitsetpy as gsp
loader = gsp.PhysioNetLoader()
data, names = loader.load_data("data/physionet")
windows = loader.create_sliding_windows(data, names, window_size=600, step_size=100)
features = gsp.PhysioNetFeatureExtractor().extract_features(windows[0]['windows'], fs=100)
labels = loader.get_labels()

MobiFall

import gaitsetpy as gsp
loader = gsp.MobiFallLoader()
# Depending on your local dataset layout
data, names = loader.load_data("data/mobifall")
windows = loader.create_sliding_windows(data, names, window_size=256, step_size=64)
# Use generic gait feature extractor
features = gsp.GaitFeatureExtractor().extract_features(windows[0]['windows'], fs=50)

Arduous

import gaitsetpy as gsp
loader = gsp.ArduousLoader()
# Depending on ActivityNet/Arduous export and local layout
data, names = loader.load_data("data/arduous")
windows = loader.create_sliding_windows(data, names, window_size=256, step_size=64)
features = gsp.GaitFeatureExtractor().extract_features(windows[0]['windows'], fs=50)

Models

  • RandomForestModel (built-in, scikit-learn)
  • Optional deep learning models (LSTM, BiLSTM, CNN, GNN) if PyTorch is installed

Factory access via gaitsetpy.classification.models.get_classification_model(name, **kwargs).


Visualization

  • gaitsetpy.eda.SensorStatisticsAnalyzer
  • Dataset-specific visualizers for exploratory analysis

Documentation

For detailed documentation and API reference, visit the official docs:

  • Docs: https://alohomora-labs.github.io/gaitSetPy/gaitsetpy.html

Contributing

We welcome contributions! Please read our contributing guidelines to get started.


License

This project is licensed under the GNU GPL License. See the LICENSE file for details.


Citation

If you use GaitSetPy in your research, please cite our work using the DOI badge above.


Changelog

  • 0.2.2: README overhaul (ToC, vibrant styling), per-dataset examples, notebooks/scripts documentation, version sync.
  • See GitHub Releases for older entries.

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

gaitsetpy-0.2.2.tar.gz (6.0 MB view details)

Uploaded Source

Built Distribution

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

gaitsetpy-0.2.2-py3-none-any.whl (4.4 MB view details)

Uploaded Python 3

File details

Details for the file gaitsetpy-0.2.2.tar.gz.

File metadata

  • Download URL: gaitsetpy-0.2.2.tar.gz
  • Upload date:
  • Size: 6.0 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for gaitsetpy-0.2.2.tar.gz
Algorithm Hash digest
SHA256 e88c56d060eba450a2c9d92fa5d4b58aed4910a630c365f4d463a253a9543ee1
MD5 a1d8e1d9662719481ac657cece9014c1
BLAKE2b-256 1b43faf0ac040cdf020ed475bb0019e3385664569d32869a427fe68ae91701b8

See more details on using hashes here.

Provenance

The following attestation bundles were made for gaitsetpy-0.2.2.tar.gz:

Publisher: pypi.yml on Alohomora-Labs/gaitSetPy

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

File details

Details for the file gaitsetpy-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: gaitsetpy-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 4.4 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for gaitsetpy-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 2a8127320417e843b4be6d90c619d73d505c5c8aab1ce1ac1de8973721e04bd0
MD5 0edfdda5be133936c3f24786f101bbdc
BLAKE2b-256 8956365cb8eb6453688962e9dfeb62e4642607b8f6cfb8e4e89bbcd5552b9ea4

See more details on using hashes here.

Provenance

The following attestation bundles were made for gaitsetpy-0.2.2-py3-none-any.whl:

Publisher: pypi.yml on Alohomora-Labs/gaitSetPy

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