A GRU model that improves the performance of adaptive oscillators in stop-go and go-stop situations.
Project description
ao_compensation_model
A GRU-based compensation model that improves the performance of adaptive oscillators (AOs) during stop-go and go-stop gait transitions. The model learns the phase error between the AO output and the ground-truth gait phase, and applies a real-time correction on edge devices via TFLite.
Pipeline
- Data Preparation (
prep) — Bandpass-filters raw IMU hip angles, extracts ground-truth gait phase via Hilbert-like analysis, and computes delta-phi training targets. - Training (
train) — Trains a GRU network on sliding windows of AO features, exports to an optimized TFLite model. - Validation (
validate) — Runs frame-by-frame TFLite inference on test data and visualises original AO phase vs. enhanced (AO + GRU) phase vs. ground truth.
Install
From PyPI:
pip install ao-compensation-model
From source:
git clone https://github.com/lhharry/ao_compensation_model.git
cd ao_compensation_model
uv sync
Development
- Install uv from Astral.
git clone git@github.com:lhharry/ao_compensation_model.gitmake init— create virtual environment and install dependenciesmake format— format code and run type checksmake test— run the test suite with coveragemake clean— delete temporary files and directories
Usage
As a CLI
# Prepare ground-truth targets from raw CSVs
uv run python -m ao_compensation_model prep
# Train the GRU model
uv run python -m ao_compensation_model train
# Validate on test data
uv run python -m ao_compensation_model validate
As a library
from ao_compensation_model.training import build_gru_model, compute_sample_weights
from ao_compensation_model.utils import bandpass_filter, extract_true_phase
from ao_compensation_model.validation import validate
Publishing
Pushing a version tag triggers automatic publishing to PyPI via GitHub Actions (Trusted Publishing):
# Update version in pyproject.toml, then:
git tag v0.1.1
git push origin --tags
Structure
├── src
│ └── ao_compensation_model
│ ├── __init__.py
│ ├── __main__.py
│ ├── app.py
│ ├── definitions.py
│ ├── gt_dataprep.py
│ ├── training.py
│ ├── utils.py
│ ├── validation.py
│ ├── dataset/
│ └── model/
├── tests
│ ├── __init__.py
│ ├── conftest.py
│ ├── app_test.py
│ ├── gt_dataprep_test.py
│ ├── training_test.py
│ └── utils_test.py
├── .github/workflows/
├── CONTRIBUTING.md
├── Dockerfile
├── LICENSE
├── Makefile
├── README.md
└── pyproject.toml
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ao_compensation_model-0.1.1.tar.gz.
File metadata
- Download URL: ao_compensation_model-0.1.1.tar.gz
- Upload date:
- Size: 10.5 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
45dcc77920c4d449ec6d387cadb3e8cc789a82012568f4618f52a9e1f2e5ee58
|
|
| MD5 |
421ce206bce681e0911a3a8044669480
|
|
| BLAKE2b-256 |
266919da14b3a429520388594db0fc94d6f6d467817b81438ea54192e66a5381
|
Provenance
The following attestation bundles were made for ao_compensation_model-0.1.1.tar.gz:
Publisher:
pypi-publish.yml on lhharry/ao_compensation_model
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ao_compensation_model-0.1.1.tar.gz -
Subject digest:
45dcc77920c4d449ec6d387cadb3e8cc789a82012568f4618f52a9e1f2e5ee58 - Sigstore transparency entry: 1044492547
- Sigstore integration time:
-
Permalink:
lhharry/ao_compensation_model@f08daca46a9748ba4d0407f4fb474c6e9bc6b3b8 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/lhharry
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@f08daca46a9748ba4d0407f4fb474c6e9bc6b3b8 -
Trigger Event:
push
-
Statement type:
File details
Details for the file ao_compensation_model-0.1.1-py3-none-any.whl.
File metadata
- Download URL: ao_compensation_model-0.1.1-py3-none-any.whl
- Upload date:
- Size: 10.6 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5065aa0c9cf71277f3f713c7fc5288adc672226fa7c8d45a48486a1cd298a26e
|
|
| MD5 |
4f9e0fab9e05ca48f491988b86f9f3bd
|
|
| BLAKE2b-256 |
6d7984a39da4a1cdaab8aea111d42a9e6c46bd99b40fbd18359147181201d4b0
|
Provenance
The following attestation bundles were made for ao_compensation_model-0.1.1-py3-none-any.whl:
Publisher:
pypi-publish.yml on lhharry/ao_compensation_model
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ao_compensation_model-0.1.1-py3-none-any.whl -
Subject digest:
5065aa0c9cf71277f3f713c7fc5288adc672226fa7c8d45a48486a1cd298a26e - Sigstore transparency entry: 1044492589
- Sigstore integration time:
-
Permalink:
lhharry/ao_compensation_model@f08daca46a9748ba4d0407f4fb474c6e9bc6b3b8 -
Branch / Tag:
refs/tags/v0.1.1 - Owner: https://github.com/lhharry
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yml@f08daca46a9748ba4d0407f4fb474c6e9bc6b3b8 -
Trigger Event:
push
-
Statement type: