s2s-certify 1.4.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- s2s_certify-1.4.0/LICENSE +47 -0
- s2s_certify-1.4.0/PKG-INFO +279 -0
- s2s_certify-1.4.0/README.md +196 -0
- s2s_certify-1.4.0/pyproject.toml +56 -0
- s2s_certify-1.4.0/s2s_certify.egg-info/PKG-INFO +279 -0
- s2s_certify-1.4.0/s2s_certify.egg-info/SOURCES.txt +24 -0
- s2s_certify-1.4.0/s2s_certify.egg-info/dependency_links.txt +1 -0
- s2s_certify-1.4.0/s2s_certify.egg-info/entry_points.txt +2 -0
- s2s_certify-1.4.0/s2s_certify.egg-info/requires.txt +12 -0
- s2s_certify-1.4.0/s2s_certify.egg-info/top_level.txt +1 -0
- s2s_certify-1.4.0/s2s_standard_v1_3/__init__.py +0 -0
- s2s_certify-1.4.0/s2s_standard_v1_3/constants.py +177 -0
- s2s_certify-1.4.0/s2s_standard_v1_3/convert_to_s2s.py +488 -0
- s2s_certify-1.4.0/s2s_standard_v1_3/s2s_api_v1_3.py +495 -0
- s2s_certify-1.4.0/s2s_standard_v1_3/s2s_emg_certify_v1_3.py +577 -0
- s2s_certify-1.4.0/s2s_standard_v1_3/s2s_fusion_v1_3.py +306 -0
- s2s_certify-1.4.0/s2s_standard_v1_3/s2s_lidar_certify_v1_3.py +530 -0
- s2s_certify-1.4.0/s2s_standard_v1_3/s2s_ml_interface.py +373 -0
- s2s_certify-1.4.0/s2s_standard_v1_3/s2s_physics_v1_3.py +614 -0
- s2s_certify-1.4.0/s2s_standard_v1_3/s2s_ppg_certify_v1_3.py +591 -0
- s2s_certify-1.4.0/s2s_standard_v1_3/s2s_registry_v1_3.py +484 -0
- s2s_certify-1.4.0/s2s_standard_v1_3/s2s_signing_v1_3.py +427 -0
- s2s_certify-1.4.0/s2s_standard_v1_3/s2s_stream_certify_v1_3.py +549 -0
- s2s_certify-1.4.0/s2s_standard_v1_3/s2s_thermal_certify_v1_3.py +443 -0
- s2s_certify-1.4.0/setup.cfg +4 -0
- s2s_certify-1.4.0/tests/test_physics_laws.py +349 -0
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
Business Source License 1.1
|
|
2
|
+
|
|
3
|
+
Parameters
|
|
4
|
+
|
|
5
|
+
Licensor: Timur Davkarayev
|
|
6
|
+
Licensed Work: S2S — SCAN2SELL Physical Motion Certification v1.3
|
|
7
|
+
The Licensed Work is (c) 2026 Timur Davkarayev
|
|
8
|
+
Additional Use Grant: You may use the Licensed Work for research, education,
|
|
9
|
+
and non-commercial personal projects without restriction.
|
|
10
|
+
Change Date: 2028-01-01
|
|
11
|
+
Change License: Apache License, Version 2.0
|
|
12
|
+
|
|
13
|
+
For information about alternative licensing arrangements for the Licensed Work,
|
|
14
|
+
please contact: timur.davkarayev@gmail.com
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
Business Source License 1.1
|
|
19
|
+
|
|
20
|
+
Terms
|
|
21
|
+
|
|
22
|
+
The Licensor hereby grants you the right to copy, modify, create derivative
|
|
23
|
+
works, redistribute, and make non-production use of the Licensed Work.
|
|
24
|
+
|
|
25
|
+
The Licensor may make an Additional Use Grant, above, permitting limited
|
|
26
|
+
production use.
|
|
27
|
+
|
|
28
|
+
Effective on the Change Date, or the fourth anniversary of the first publicly
|
|
29
|
+
available distribution of a specific version of the Licensed Work under this
|
|
30
|
+
License, whichever comes first, the Licensor hereby grants you rights under
|
|
31
|
+
the terms of the Change License, and the rights granted in the paragraph
|
|
32
|
+
above terminate.
|
|
33
|
+
|
|
34
|
+
If your use of the Licensed Work does not comply with the requirements
|
|
35
|
+
currently in effect as described in this License, you must purchase a
|
|
36
|
+
commercial license from the Licensor, its affiliated entities, or authorized
|
|
37
|
+
resellers, or you must refrain from using the Licensed Work.
|
|
38
|
+
|
|
39
|
+
All copies of the original and modified Licensed Work, and derivative works
|
|
40
|
+
of the Licensed Work, are subject to this License. This License applies
|
|
41
|
+
separately for each version of the Licensed Work, and the Change Date may
|
|
42
|
+
vary for each version of the Licensed Work released by Licensor.
|
|
43
|
+
|
|
44
|
+
You must conspicuously display this License on each original or modified copy
|
|
45
|
+
of the Licensed Work. If you receive the Licensed Work in original or modified
|
|
46
|
+
form from a third party, the terms and conditions set forth in this License
|
|
47
|
+
apply to your use of that work.
|
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: s2s-certify
|
|
3
|
+
Version: 1.4.0
|
|
4
|
+
Summary: Physics-certified motion data toolkit for Physical AI training
|
|
5
|
+
Author-email: Timur Davkarayev <timur.davkarayev@gmail.com>
|
|
6
|
+
License: Business Source License 1.1
|
|
7
|
+
|
|
8
|
+
Parameters
|
|
9
|
+
|
|
10
|
+
Licensor: Timur Davkarayev
|
|
11
|
+
Licensed Work: S2S — SCAN2SELL Physical Motion Certification v1.3
|
|
12
|
+
The Licensed Work is (c) 2026 Timur Davkarayev
|
|
13
|
+
Additional Use Grant: You may use the Licensed Work for research, education,
|
|
14
|
+
and non-commercial personal projects without restriction.
|
|
15
|
+
Change Date: 2028-01-01
|
|
16
|
+
Change License: Apache License, Version 2.0
|
|
17
|
+
|
|
18
|
+
For information about alternative licensing arrangements for the Licensed Work,
|
|
19
|
+
please contact: timur.davkarayev@gmail.com
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
Business Source License 1.1
|
|
24
|
+
|
|
25
|
+
Terms
|
|
26
|
+
|
|
27
|
+
The Licensor hereby grants you the right to copy, modify, create derivative
|
|
28
|
+
works, redistribute, and make non-production use of the Licensed Work.
|
|
29
|
+
|
|
30
|
+
The Licensor may make an Additional Use Grant, above, permitting limited
|
|
31
|
+
production use.
|
|
32
|
+
|
|
33
|
+
Effective on the Change Date, or the fourth anniversary of the first publicly
|
|
34
|
+
available distribution of a specific version of the Licensed Work under this
|
|
35
|
+
License, whichever comes first, the Licensor hereby grants you rights under
|
|
36
|
+
the terms of the Change License, and the rights granted in the paragraph
|
|
37
|
+
above terminate.
|
|
38
|
+
|
|
39
|
+
If your use of the Licensed Work does not comply with the requirements
|
|
40
|
+
currently in effect as described in this License, you must purchase a
|
|
41
|
+
commercial license from the Licensor, its affiliated entities, or authorized
|
|
42
|
+
resellers, or you must refrain from using the Licensed Work.
|
|
43
|
+
|
|
44
|
+
All copies of the original and modified Licensed Work, and derivative works
|
|
45
|
+
of the Licensed Work, are subject to this License. This License applies
|
|
46
|
+
separately for each version of the Licensed Work, and the Change Date may
|
|
47
|
+
vary for each version of the Licensed Work released by Licensor.
|
|
48
|
+
|
|
49
|
+
You must conspicuously display this License on each original or modified copy
|
|
50
|
+
of the Licensed Work. If you receive the Licensed Work in original or modified
|
|
51
|
+
form from a third party, the terms and conditions set forth in this License
|
|
52
|
+
apply to your use of that work.
|
|
53
|
+
|
|
54
|
+
Project-URL: Homepage, https://github.com/timbo4u1/S2S
|
|
55
|
+
Project-URL: Repository, https://github.com/timbo4u1/S2S
|
|
56
|
+
Project-URL: Bug Tracker, https://github.com/timbo4u1/S2S/issues
|
|
57
|
+
Project-URL: Documentation, https://timbo4u1.github.io/S2S
|
|
58
|
+
Keywords: biomechanics,imu,motion-capture,physical-ai,robotics,prosthetics,sensor-certification,physics
|
|
59
|
+
Classifier: Development Status :: 4 - Beta
|
|
60
|
+
Classifier: Intended Audience :: Science/Research
|
|
61
|
+
Classifier: Intended Audience :: Developers
|
|
62
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
63
|
+
Classifier: Topic :: Scientific/Engineering :: Medical Science Apps.
|
|
64
|
+
Classifier: Programming Language :: Python :: 3
|
|
65
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
66
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
67
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
68
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
69
|
+
Classifier: Operating System :: OS Independent
|
|
70
|
+
Requires-Python: >=3.9
|
|
71
|
+
Description-Content-Type: text/markdown
|
|
72
|
+
License-File: LICENSE
|
|
73
|
+
Provides-Extra: ml
|
|
74
|
+
Requires-Dist: torch>=2.0; extra == "ml"
|
|
75
|
+
Requires-Dist: numpy>=1.24; extra == "ml"
|
|
76
|
+
Provides-Extra: dashboard
|
|
77
|
+
Requires-Dist: streamlit>=1.30; extra == "dashboard"
|
|
78
|
+
Requires-Dist: numpy>=1.24; extra == "dashboard"
|
|
79
|
+
Provides-Extra: dev
|
|
80
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
81
|
+
Requires-Dist: pytest-cov; extra == "dev"
|
|
82
|
+
Dynamic: license-file
|
|
83
|
+
|
|
84
|
+
# S2S — Physical Motion Certification
|
|
85
|
+
|
|
86
|
+
**Physics-certified motion data for prosthetics, robotics, and Physical AI.**
|
|
87
|
+
|
|
88
|
+
S2S is a physics validation layer for human motion sensor data. Before training a prosthetic hand, surgical robot, or humanoid — run your IMU data through S2S. It verifies the data obeys 7 biomechanical laws and issues a cryptographic certificate. Bad data gets rejected before it reaches your model.
|
|
89
|
+
|
|
90
|
+
[](https://github.com/timbo4u1/S2S/actions/workflows/ci.yml)
|
|
91
|
+
[](https://github.com/timbo4u1/S2S/actions/workflows/ci.yml)
|
|
92
|
+
[](LICENSE)
|
|
93
|
+
[](README.md)
|
|
94
|
+
[](README.md)
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## Live Demos
|
|
99
|
+
|
|
100
|
+
**[→ IMU Demo — open on your phone](https://timbo4u1.github.io/S2S)** · Real-time certification using phone accelerometer + gyroscope
|
|
101
|
+
|
|
102
|
+
**[→ Pose Demo — camera + skeleton](https://timbo4u1.github.io/S2S/pose.html)** · 17-joint body tracking with live physics certification
|
|
103
|
+
|
|
104
|
+
No install needed. All processing runs on your device. No data sent anywhere.
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
108
|
+
## The Problem
|
|
109
|
+
|
|
110
|
+
Physical AI (robots, prosthetics, exoskeletons) is trained on motion data. But most datasets contain synthetic data that violates physics, corrupted recordings, and mislabeled actions — with no way to verify the data came from a real human moving in physically valid ways.
|
|
111
|
+
|
|
112
|
+
A robot trained on bad data learns bad motion. A prosthetic hand trained on uncertified data fails its user.
|
|
113
|
+
|
|
114
|
+
## The Solution
|
|
115
|
+
|
|
116
|
+
S2S applies **7 biomechanical physics laws** to every sensor record:
|
|
117
|
+
|
|
118
|
+
| Law | Source | What it checks |
|
|
119
|
+
|-----|--------|----------------|
|
|
120
|
+
| Newton F=ma coupling | Newton 1687 | EMG force precedes acceleration by 75ms |
|
|
121
|
+
| Rigid body kinematics | Euler | a = αxr + ωxωxr holds at every joint |
|
|
122
|
+
| Resonance frequency | Flash-Hogan 1985 | Forearm tremor is 8-12Hz |
|
|
123
|
+
| Jerk bounds | Flash-Hogan 1985 | Human motion <= 500 m/s3 |
|
|
124
|
+
| IMU consistency | Sensor physics | Accel and gyro from same chip must couple |
|
|
125
|
+
| BCG heartbeat | Starr 1939 | Heart stroke visible in wrist IMU |
|
|
126
|
+
| Joule heating | Ohm 1827 | EMG power matches thermal output |
|
|
127
|
+
|
|
128
|
+
Every passing record is **Ed25519 signed** — tamper-evident, machine-verifiable.
|
|
129
|
+
|
|
130
|
+
## Real Result (iPhone 11, real human hand)
|
|
131
|
+
```
|
|
132
|
+
Real human hand: rigid_body r=0.35 imu_consistency r=0.35 SILVER 69/100
|
|
133
|
+
Synthetic data: rigid_body r=-0.01 imu_consistency r=-0.01 BRONZE 53/100
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
S2S correctly distinguishes real human motion from synthetic using physics alone.
|
|
137
|
+
|
|
138
|
+
## Motion Domain Taxonomy
|
|
139
|
+
|
|
140
|
+
Based on Flash-Hogan 1985, Bernstein 1967, Fitts 1954, Wolpert 1998 (MOSAIC model):
|
|
141
|
+
|
|
142
|
+
| Domain | Jerk | Coupling r | Robot use |
|
|
143
|
+
|--------|------|------------|-----------|
|
|
144
|
+
| PRECISION | 80 m/s3 | 0.30 | Surgical robots, prosthetic hands, assembly |
|
|
145
|
+
| SOCIAL | 180 m/s3 | 0.15 | Service robots, HRI |
|
|
146
|
+
| LOCOMOTION | 300 m/s3 | 0.15 | Bipedal robots, prosthetic legs |
|
|
147
|
+
| DAILY_LIVING | 150 m/s3 | 0.20 | Home robots, elder care |
|
|
148
|
+
| SPORT | 500 m/s3 | 0.10 | Athletic training, motion analysis |
|
|
149
|
+
|
|
150
|
+
## Quick Start
|
|
151
|
+
```bash
|
|
152
|
+
git clone https://github.com/timbo4u1/S2S.git
|
|
153
|
+
cd S2S
|
|
154
|
+
python3 -c "from s2s_standard_v1_3.s2s_physics_v1_3 import PhysicsEngine; print('OK')"
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
### Certify your IMU data
|
|
158
|
+
```python
|
|
159
|
+
from s2s_standard_v1_3.s2s_physics_v1_3 import PhysicsEngine
|
|
160
|
+
|
|
161
|
+
result = PhysicsEngine().certify(
|
|
162
|
+
imu_raw={
|
|
163
|
+
"timestamps_ns": [...],
|
|
164
|
+
"accel": [...],
|
|
165
|
+
"gyro": [...],
|
|
166
|
+
},
|
|
167
|
+
segment="forearm"
|
|
168
|
+
)
|
|
169
|
+
print(result['physics_tier']) # SILVER
|
|
170
|
+
print(result['physics_score']) # 69
|
|
171
|
+
print(result['laws_passed'])
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### Record with iPhone (free)
|
|
175
|
+
```bash
|
|
176
|
+
# 1. Install "Sensor Logger" app (free, iOS/Android)
|
|
177
|
+
# 2. Enable: AccelerometerUncalibrated + GyroscopeUncalibrated + Gravity
|
|
178
|
+
# 3. Record motion, export CSV, run:
|
|
179
|
+
python3 collect_action.py --accel AccelerometerUncalibrated.csv --gyro GyroscopeUncalibrated.csv --gravity Gravity.csv --label reach_forward --person your_name --out dataset/
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### Build certified dataset from public data
|
|
183
|
+
```bash
|
|
184
|
+
# UCI HAR: 30 subjects, 6 activities, 50Hz (24MB)
|
|
185
|
+
wget "https://archive.ics.uci.edu/ml/machine-learning-databases/00240/UCI%20HAR%20Dataset.zip"
|
|
186
|
+
unzip "UCI HAR Dataset.zip"
|
|
187
|
+
python3 s2s_dataset_adapter.py --dataset uci_har --input "UCI HAR Dataset/" --out s2s_dataset/
|
|
188
|
+
|
|
189
|
+
# PAMAP2: 9 subjects, 18 activities, 100Hz (500MB)
|
|
190
|
+
wget "https://archive.ics.uci.edu/ml/machine-learning-databases/00231/PAMAP2_Dataset.zip"
|
|
191
|
+
unzip PAMAP2_Dataset.zip
|
|
192
|
+
python3 s2s_dataset_adapter.py --dataset pamap2 --input PAMAP2_Dataset/ --out s2s_dataset/
|
|
193
|
+
|
|
194
|
+
# WISDM: 51 subjects, 18 activities, 20Hz (295MB)
|
|
195
|
+
curl -L -o wisdm-dataset.zip "https://archive.ics.uci.edu/ml/machine-learning-databases/00507/wisdm-dataset.zip"
|
|
196
|
+
unzip wisdm-dataset.zip -d wisdm-dataset/
|
|
197
|
+
python3 wisdm_adapter.py --input wisdm-dataset/ --out s2s_dataset/ --device phone
|
|
198
|
+
|
|
199
|
+
# Train domain classifier
|
|
200
|
+
python3 train_classifier.py --dataset s2s_dataset/ --test
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
## Package Structure
|
|
204
|
+
```
|
|
205
|
+
s2s_standard_v1_3/
|
|
206
|
+
├── s2s_physics_v1_3.py 7 biomechanical physics laws
|
|
207
|
+
├── s2s_stream_certify_v1_3.py Real-time IMU stream certification
|
|
208
|
+
├── s2s_emg_certify_v1_3.py EMG certification
|
|
209
|
+
├── s2s_fusion_v1_3.py 5-sensor fusion + HIL score
|
|
210
|
+
├── s2s_signing_v1_3.py Ed25519 signing + verification
|
|
211
|
+
├── s2s_api_v1_3.py REST API server
|
|
212
|
+
└── ... (12 modules total)
|
|
213
|
+
|
|
214
|
+
collect_action.py Record labeled actions from phone
|
|
215
|
+
s2s_dataset_adapter.py Convert UCI HAR and PAMAP2
|
|
216
|
+
wisdm_adapter.py Convert WISDM (51 subjects, 18 activities)
|
|
217
|
+
train_classifier.py 5-domain classifier (pure Python, zero deps)
|
|
218
|
+
|
|
219
|
+
docs/
|
|
220
|
+
├── index.html Live IMU demo (phone sensors)
|
|
221
|
+
└── pose.html Live pose demo (camera + skeleton)
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
## Certification Tiers
|
|
225
|
+
|
|
226
|
+
| Tier | Score | Meaning |
|
|
227
|
+
|------|-------|---------|
|
|
228
|
+
| GOLD | 90-100 | All laws pass — hardware-grade |
|
|
229
|
+
| SILVER | 60-89 | Core laws pass — suitable for training |
|
|
230
|
+
| BRONZE | 30-59 | Partial pass — use with caution |
|
|
231
|
+
| REJECTED | 0-29 | Physics violations detected |
|
|
232
|
+
|
|
233
|
+
## Supported Open Datasets
|
|
234
|
+
|
|
235
|
+
| Dataset | Subjects | Activities | Hz | Direct S2S |
|
|
236
|
+
|---------|----------|------------|-----|------------|
|
|
237
|
+
| UCI HAR | 30 | 6 | 50 | Yes |
|
|
238
|
+
| PAMAP2 | 9 | 18 | 100 | Yes |
|
|
239
|
+
| WISDM 2019 | 51 | 18 | 20 | Yes |
|
|
240
|
+
| Your iPhone | 1 | any | 100 | Yes |
|
|
241
|
+
|
|
242
|
+
## Use Cases
|
|
243
|
+
|
|
244
|
+
**Prosthetics** — Certify EMG training data for myoelectric hands. Uncertified data = hand that does not respond correctly.
|
|
245
|
+
|
|
246
|
+
**Surgical robots** — PRECISION domain ensures training data meets surgical accuracy standards.
|
|
247
|
+
|
|
248
|
+
**Humanoid robots** — Certify teleoperation recordings before training whole-body motion policies.
|
|
249
|
+
|
|
250
|
+
**Exoskeletons** — Verify force-generation training data before deployment.
|
|
251
|
+
|
|
252
|
+
**Research** — Use physics score as training loss: L = L_task + lambda * (1 - physics_score/100)
|
|
253
|
+
|
|
254
|
+
## License
|
|
255
|
+
|
|
256
|
+
**Business Source License 1.1 (BSL-1.1)**
|
|
257
|
+
|
|
258
|
+
- Free: research, education, personal projects
|
|
259
|
+
- Free: study, modify, contribute
|
|
260
|
+
- Commercial use requires a license from the author
|
|
261
|
+
- Converts to Apache 2.0 automatically on 2028-01-01
|
|
262
|
+
|
|
263
|
+
Commercial licensing: timur.davkarayev@gmail.com
|
|
264
|
+
|
|
265
|
+
## Status
|
|
266
|
+
|
|
267
|
+
v1.4 — 12 modules, zero dependencies, production ready.
|
|
268
|
+
|
|
269
|
+
**Domain Classifier:** 76.6% accuracy (5-fold CV, FINE_MOTOR mode), trained on 103,352 certified records from UCI HAR + PAMAP2 + WISDM across 5 domains (LOCOMOTION, DAILY_LIVING, PRECISION, SOCIAL, SPORT).
|
|
270
|
+
|
|
271
|
+
Validated on real iPhone 11 IMU data. SILVER certified, 4/4 physics laws passing.
|
|
272
|
+
|
|
273
|
+
**Preprint:** [hal-05531246v1](https://hal.science/hal-05531246v1) — HAL Open Science, February 28, 2026
|
|
274
|
+
|
|
275
|
+
Open to hardware partnerships and research collaborations.
|
|
276
|
+
|
|
277
|
+
---
|
|
278
|
+
|
|
279
|
+
*If you use S2S in research, please cite this repository.*
|
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
# S2S — Physical Motion Certification
|
|
2
|
+
|
|
3
|
+
**Physics-certified motion data for prosthetics, robotics, and Physical AI.**
|
|
4
|
+
|
|
5
|
+
S2S is a physics validation layer for human motion sensor data. Before training a prosthetic hand, surgical robot, or humanoid — run your IMU data through S2S. It verifies the data obeys 7 biomechanical laws and issues a cryptographic certificate. Bad data gets rejected before it reaches your model.
|
|
6
|
+
|
|
7
|
+
[](https://github.com/timbo4u1/S2S/actions/workflows/ci.yml)
|
|
8
|
+
[](https://github.com/timbo4u1/S2S/actions/workflows/ci.yml)
|
|
9
|
+
[](LICENSE)
|
|
10
|
+
[](README.md)
|
|
11
|
+
[](README.md)
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## Live Demos
|
|
16
|
+
|
|
17
|
+
**[→ IMU Demo — open on your phone](https://timbo4u1.github.io/S2S)** · Real-time certification using phone accelerometer + gyroscope
|
|
18
|
+
|
|
19
|
+
**[→ Pose Demo — camera + skeleton](https://timbo4u1.github.io/S2S/pose.html)** · 17-joint body tracking with live physics certification
|
|
20
|
+
|
|
21
|
+
No install needed. All processing runs on your device. No data sent anywhere.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## The Problem
|
|
26
|
+
|
|
27
|
+
Physical AI (robots, prosthetics, exoskeletons) is trained on motion data. But most datasets contain synthetic data that violates physics, corrupted recordings, and mislabeled actions — with no way to verify the data came from a real human moving in physically valid ways.
|
|
28
|
+
|
|
29
|
+
A robot trained on bad data learns bad motion. A prosthetic hand trained on uncertified data fails its user.
|
|
30
|
+
|
|
31
|
+
## The Solution
|
|
32
|
+
|
|
33
|
+
S2S applies **7 biomechanical physics laws** to every sensor record:
|
|
34
|
+
|
|
35
|
+
| Law | Source | What it checks |
|
|
36
|
+
|-----|--------|----------------|
|
|
37
|
+
| Newton F=ma coupling | Newton 1687 | EMG force precedes acceleration by 75ms |
|
|
38
|
+
| Rigid body kinematics | Euler | a = αxr + ωxωxr holds at every joint |
|
|
39
|
+
| Resonance frequency | Flash-Hogan 1985 | Forearm tremor is 8-12Hz |
|
|
40
|
+
| Jerk bounds | Flash-Hogan 1985 | Human motion <= 500 m/s3 |
|
|
41
|
+
| IMU consistency | Sensor physics | Accel and gyro from same chip must couple |
|
|
42
|
+
| BCG heartbeat | Starr 1939 | Heart stroke visible in wrist IMU |
|
|
43
|
+
| Joule heating | Ohm 1827 | EMG power matches thermal output |
|
|
44
|
+
|
|
45
|
+
Every passing record is **Ed25519 signed** — tamper-evident, machine-verifiable.
|
|
46
|
+
|
|
47
|
+
## Real Result (iPhone 11, real human hand)
|
|
48
|
+
```
|
|
49
|
+
Real human hand: rigid_body r=0.35 imu_consistency r=0.35 SILVER 69/100
|
|
50
|
+
Synthetic data: rigid_body r=-0.01 imu_consistency r=-0.01 BRONZE 53/100
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
S2S correctly distinguishes real human motion from synthetic using physics alone.
|
|
54
|
+
|
|
55
|
+
## Motion Domain Taxonomy
|
|
56
|
+
|
|
57
|
+
Based on Flash-Hogan 1985, Bernstein 1967, Fitts 1954, Wolpert 1998 (MOSAIC model):
|
|
58
|
+
|
|
59
|
+
| Domain | Jerk | Coupling r | Robot use |
|
|
60
|
+
|--------|------|------------|-----------|
|
|
61
|
+
| PRECISION | 80 m/s3 | 0.30 | Surgical robots, prosthetic hands, assembly |
|
|
62
|
+
| SOCIAL | 180 m/s3 | 0.15 | Service robots, HRI |
|
|
63
|
+
| LOCOMOTION | 300 m/s3 | 0.15 | Bipedal robots, prosthetic legs |
|
|
64
|
+
| DAILY_LIVING | 150 m/s3 | 0.20 | Home robots, elder care |
|
|
65
|
+
| SPORT | 500 m/s3 | 0.10 | Athletic training, motion analysis |
|
|
66
|
+
|
|
67
|
+
## Quick Start
|
|
68
|
+
```bash
|
|
69
|
+
git clone https://github.com/timbo4u1/S2S.git
|
|
70
|
+
cd S2S
|
|
71
|
+
python3 -c "from s2s_standard_v1_3.s2s_physics_v1_3 import PhysicsEngine; print('OK')"
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
### Certify your IMU data
|
|
75
|
+
```python
|
|
76
|
+
from s2s_standard_v1_3.s2s_physics_v1_3 import PhysicsEngine
|
|
77
|
+
|
|
78
|
+
result = PhysicsEngine().certify(
|
|
79
|
+
imu_raw={
|
|
80
|
+
"timestamps_ns": [...],
|
|
81
|
+
"accel": [...],
|
|
82
|
+
"gyro": [...],
|
|
83
|
+
},
|
|
84
|
+
segment="forearm"
|
|
85
|
+
)
|
|
86
|
+
print(result['physics_tier']) # SILVER
|
|
87
|
+
print(result['physics_score']) # 69
|
|
88
|
+
print(result['laws_passed'])
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
### Record with iPhone (free)
|
|
92
|
+
```bash
|
|
93
|
+
# 1. Install "Sensor Logger" app (free, iOS/Android)
|
|
94
|
+
# 2. Enable: AccelerometerUncalibrated + GyroscopeUncalibrated + Gravity
|
|
95
|
+
# 3. Record motion, export CSV, run:
|
|
96
|
+
python3 collect_action.py --accel AccelerometerUncalibrated.csv --gyro GyroscopeUncalibrated.csv --gravity Gravity.csv --label reach_forward --person your_name --out dataset/
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Build certified dataset from public data
|
|
100
|
+
```bash
|
|
101
|
+
# UCI HAR: 30 subjects, 6 activities, 50Hz (24MB)
|
|
102
|
+
wget "https://archive.ics.uci.edu/ml/machine-learning-databases/00240/UCI%20HAR%20Dataset.zip"
|
|
103
|
+
unzip "UCI HAR Dataset.zip"
|
|
104
|
+
python3 s2s_dataset_adapter.py --dataset uci_har --input "UCI HAR Dataset/" --out s2s_dataset/
|
|
105
|
+
|
|
106
|
+
# PAMAP2: 9 subjects, 18 activities, 100Hz (500MB)
|
|
107
|
+
wget "https://archive.ics.uci.edu/ml/machine-learning-databases/00231/PAMAP2_Dataset.zip"
|
|
108
|
+
unzip PAMAP2_Dataset.zip
|
|
109
|
+
python3 s2s_dataset_adapter.py --dataset pamap2 --input PAMAP2_Dataset/ --out s2s_dataset/
|
|
110
|
+
|
|
111
|
+
# WISDM: 51 subjects, 18 activities, 20Hz (295MB)
|
|
112
|
+
curl -L -o wisdm-dataset.zip "https://archive.ics.uci.edu/ml/machine-learning-databases/00507/wisdm-dataset.zip"
|
|
113
|
+
unzip wisdm-dataset.zip -d wisdm-dataset/
|
|
114
|
+
python3 wisdm_adapter.py --input wisdm-dataset/ --out s2s_dataset/ --device phone
|
|
115
|
+
|
|
116
|
+
# Train domain classifier
|
|
117
|
+
python3 train_classifier.py --dataset s2s_dataset/ --test
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
## Package Structure
|
|
121
|
+
```
|
|
122
|
+
s2s_standard_v1_3/
|
|
123
|
+
├── s2s_physics_v1_3.py 7 biomechanical physics laws
|
|
124
|
+
├── s2s_stream_certify_v1_3.py Real-time IMU stream certification
|
|
125
|
+
├── s2s_emg_certify_v1_3.py EMG certification
|
|
126
|
+
├── s2s_fusion_v1_3.py 5-sensor fusion + HIL score
|
|
127
|
+
├── s2s_signing_v1_3.py Ed25519 signing + verification
|
|
128
|
+
├── s2s_api_v1_3.py REST API server
|
|
129
|
+
└── ... (12 modules total)
|
|
130
|
+
|
|
131
|
+
collect_action.py Record labeled actions from phone
|
|
132
|
+
s2s_dataset_adapter.py Convert UCI HAR and PAMAP2
|
|
133
|
+
wisdm_adapter.py Convert WISDM (51 subjects, 18 activities)
|
|
134
|
+
train_classifier.py 5-domain classifier (pure Python, zero deps)
|
|
135
|
+
|
|
136
|
+
docs/
|
|
137
|
+
├── index.html Live IMU demo (phone sensors)
|
|
138
|
+
└── pose.html Live pose demo (camera + skeleton)
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## Certification Tiers
|
|
142
|
+
|
|
143
|
+
| Tier | Score | Meaning |
|
|
144
|
+
|------|-------|---------|
|
|
145
|
+
| GOLD | 90-100 | All laws pass — hardware-grade |
|
|
146
|
+
| SILVER | 60-89 | Core laws pass — suitable for training |
|
|
147
|
+
| BRONZE | 30-59 | Partial pass — use with caution |
|
|
148
|
+
| REJECTED | 0-29 | Physics violations detected |
|
|
149
|
+
|
|
150
|
+
## Supported Open Datasets
|
|
151
|
+
|
|
152
|
+
| Dataset | Subjects | Activities | Hz | Direct S2S |
|
|
153
|
+
|---------|----------|------------|-----|------------|
|
|
154
|
+
| UCI HAR | 30 | 6 | 50 | Yes |
|
|
155
|
+
| PAMAP2 | 9 | 18 | 100 | Yes |
|
|
156
|
+
| WISDM 2019 | 51 | 18 | 20 | Yes |
|
|
157
|
+
| Your iPhone | 1 | any | 100 | Yes |
|
|
158
|
+
|
|
159
|
+
## Use Cases
|
|
160
|
+
|
|
161
|
+
**Prosthetics** — Certify EMG training data for myoelectric hands. Uncertified data = hand that does not respond correctly.
|
|
162
|
+
|
|
163
|
+
**Surgical robots** — PRECISION domain ensures training data meets surgical accuracy standards.
|
|
164
|
+
|
|
165
|
+
**Humanoid robots** — Certify teleoperation recordings before training whole-body motion policies.
|
|
166
|
+
|
|
167
|
+
**Exoskeletons** — Verify force-generation training data before deployment.
|
|
168
|
+
|
|
169
|
+
**Research** — Use physics score as training loss: L = L_task + lambda * (1 - physics_score/100)
|
|
170
|
+
|
|
171
|
+
## License
|
|
172
|
+
|
|
173
|
+
**Business Source License 1.1 (BSL-1.1)**
|
|
174
|
+
|
|
175
|
+
- Free: research, education, personal projects
|
|
176
|
+
- Free: study, modify, contribute
|
|
177
|
+
- Commercial use requires a license from the author
|
|
178
|
+
- Converts to Apache 2.0 automatically on 2028-01-01
|
|
179
|
+
|
|
180
|
+
Commercial licensing: timur.davkarayev@gmail.com
|
|
181
|
+
|
|
182
|
+
## Status
|
|
183
|
+
|
|
184
|
+
v1.4 — 12 modules, zero dependencies, production ready.
|
|
185
|
+
|
|
186
|
+
**Domain Classifier:** 76.6% accuracy (5-fold CV, FINE_MOTOR mode), trained on 103,352 certified records from UCI HAR + PAMAP2 + WISDM across 5 domains (LOCOMOTION, DAILY_LIVING, PRECISION, SOCIAL, SPORT).
|
|
187
|
+
|
|
188
|
+
Validated on real iPhone 11 IMU data. SILVER certified, 4/4 physics laws passing.
|
|
189
|
+
|
|
190
|
+
**Preprint:** [hal-05531246v1](https://hal.science/hal-05531246v1) — HAL Open Science, February 28, 2026
|
|
191
|
+
|
|
192
|
+
Open to hardware partnerships and research collaborations.
|
|
193
|
+
|
|
194
|
+
---
|
|
195
|
+
|
|
196
|
+
*If you use S2S in research, please cite this repository.*
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=68", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "s2s-certify"
|
|
7
|
+
version = "1.4.0"
|
|
8
|
+
description = "Physics-certified motion data toolkit for Physical AI training"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = { file = "LICENSE" }
|
|
11
|
+
authors = [
|
|
12
|
+
{ name = "Timur Davkarayev", email = "timur.davkarayev@gmail.com" }
|
|
13
|
+
]
|
|
14
|
+
keywords = [
|
|
15
|
+
"biomechanics", "imu", "motion-capture", "physical-ai",
|
|
16
|
+
"robotics", "prosthetics", "sensor-certification", "physics"
|
|
17
|
+
]
|
|
18
|
+
classifiers = [
|
|
19
|
+
"Development Status :: 4 - Beta",
|
|
20
|
+
"Intended Audience :: Science/Research",
|
|
21
|
+
"Intended Audience :: Developers",
|
|
22
|
+
"Topic :: Scientific/Engineering :: Artificial Intelligence",
|
|
23
|
+
"Topic :: Scientific/Engineering :: Medical Science Apps.",
|
|
24
|
+
"Programming Language :: Python :: 3",
|
|
25
|
+
"Programming Language :: Python :: 3.9",
|
|
26
|
+
"Programming Language :: Python :: 3.10",
|
|
27
|
+
"Programming Language :: Python :: 3.11",
|
|
28
|
+
"Programming Language :: Python :: 3.12",
|
|
29
|
+
"Operating System :: OS Independent",
|
|
30
|
+
]
|
|
31
|
+
requires-python = ">=3.9"
|
|
32
|
+
dependencies = [] # zero runtime dependencies — stdlib only
|
|
33
|
+
|
|
34
|
+
[project.optional-dependencies]
|
|
35
|
+
ml = ["torch>=2.0", "numpy>=1.24"]
|
|
36
|
+
dashboard = ["streamlit>=1.30", "numpy>=1.24"]
|
|
37
|
+
dev = ["pytest>=7.0", "pytest-cov"]
|
|
38
|
+
|
|
39
|
+
[project.urls]
|
|
40
|
+
Homepage = "https://github.com/timbo4u1/S2S"
|
|
41
|
+
Repository = "https://github.com/timbo4u1/S2S"
|
|
42
|
+
"Bug Tracker" = "https://github.com/timbo4u1/S2S/issues"
|
|
43
|
+
Documentation = "https://timbo4u1.github.io/S2S"
|
|
44
|
+
|
|
45
|
+
[project.scripts]
|
|
46
|
+
s2s-certify = "s2s_standard_v1_3.s2s_physics_v1_3:main"
|
|
47
|
+
|
|
48
|
+
[tool.setuptools.packages.find]
|
|
49
|
+
include = ["s2s_standard_v1_3*"]
|
|
50
|
+
|
|
51
|
+
[tool.pytest.ini_options]
|
|
52
|
+
testpaths = ["tests"]
|
|
53
|
+
python_files = ["test_*.py"]
|
|
54
|
+
python_classes = ["Test*"]
|
|
55
|
+
python_functions = ["test_*"]
|
|
56
|
+
addopts = "-v --tb=short"
|