Skip to main content

Reusable world-model-based domain-gap quantification for perception and actuation pipelines, before touching hardware.

Project description

worldgap

PyPI Open In Colab

Reusable world-model-based domain-gap quantification — for perception pipelines and actuator/mechanism models — before any hardware is touched.

Ground truth for this project's design is docs/TECHNICAL_SPEC.md. Read that before changing architecture, data schemas, or metric definitions.

What this is

Given two sets of rollouts (a source domain and a target domain — e.g. clean-lighting hand-tracking data vs. occluded/low-light data, or a simulated actuator vs. a published real-actuator characterization curve), worldgap trains a shared world model, encodes both domains into a common latent space, and reports a divergence score that is designed to predict real-world transfer degradation — validated against independently measured ground truth, not asserted.

One core library. Two current use cases, distinguished only by which encoder plugs in:

  • V1 — perception gap: MediaPipe landmark sequences. No hardware required.
  • V2 — actuation gap: pneumatic gel muscle (PGM) pressure/response sequences, using a published characterization curve as the "real" reference. No hardware required.
  • V3 — closed loop (not started, contingent on lab access): swaps in live logged telemetry from real hardware. Same core code, new data loader only — see spec Section 15.

Status

Core library, CLI, report generation, and demo notebook are implemented and tested end-to-end against synthetic/local data. Real-data phases (HaGRID/EgoHands MediaPipe extraction, the real Ogawa et al. PGM curve) are blocked on external access this environment doesn't have. See ROADMAP.md for the exact phase-by-phase status, and CHANGELOG.md for what's landed so far.

Install

pip install -e .                 # core: torch + the World Model, works for both modalities
pip install -e ".[perception]"   # + MediaPipe, for V1 data loading (HaGRID/EgoHands)
pip install -e ".[actuation]"    # + MuJoCo, for V2 data loading/simulation
pip install -e ".[dev]"          # test tooling

Quickstart

The library API works with any Rollout objects you construct yourself — the note below only applies to producing rollouts from raw HaGRID/EgoHands data, which still needs MediaPipe + real downloads (see ROADMAP Phase 0/1).

from worldgap import GapAnalyzer
from worldgap.config import GapConfig

config = GapConfig(modality="perception")
analyzer = GapAnalyzer(config)
analyzer.fit(train_rollouts)
result = analyzer.compute_gap(source_rollouts, target_rollouts)
print(result.frechet.distance, result.confidence)

See notebooks/demo.ipynb for a runnable end-to-end example (synthetic data, no external dependencies) covering both modalities, report generation, and the validation harness.

CLI

worldgap train    --modality perception --data-dir ./data/processed --config configs/v1_default.yaml
worldgap analyze  --source ./data/clean --target ./data/perturbed --modality perception --output report.html
worldgap validate --gap-scores results.csv --ground-truth degradation.csv

--data-dir/--source/--target are each a self-contained rollout store ({dir}/index.db + {dir}/{modality}/*.npz, built with Rollout.save() + RolloutIndex.add() — see tests/test_index.py). See src/worldgap/cli.py's module docstring for why this differs slightly from spec 5.3's single-shared-index diagram.

Why not a webapp

This is infra meant to be dropped into someone else's pipeline, not a hosted service. See spec Section 9 for the full API/CLI contract.

License

MIT — see LICENSE.

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

worldgap-0.1.0.tar.gz (67.7 kB view details)

Uploaded Source

Built Distribution

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

worldgap-0.1.0-py3-none-any.whl (42.5 kB view details)

Uploaded Python 3

File details

Details for the file worldgap-0.1.0.tar.gz.

File metadata

  • Download URL: worldgap-0.1.0.tar.gz
  • Upload date:
  • Size: 67.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for worldgap-0.1.0.tar.gz
Algorithm Hash digest
SHA256 3565efb5d328f6e7bb4e594870c6d78da2b205a14809ee3256a971d21333d264
MD5 c0e2aa70a943930eae7c547e574bb20e
BLAKE2b-256 cd08fff4af4a24d09e7ac6c64ec78ca43d8897f2d6156a862875143d96c69d00

See more details on using hashes here.

File details

Details for the file worldgap-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: worldgap-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 42.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for worldgap-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 734d80a225e72d9e3e6f17b1433ace93b19d18fac55765b993bd6674c60c2789
MD5 5f3bd7163a9e2579747796d4f570f0e3
BLAKE2b-256 6e999b98538e7cb2dababfc120d0c4246c33a13f19738613fd1f70a2150fb628

See more details on using hashes here.

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