alchemypose 1.0.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.
Files changed (50) hide show
  1. alchemypose-1.0.0/LICENSE +21 -0
  2. alchemypose-1.0.0/PKG-INFO +492 -0
  3. alchemypose-1.0.0/README.md +445 -0
  4. alchemypose-1.0.0/pyproject.toml +140 -0
  5. alchemypose-1.0.0/setup.cfg +4 -0
  6. alchemypose-1.0.0/src/alchemypose/__init__.py +26 -0
  7. alchemypose-1.0.0/src/alchemypose/__main__.py +5 -0
  8. alchemypose-1.0.0/src/alchemypose/cli.py +372 -0
  9. alchemypose-1.0.0/src/alchemypose/core/__init__.py +0 -0
  10. alchemypose-1.0.0/src/alchemypose/core/h36m.py +93 -0
  11. alchemypose-1.0.0/src/alchemypose/core/presets.py +68 -0
  12. alchemypose-1.0.0/src/alchemypose/core/schema.py +127 -0
  13. alchemypose-1.0.0/src/alchemypose/core/serialize.py +173 -0
  14. alchemypose-1.0.0/src/alchemypose/core/topology.py +177 -0
  15. alchemypose-1.0.0/src/alchemypose/errors.py +14 -0
  16. alchemypose-1.0.0/src/alchemypose/gui/__init__.py +20 -0
  17. alchemypose-1.0.0/src/alchemypose/gui/app.py +24 -0
  18. alchemypose-1.0.0/src/alchemypose/gui/bridge.py +94 -0
  19. alchemypose-1.0.0/src/alchemypose/gui/canvas/__init__.py +8 -0
  20. alchemypose-1.0.0/src/alchemypose/gui/canvas/interaction.py +78 -0
  21. alchemypose-1.0.0/src/alchemypose/gui/canvas/items.py +116 -0
  22. alchemypose-1.0.0/src/alchemypose/gui/canvas/lod.py +96 -0
  23. alchemypose-1.0.0/src/alchemypose/gui/canvas/scene.py +533 -0
  24. alchemypose-1.0.0/src/alchemypose/gui/canvas/view.py +184 -0
  25. alchemypose-1.0.0/src/alchemypose/gui/export.py +116 -0
  26. alchemypose-1.0.0/src/alchemypose/gui/main_window.py +534 -0
  27. alchemypose-1.0.0/src/alchemypose/gui/panels/__init__.py +7 -0
  28. alchemypose-1.0.0/src/alchemypose/gui/panels/inspector.py +56 -0
  29. alchemypose-1.0.0/src/alchemypose/gui/panels/layers.py +143 -0
  30. alchemypose-1.0.0/src/alchemypose/gui/panels/people.py +61 -0
  31. alchemypose-1.0.0/src/alchemypose/gui/panels/presets.py +52 -0
  32. alchemypose-1.0.0/src/alchemypose/gui/reporting.py +33 -0
  33. alchemypose-1.0.0/src/alchemypose/gui/theme.py +66 -0
  34. alchemypose-1.0.0/src/alchemypose/inference/__init__.py +0 -0
  35. alchemypose-1.0.0/src/alchemypose/inference/detector.py +148 -0
  36. alchemypose-1.0.0/src/alchemypose/inference/engine.py +20 -0
  37. alchemypose-1.0.0/src/alchemypose/inference/rtmw.py +148 -0
  38. alchemypose-1.0.0/src/alchemypose/inference/session.py +162 -0
  39. alchemypose-1.0.0/src/alchemypose/inference/simcc.py +116 -0
  40. alchemypose-1.0.0/src/alchemypose/inference/weights.py +293 -0
  41. alchemypose-1.0.0/src/alchemypose/inference/worker.py +123 -0
  42. alchemypose-1.0.0/src/alchemypose/media/__init__.py +0 -0
  43. alchemypose-1.0.0/src/alchemypose/media/image.py +24 -0
  44. alchemypose-1.0.0/src/alchemypose/py.typed +0 -0
  45. alchemypose-1.0.0/src/alchemypose.egg-info/PKG-INFO +492 -0
  46. alchemypose-1.0.0/src/alchemypose.egg-info/SOURCES.txt +48 -0
  47. alchemypose-1.0.0/src/alchemypose.egg-info/dependency_links.txt +1 -0
  48. alchemypose-1.0.0/src/alchemypose.egg-info/entry_points.txt +2 -0
  49. alchemypose-1.0.0/src/alchemypose.egg-info/requires.txt +19 -0
  50. alchemypose-1.0.0/src/alchemypose.egg-info/top_level.txt +1 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 kouya-marino
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,492 @@
1
+ Metadata-Version: 2.4
2
+ Name: alchemypose
3
+ Version: 1.0.0
4
+ Summary: Whole-body human pose visualisation: 133 COCO-WholeBody keypoints from a photograph, as a typed Python library and a desktop application.
5
+ Author: Prashant Rawat
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/kouya-marino/AlchemyPose
8
+ Project-URL: Source, https://github.com/kouya-marino/AlchemyPose
9
+ Project-URL: Issues, https://github.com/kouya-marino/AlchemyPose/issues
10
+ Project-URL: Changelog, https://github.com/kouya-marino/AlchemyPose/blob/main/CHANGELOG.md
11
+ Keywords: pose-estimation,human-pose-estimation,wholebody,coco-wholebody,keypoints,rtmw,rtmpose,onnx,onnxruntime,computer-vision,pyside6,qt
12
+ Classifier: Development Status :: 5 - Production/Stable
13
+ Classifier: Environment :: MacOS X
14
+ Classifier: Environment :: X11 Applications :: Qt
15
+ Classifier: Intended Audience :: Developers
16
+ Classifier: Intended Audience :: Science/Research
17
+ Classifier: Operating System :: OS Independent
18
+ Classifier: Programming Language :: Python :: 3 :: Only
19
+ Classifier: Programming Language :: Python :: 3.12
20
+ Classifier: Programming Language :: Python :: 3.13
21
+ Classifier: Programming Language :: Python :: 3.14
22
+ Classifier: Topic :: Multimedia :: Graphics
23
+ Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
24
+ Classifier: Topic :: Scientific/Engineering :: Image Recognition
25
+ Classifier: Typing :: Typed
26
+ Requires-Python: >=3.12
27
+ Description-Content-Type: text/markdown
28
+ License-File: LICENSE
29
+ Requires-Dist: numpy<3,>=1.24
30
+ Requires-Dist: opencv-python-headless<6,>=4.9
31
+ Requires-Dist: onnxruntime<2,>=1.20
32
+ Requires-Dist: platformdirs>=4.0
33
+ Requires-Dist: typer<1,>=0.12
34
+ Requires-Dist: PySide6_Essentials<7,>=6.8
35
+ Provides-Extra: dev
36
+ Requires-Dist: pytest>=8.0; extra == "dev"
37
+ Requires-Dist: pytest-cov>=5.0; extra == "dev"
38
+ Requires-Dist: pytest-qt>=4.4; extra == "dev"
39
+ Requires-Dist: ruff>=0.6; extra == "dev"
40
+ Requires-Dist: mypy>=1.11; extra == "dev"
41
+ Requires-Dist: build>=1.0; extra == "dev"
42
+ Requires-Dist: twine>=5.0; extra == "dev"
43
+ Provides-Extra: threed
44
+ Requires-Dist: pyqtgraph>=0.13; extra == "threed"
45
+ Requires-Dist: PyOpenGL>=3.1; extra == "threed"
46
+ Dynamic: license-file
47
+
48
+ # AlchemyPose
49
+
50
+ [![PyPI](https://img.shields.io/badge/PyPI-v1.0.0-blue.svg)](https://pypi.org/project/alchemypose/)
51
+ [![Python 3.12 | 3.13 | 3.14](https://img.shields.io/badge/python-3.12%20%7C%203.13%20%7C%203.14-blue.svg)](https://www.python.org/)
52
+ [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
53
+ [![License: MIT](https://img.shields.io/badge/license-MIT-green.svg)](https://opensource.org/licenses/MIT)
54
+
55
+ Whole-body human pose over an image — **a typed Python library and a PySide6 desktop
56
+ application**, built on [RTMW](https://github.com/open-mmlab/mmpose/tree/main/projects/rtmpose)
57
+ and [YOLOX](https://github.com/open-mmlab/mmpose/tree/main/projects/rtmpose) through
58
+ ONNX Runtime.
59
+
60
+ Drop in a photograph. Every person in it gets 133 keypoints — body, feet, face and
61
+ both hands — and you choose what to look at: the whole skeleton, one hand, the left
62
+ leg, the face on its own.
63
+
64
+ > **1.0.0 — single images.** `pip install alchemypose`, type `alchemypose`, and the
65
+ > window opens. Every person in the photograph you drop in comes back with 133
66
+ > keypoints on a zoomable canvas, driven by a layer tree, preset chips and a
67
+ > confidence slider. The face resolves from contours to individual points as it grows
68
+ > on screen, and the Export menu writes the keypoints as JSON or CSV and the overlay
69
+ > as a PNG. The CLI produces the same result with no window at all. Video and 3D are
70
+ > the next two versions — see [Roadmap](#roadmap).
71
+
72
+ ---
73
+
74
+ ## Why
75
+
76
+ Most pose demos give you 17 body keypoints and a stick figure. AlchemyPose is built
77
+ around the thing that is actually hard once you have 133 of them: **deciding what to
78
+ show.** Face landmarks alone outnumber every other part combined, so the interface
79
+ is as much of the problem as the model.
80
+
81
+ It also stays light. No PyTorch, no MediaPipe, no `ultralytics` — the whole inference
82
+ path is ONNX Runtime, OpenCV and numpy, and the model files are fetched once at
83
+ runtime rather than shipped in the wheel.
84
+
85
+ ---
86
+
87
+ ## Install
88
+
89
+ ```bash
90
+ pip install alchemypose
91
+ alchemypose
92
+ ```
93
+
94
+ The second line opens the window: `alchemypose` on its own is the application.
95
+ `alchemypose --version` prints `1.0.0`, and the subcommands further down do the same
96
+ work with no window at all.
97
+
98
+ From source instead, if you have access to the repository:
99
+
100
+ ```bash
101
+ git clone https://github.com/kouya-marino/AlchemyPose.git
102
+ cd AlchemyPose
103
+ python3 -m venv .venv && source .venv/bin/activate # 3.12, 3.13 or 3.14
104
+ pip install -e ".[dev]"
105
+ ```
106
+
107
+ **Python 3.12 or newer.** `requires-python` is `>=3.12` — a floor with no ceiling.
108
+ The floor is there because the *development* toolchain needs it: numpy ships type
109
+ stubs written in 3.12 syntax, which mypy cannot parse under 3.11. That is a reason
110
+ for a floor and not for a ceiling, so there is no upper bound; every dependency here
111
+ already supports 3.13 and 3.14. The suite has been run in full on 3.12 and on 3.14,
112
+ and CI runs it on 3.12, 3.13 and 3.14 on every push.
113
+
114
+ **Install weight, stated honestly.** The package itself is tiny — a 79 KB wheel of
115
+ pure Python — but two things behind it are not. `PySide6_Essentials` is a 106 MB
116
+ download on macOS, whose wheel is a universal binary, and 55 to 76 MB on Linux and
117
+ Windows; installed, it takes 328 MB on disk here. And the default model preset
118
+ fetches 253 MB of ONNX weights the first time you run inference — 235 MB over the
119
+ wire, since upstream ships them zipped. Both are one-time. The `lite` preset is
120
+ 63 MB if you would rather trade accuracy for footprint.
121
+
122
+ On a bare Linux box the PySide6 wheel also needs a handful of system libraries it
123
+ links against but does not carry: `libegl1`, `libgl1`, `libx11-6`, `libxkbcommon0`,
124
+ `libfontconfig1`, `libdbus-1-3` and glib. The CI workflow installs exactly that set
125
+ and nothing more, and a runner has since loaded Qt's offscreen plugin with it.
126
+
127
+ ---
128
+
129
+ ## The keypoint schema
130
+
131
+ COCO-WholeBody 133, in contiguous index ranges that map directly onto the interface:
132
+
133
+ | Part | Indices | Count |
134
+ |---|---|---|
135
+ | Body | 0–16 | 17 |
136
+ | Feet | 17–22 | 6 |
137
+ | Face | 23–90 | 68 (dlib-68 order) |
138
+ | Left hand | 91–111 | 21 |
139
+ | Right hand | 112–132 | 21 |
140
+
141
+ Those ranges are grouped again into the 14 parts the UI exposes — `torso_head`,
142
+ `left_arm`, `right_leg`, `face_eyes`, `left_hand` and so on — joined by 127 edges.
143
+
144
+ The groups deliberately **overlap on anchor joints**: `left_arm` owns the shoulder
145
+ even though `torso_head` does too. Without that, asking for "just the left leg" draws
146
+ a shin — the thigh needs the hip, and a bone is only drawn when both of its endpoints
147
+ are visible.
148
+
149
+ ```python
150
+ from alchemypose.core.presets import selection_for
151
+ from alchemypose.core.topology import COCO_WHOLEBODY_133 as topology
152
+
153
+ selection = selection_for("hands") # or full_body, upper, lower, left_side, face …
154
+ bones = [e for e in topology.edges if selection.is_edge_visible(e)]
155
+ ```
156
+
157
+ ---
158
+
159
+ ## Using it
160
+
161
+ ### The window
162
+
163
+ ```bash
164
+ alchemypose
165
+ ```
166
+
167
+ That is the whole of it: no subcommand, no arguments. (`alchemypose gui` does the
168
+ same thing explicitly, and `python -m alchemypose gui` works too.)
169
+
170
+ `Cmd+O` opens an image — `Ctrl+O` on Windows and Linux, since the action takes Qt's
171
+ standard Open sequence. The photograph appears immediately and inference runs on a
172
+ worker thread, so the window never freezes; the skeleton lands when the model is done.
173
+ `Ctrl`+wheel zooms under the cursor (a bare wheel scrolls the view), and the middle
174
+ button drags to pan.
175
+
176
+ Everything on the right decides what is drawn. The layer tree is the single source
177
+ of truth — a two-level, tri-state list of render groups — and the preset chips above
178
+ it (Full, Upper, Lower, Left, Right, Hands, Face, All, None) simply set its check
179
+ states, so a chip lights up whenever the tree happens to equal it, including when you
180
+ got there by hand. With more than one person, the numbered chips in the toolbar
181
+ narrow everything to one subject.
182
+
183
+ On the canvas, clicking a joint emphasises its group and fades the rest; double-click
184
+ (or `Shift+H`) solos it and hides everything else; `Esc` or `Alt+H` puts it back.
185
+ Hovering reads the keypoint's name, confidence and group into the inspector.
186
+
187
+ Zooming into a face changes what is drawn on it and not merely how large it is.
188
+ Below about 80 pixels of face on screen it is drawn as contours in a single grey;
189
+ above that the brows, eyes, nose and lips take their own colours; and only above
190
+ about 200 pixels — where adjacent points are finally far enough apart to aim at —
191
+ are the 68 individual keypoints drawn at all. Sixty-eight dots on a thumbnail are a
192
+ smudge, whereas the contours through them read as a face at any size. The **Face**
193
+ chip zooms to the face as well as selecting it, which is what spares the window a
194
+ separate face mode.
195
+
196
+ ### Getting it back out
197
+
198
+ The **Export** menu writes the keypoints as JSON or CSV, and the overlay as a PNG.
199
+ The PNG renders the scene rather than the widget, so it arrives at the photograph's
200
+ own resolution and is the same file whatever the zoom, the scroll position or the
201
+ shape of the window. A PNG needs only an open photograph; the two data formats need
202
+ a result. When there is nothing to write yet it says so in the status bar rather
203
+ than opening a dialog on an empty canvas.
204
+
205
+ ### One image, from the shell
206
+
207
+ ```console
208
+ $ alchemypose image tests/integration/fixtures/two_people.jpg --preset lite --json /tmp/out.json
209
+ Wrote /tmp/out.json
210
+ ```
211
+
212
+ That path is the test fixture in the source tree — a public-domain 1935 photograph of
213
+ two people — so substitute any photograph of your own and the numbers below become
214
+ yours. ONNX Runtime also writes a few `[W:onnxruntime:…]` lines to stderr while it
215
+ builds a session, about unused initializers and how much of the graph CoreML took;
216
+ they are notices, not errors, and stdout carries only the line above.
217
+
218
+ Without `--json` the result goes to stdout; `--csv` also writes the flat
219
+ `frame,person,keypoint_index,keypoint_name,x,y,score` form. The JSON carries the
220
+ topology inline, so a result stays readable years later without this package:
221
+
222
+ ```console
223
+ $ python - <<'PY'
224
+ import json
225
+ import numpy as np
226
+ r = json.load(open("/tmp/out.json"))
227
+ frame = r["frames"][0]
228
+ print(r["model"], frame["image_size"], len(frame["people"]), "people")
229
+ for i, p in enumerate(frame["people"]):
230
+ s = np.array(p["scores"])
231
+ print(f"person {i}: {len(p['keypoints'])} keypoints, confidence {s.min():.2f}-{s.max():.2f} (median {np.median(s):.2f})")
232
+ PY
233
+ rtmw_m_256x192 [982, 670] 2 people
234
+ person 0: 133 keypoints, confidence 0.56-1.00 (median 0.94)
235
+ person 1: 133 keypoints, confidence 0.61-1.00 (median 0.90)
236
+ ```
237
+
238
+ Weights are fetched on first use. To pay for that up front:
239
+
240
+ ```console
241
+ $ alchemypose models fetch --preset lite
242
+ Fetching yolox_nano ...
243
+ Fetching rtmw_m_256x192 ...
244
+ Done.
245
+
246
+ $ alchemypose models list
247
+ Cache: /Users/you/Library/Caches/alchemypose
248
+
249
+ lite:
250
+ yolox_nano cached
251
+ rtmw_m_256x192 cached
252
+
253
+ balanced:
254
+ yolox_tiny cached
255
+ dwpose_l_384x288 cached
256
+
257
+ performance:
258
+ yolox_s cached
259
+ rtmw_l_384x288 cached
260
+ ```
261
+
262
+ ### What a score means
263
+
264
+ Every keypoint carries a confidence in `[0, 1]`, and it means the same thing whichever
265
+ preset produced it. That took work: the RTMPose-family graphs end in a bare `MatMul`
266
+ — no softmax, no sigmoid — so the raw SimCC peak is a logit whose height depends on
267
+ the model's training temperature. Measured on real output, a confident peak reaches
268
+ about 1.0 on RTMW-m and DWPose-l but an order of magnitude more on RTMW-l — 8.576 was
269
+ the highest of the fixture's 399 — which made a fixed 0..1 threshold meaningless
270
+ across presets and inert on the default one. `rtmw.PEAK_SCALE` records the divisor per
271
+ model, 1.0 for the first two and 10.0 for RTMW-l, and decoding divides it out and
272
+ clips to [0, 1]. It is a monotone confidence, not a calibrated probability — nothing
273
+ in the training objective makes it one.
274
+
275
+ The window's slider filters on exactly that number and starts at **0.30**. Below it a
276
+ keypoint is not drawn at all; from there the drawing fades in, reaching full opacity
277
+ at 0.55, and a bone whose weaker end is under 0.25 is drawn dashed. Those three
278
+ numbers were calibrated against measured score distributions, not chosen by eye.
279
+
280
+ ---
281
+
282
+ ## Models
283
+
284
+ Weights are downloaded on first use into the platform cache directory
285
+ (`~/Library/Caches/alchemypose` on macOS, `~/.cache/alchemypose` on Linux; override
286
+ with `ALCHEMYPOSE_MODEL_DIR`) and verified against a recorded SHA-256. Nothing is
287
+ vendored in the repository or the wheel.
288
+
289
+ | Preset | Detector + pose model | On disk | Detection | Pose model, per person |
290
+ |---|---|---|---|---|
291
+ | `lite` | YOLOX-nano + RTMW-m 256×192 | 63 MB | 8 ms | 4 ms |
292
+ | `balanced` | YOLOX-tiny + DWPose-l 384×288 | 148 MB | 15 ms | 14 ms |
293
+ | `performance` *(default)* | YOLOX-s + RTMW-l 384×288 | 253 MB | 42 ms | 25 ms |
294
+
295
+ Sizes are the extracted `.onnx` files as they sit in the cache, in binary megabytes —
296
+ the figures `ls -lh` and `du -h` print — so the three rows add up to the 464 MB all six
297
+ files occupy together. Upstream ships them inside zips, so the transfer itself is
298
+ slightly smaller (59 / 138 / 235 MB).
299
+
300
+ The timings are medians of fifteen warm runs on one 982×670 photograph on an M5, with
301
+ the split described below — the detector on the CPU provider, the pose model on
302
+ CoreML. Detection is per frame whatever the head count; the pose column is per
303
+ detected person. End to end that photograph takes 17 ms on `lite` (2 people found),
304
+ 58 ms on `balanced` and 114 ms on `performance` (3 people found). Opening the models
305
+ costs another 1–3 seconds once per process, before the first inference.
306
+
307
+ The person detector runs on the CPU execution provider and the pose model on CoreML.
308
+ That split is not a tuning choice, though the reason is narrower than "CoreML cannot
309
+ load that graph". It loads it — the session is created and reports both providers —
310
+ and then raises a rank mismatch on the first `run()`, inside the partition holding
311
+ YOLOX's baked-in NMS. Sessions are therefore proved with one throwaway inference on
312
+ zeros and demoted to CPU if it fails.
313
+
314
+ All model weights are Apache-2.0, from the MMPose project.
315
+
316
+ ---
317
+
318
+ ## Architecture
319
+
320
+ Layers, with the Qt boundary enforced by a test:
321
+
322
+ ```
323
+ core/ topology · schema · presets · serialization · H36M mapping
324
+ no Qt, no onnxruntime — pure data, testable anywhere
325
+
326
+ media/ reading an image as upright BGR, EXIF applied
327
+
328
+ inference/ ONNX sessions · YOLOX detection · SimCC decoding · weight cache ·
329
+ the worker thread — no Qt, so it is testable headless
330
+
331
+ gui/ PySide6: canvas · layer tree · preset and person chips ·
332
+ confidence slider · inspector
333
+ ```
334
+
335
+ `import alchemypose` pulls in no Qt at all — the application class resolves lazily —
336
+ so the library half runs headless, in CI, and on a machine with no display. The
337
+ inference worker is plain `threading`; `gui/bridge.py` is the only place it meets Qt,
338
+ and it does so by emitting signals, so nothing on a worker thread ever touches a
339
+ widget.
340
+
341
+ One result structure serves every phase. `PersonPose` carries `track_id` and
342
+ `keypoints_3d` fields that stay empty in 1.0.0, so video and 3D are additive rather
343
+ than a schema migration.
344
+
345
+ ---
346
+
347
+ ## Roadmap
348
+
349
+ **v1 — single image.** Shipped in 1.0.0.
350
+
351
+ - [x] COCO-WholeBody 133 topology, render groups, presets
352
+ - [x] Result schema with reserved video/3D slots
353
+ - [x] JSON and CSV serialization
354
+ - [x] COCO → H36M-17 mapping (the seam 3D lifting plugs into)
355
+ - [x] Model registry with cached, checksum-verified downloads
356
+ - [x] ONNX sessions with the CPU/CoreML provider split
357
+ - [x] SimCC decoding and top-down affine cropping
358
+ - [x] YOLOX detector and the assembled pose engine
359
+ - [x] Inference worker and CLI
360
+ - [x] Canvas, layer tree, preset chips, selection
361
+ - [x] Confidence: honest 0..1 scores, threshold slider, fade and dashed bones
362
+ - [x] Face level of detail
363
+ - [x] Export from the window
364
+
365
+ **v2 — video.** Upload and scrub, per-frame overlay, tracking, temporal smoothing.
366
+ `PersonPose.track_id` and `PoseFrame.frame_index` have been in the schema since its
367
+ first commit, and the worker is already latest-request-wins, which is what scrubbing
368
+ needs.
369
+
370
+ **v3 — 3D.** RTMW3D emits the same 133-keypoint topology with a third coordinate, so
371
+ the layer panel and presets carry over unchanged; the new work is the viewport.
372
+
373
+ ---
374
+
375
+ ## Development
376
+
377
+ ```bash
378
+ pytest # the whole suite; the GUI half runs headless by itself
379
+ pytest tests/unit -q # core and inference; no display needed
380
+ ruff check src tests main.py
381
+ mypy
382
+ mypy main.py
383
+ QT_QPA_PLATFORM=offscreen pytest tests/gui -m gui
384
+ pytest tests/integration -m models # skipped unless weights are cached
385
+ ```
386
+
387
+ At 1.0.0 that is 511 tests, all passing, on a machine with the weights cached. Twelve
388
+ of them are marked `models` — two in `tests/unit`, ten in `tests/integration` — and
389
+ check the cache rather than downloading anything, so without weights the same run
390
+ reports 499 passed and 12 skipped. `main.py` sits outside `src/`, so neither
391
+ `ruff check src tests` nor a bare `mypy` reaches it; it needs naming, which is why it
392
+ appears twice above.
393
+
394
+ The GUI tests need a Qt platform plugin, not a display: `offscreen` renders into a
395
+ buffer, so there is no xvfb anywhere in this project. They do not need that variable
396
+ on the command line, though — `tests/gui/conftest.py` sets it itself, at import,
397
+ before any widget can be constructed, so a bare `pytest` runs them headless too.
398
+ Setting it explicitly is belt and braces, and it is what the CI step does.
399
+
400
+ CI (`.github/workflows/ci.yml`) runs the test suite on **Python 3.12, 3.13 and 3.14**
401
+ — the whole of what `requires-python = ">=3.12"` now claims — and runs `ruff` and
402
+ `mypy` exactly once, in a job of their own. Both are static analysers configured
403
+ against fixed targets (`target-version = "py312"`, `python_version = "3.12"`), so
404
+ they return the same answer whichever interpreter invokes them; three copies of one
405
+ answer is not a broader gate, only a longer log. The tests are the part that actually
406
+ varies by interpreter, so the tests are the part that gets the matrix.
407
+
408
+ Nothing on a runner ever downloads weights, so the `models`-marked tests never
409
+ actually execute there. They skip, which is a green tick meaning *not exercised*
410
+ rather than *passed*.
411
+
412
+ **It has run, and it passed** — though on the single-interpreter shape this workflow
413
+ had until 1.0.0, so read the numbers below as 3.12's. Six runs so far, every one a
414
+ push to `main` and every one successful, each finishing in about a minute on
415
+ `ubuntu-latest`. The most recent reported `ruff` clean, `mypy` with no issues across
416
+ 38 source files and then across `main.py`, 289 passed and 2 skipped in `tests/unit`,
417
+ 179 passed in `tests/gui`, and 10 skipped in the weights-only step. It also printed
418
+ `Qt 6.11.2 on platform offscreen`, which is the line worth having: the list of Linux
419
+ system libraries further up was derived by reading the PySide6 wheel's ELF headers
420
+ rather than by watching a runner install them, and a runner has now loaded the
421
+ offscreen plugin with exactly that list present and nothing more.
422
+
423
+ **The 3.13 and 3.14 legs are new, and have not had a push to run on yet.** What has
424
+ been measured for the widened range is local: the full suite under Python 3.14.7, in
425
+ a clean virtualenv built from the released dependency set, with the package installed
426
+ from a source tree of its own so that nothing resolved back to the development
427
+ checkout — 511 passed, 0 skipped, `pytest` exit status 0. Weights were present, so
428
+ the twelve `models` tests ran against the real ONNX graphs rather than skipping.
429
+ `ruff` and `mypy` were run under 3.14 as well and returned exactly what they return
430
+ under 3.12, which is the measurement behind giving them one job instead of three. The
431
+ same tree's 1.0.0 wheel installs and runs on 3.14; built with the old `<3.13` ceiling
432
+ it does not, and pip says so — `requires a different Python: 3.14.7 not in
433
+ '<3.13,>=3.12'` — which is what the ceiling was doing to everyone on a current
434
+ interpreter. 3.13 is the gap: no 3.13 interpreter exists on the machine these numbers
435
+ were taken on, so that leg is claimed by the matrix and not yet by a run.
436
+
437
+ What that tick does not cover is the half of the project that needs weights. CoreML,
438
+ the timings and the score distributions on this page have only ever been measured on
439
+ one Apple-silicon machine.
440
+
441
+ **The suite used to pass and then abort. It no longer does.** It would die during
442
+ interpreter shutdown — `libc++abi: terminating due to uncaught exception of type
443
+ std::__1::system_error: recursive_mutex lock failed: Invalid argument`, exit status
444
+ 134, printed *after* the summary line had gone by. The cause was onnxruntime's
445
+ telemetry client, which uploads on a thread of its own; at exit the teardown of its
446
+ log manager frees a mutex an in-flight upload then tries to lock. `tests/conftest.py`
447
+ now sets `ORT_DISABLE_TELEMETRY=1` before anything imports onnxruntime, which is the
448
+ only moment the setting is read. Measured here over 40 runs per arm, interleaved:
449
+ 0 aborts with it, 4 without.
450
+
451
+ Run the suite as `pytest -q > out 2>&1; rc=$?` and read `rc` anyway. A pipeline such
452
+ as `pytest -q | tail -1` reports the exit status of `tail`, so it would have hidden
453
+ that abort entirely for as long as it lasted, and it will hide the next one.
454
+
455
+ ### Releasing
456
+
457
+ A release is a tag. Pushing `v1.0.0` runs `.github/workflows/publish.yml`, which
458
+ re-runs every gate above on the tagged commit and then uploads to PyPI through
459
+ trusted publishing, so no API token exists anywhere in this repository. It is the one
460
+ irreversible thing here: PyPI never allows re-uploading a version, and yanking a
461
+ release does not give its number back. So the tag is spent only after the artefacts
462
+ themselves have been read — the tag is matched against the version in
463
+ `src/alchemypose/__init__.py`, then against the metadata inside the built wheel and
464
+ sdist; the wheel's `Requires-Python` is compared against the one in `pyproject.toml`,
465
+ because the string pip enforces is the one baked into the artefact and a wrong range
466
+ published there cannot be edited afterwards, only yanked; both archives are searched
467
+ for weights, `test-data/`, `docs/` and the test suite; the wheel is checked for a
468
+ top-level `main`, because `main.py` is a checkout convenience and not ours to install
469
+ into anyone's `site-packages`; and the wheel is installed into a throwaway virtualenv
470
+ where each entry point is run and asked its version. That first check reads the attribute with `ast`, the way setuptools'
471
+ `attr:` does, rather than reading `project.version` — with the version declared once
472
+ and exposed through `dynamic = ["version"]`, that key does not exist here.
473
+
474
+ The PyPI and Python badges at the top of this file are **static and version-pinned**,
475
+ not the dynamic `shields.io/pypi/…` kind. Those proved unreliable: PyPI's JSON API
476
+ serves a stale `info.version` for some time after an upload, shields.io caches
477
+ whatever it read for three hours, and GitHub's image proxy then caches shields. The
478
+ three compound, and the badge showed a version four releases behind. A pinned badge
479
+ cannot be stale — and the release fails if either badge stops agreeing with what the
480
+ package declares, so it cannot be forgotten either. The Python badge is held to the
481
+ whole `Programming Language :: Python ::` classifier list rather than just to the
482
+ `requires-python` floor: now that it names a range, checking only its first number
483
+ would wave the rest of it through.
484
+
485
+ ---
486
+
487
+ ## Licence
488
+
489
+ MIT — see the `LICENSE` file in the source distribution.
490
+
491
+ Model weights are Apache-2.0 from [MMPose](https://github.com/open-mmlab/mmpose)
492
+ and are downloaded at runtime, not redistributed here.