openzilo-gesture-studio 0.2.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 (60) hide show
  1. openzilo_gesture_studio-0.2.0/LICENSE +373 -0
  2. openzilo_gesture_studio-0.2.0/PKG-INFO +205 -0
  3. openzilo_gesture_studio-0.2.0/README.md +190 -0
  4. openzilo_gesture_studio-0.2.0/pyproject.toml +33 -0
  5. openzilo_gesture_studio-0.2.0/setup.cfg +4 -0
  6. openzilo_gesture_studio-0.2.0/src/openzilo_gesture_studio/__init__.py +3 -0
  7. openzilo_gesture_studio-0.2.0/src/openzilo_gesture_studio/__main__.py +6 -0
  8. openzilo_gesture_studio-0.2.0/src/openzilo_gesture_studio/_ble_connection.py +49 -0
  9. openzilo_gesture_studio-0.2.0/src/openzilo_gesture_studio/acceleration.py +69 -0
  10. openzilo_gesture_studio-0.2.0/src/openzilo_gesture_studio/acceleration_view.py +206 -0
  11. openzilo_gesture_studio-0.2.0/src/openzilo_gesture_studio/audio.py +140 -0
  12. openzilo_gesture_studio-0.2.0/src/openzilo_gesture_studio/calibration.py +281 -0
  13. openzilo_gesture_studio-0.2.0/src/openzilo_gesture_studio/datasets.py +110 -0
  14. openzilo_gesture_studio-0.2.0/src/openzilo_gesture_studio/device.py +884 -0
  15. openzilo_gesture_studio-0.2.0/src/openzilo_gesture_studio/device_history.py +79 -0
  16. openzilo_gesture_studio-0.2.0/src/openzilo_gesture_studio/evaluation.py +187 -0
  17. openzilo_gesture_studio-0.2.0/src/openzilo_gesture_studio/firmware.py +73 -0
  18. openzilo_gesture_studio-0.2.0/src/openzilo_gesture_studio/gui.py +1375 -0
  19. openzilo_gesture_studio-0.2.0/src/openzilo_gesture_studio/launcher.py +28 -0
  20. openzilo_gesture_studio-0.2.0/src/openzilo_gesture_studio/playback.py +154 -0
  21. openzilo_gesture_studio-0.2.0/src/openzilo_gesture_studio/plotting.py +548 -0
  22. openzilo_gesture_studio-0.2.0/src/openzilo_gesture_studio/qt/__init__.py +2 -0
  23. openzilo_gesture_studio-0.2.0/src/openzilo_gesture_studio/qt/app.py +31 -0
  24. openzilo_gesture_studio-0.2.0/src/openzilo_gesture_studio/qt/charts.py +458 -0
  25. openzilo_gesture_studio-0.2.0/src/openzilo_gesture_studio/qt/contributors.py +130 -0
  26. openzilo_gesture_studio-0.2.0/src/openzilo_gesture_studio/qt/controller.py +1388 -0
  27. openzilo_gesture_studio-0.2.0/src/openzilo_gesture_studio/qt/dialogs.py +62 -0
  28. openzilo_gesture_studio-0.2.0/src/openzilo_gesture_studio/qt/i18n.py +137 -0
  29. openzilo_gesture_studio-0.2.0/src/openzilo_gesture_studio/qt/locales/charts_en.json +36 -0
  30. openzilo_gesture_studio-0.2.0/src/openzilo_gesture_studio/qt/locales/common_en.json +30 -0
  31. openzilo_gesture_studio-0.2.0/src/openzilo_gesture_studio/qt/locales/controllers_en.json +250 -0
  32. openzilo_gesture_studio-0.2.0/src/openzilo_gesture_studio/qt/locales/ota_connection_en.json +5 -0
  33. openzilo_gesture_studio-0.2.0/src/openzilo_gesture_studio/qt/locales/pages_en.json +174 -0
  34. openzilo_gesture_studio-0.2.0/src/openzilo_gesture_studio/qt/models.py +257 -0
  35. openzilo_gesture_studio-0.2.0/src/openzilo_gesture_studio/qt/motion.py +139 -0
  36. openzilo_gesture_studio-0.2.0/src/openzilo_gesture_studio/qt/pages/__init__.py +2 -0
  37. openzilo_gesture_studio-0.2.0/src/openzilo_gesture_studio/qt/pages/about.py +213 -0
  38. openzilo_gesture_studio-0.2.0/src/openzilo_gesture_studio/qt/pages/audio.py +156 -0
  39. openzilo_gesture_studio-0.2.0/src/openzilo_gesture_studio/qt/pages/capture.py +178 -0
  40. openzilo_gesture_studio-0.2.0/src/openzilo_gesture_studio/qt/pages/device.py +125 -0
  41. openzilo_gesture_studio-0.2.0/src/openzilo_gesture_studio/qt/pages/diagnostics.py +123 -0
  42. openzilo_gesture_studio-0.2.0/src/openzilo_gesture_studio/qt/pages/live.py +77 -0
  43. openzilo_gesture_studio-0.2.0/src/openzilo_gesture_studio/qt/pages/settings.py +39 -0
  44. openzilo_gesture_studio-0.2.0/src/openzilo_gesture_studio/qt/pages/tools.py +108 -0
  45. openzilo_gesture_studio-0.2.0/src/openzilo_gesture_studio/qt/pages/train.py +94 -0
  46. openzilo_gesture_studio-0.2.0/src/openzilo_gesture_studio/qt/theme.py +148 -0
  47. openzilo_gesture_studio-0.2.0/src/openzilo_gesture_studio/qt/tools_controller.py +362 -0
  48. openzilo_gesture_studio-0.2.0/src/openzilo_gesture_studio/qt/widgets.py +388 -0
  49. openzilo_gesture_studio-0.2.0/src/openzilo_gesture_studio/qt/window.py +421 -0
  50. openzilo_gesture_studio-0.2.0/src/openzilo_gesture_studio/remote_audio.py +313 -0
  51. openzilo_gesture_studio-0.2.0/src/openzilo_gesture_studio/ring_stream.py +54 -0
  52. openzilo_gesture_studio-0.2.0/src/openzilo_gesture_studio/sdk_controls.py +501 -0
  53. openzilo_gesture_studio-0.2.0/src/openzilo_gesture_studio/training.py +309 -0
  54. openzilo_gesture_studio-0.2.0/src/openzilo_gesture_studio/wire.py +23 -0
  55. openzilo_gesture_studio-0.2.0/src/openzilo_gesture_studio.egg-info/PKG-INFO +205 -0
  56. openzilo_gesture_studio-0.2.0/src/openzilo_gesture_studio.egg-info/SOURCES.txt +58 -0
  57. openzilo_gesture_studio-0.2.0/src/openzilo_gesture_studio.egg-info/dependency_links.txt +1 -0
  58. openzilo_gesture_studio-0.2.0/src/openzilo_gesture_studio.egg-info/entry_points.txt +4 -0
  59. openzilo_gesture_studio-0.2.0/src/openzilo_gesture_studio.egg-info/requires.txt +5 -0
  60. openzilo_gesture_studio-0.2.0/src/openzilo_gesture_studio.egg-info/top_level.txt +1 -0
@@ -0,0 +1,373 @@
1
+ Mozilla Public License Version 2.0
2
+ ==================================
3
+
4
+ 1. Definitions
5
+ --------------
6
+
7
+ 1.1. "Contributor"
8
+ means each individual or legal entity that creates, contributes to
9
+ the creation of, or owns Covered Software.
10
+
11
+ 1.2. "Contributor Version"
12
+ means the combination of the Contributions of others (if any) used
13
+ by a Contributor and that particular Contributor's Contribution.
14
+
15
+ 1.3. "Contribution"
16
+ means Covered Software of a particular Contributor.
17
+
18
+ 1.4. "Covered Software"
19
+ means Source Code Form to which the initial Contributor has attached
20
+ the notice in Exhibit A, the Executable Form of such Source Code
21
+ Form, and Modifications of such Source Code Form, in each case
22
+ including portions thereof.
23
+
24
+ 1.5. "Incompatible With Secondary Licenses"
25
+ means
26
+
27
+ (a) that the initial Contributor has attached the notice described
28
+ in Exhibit B to the Covered Software; or
29
+
30
+ (b) that the Covered Software was made available under the terms of
31
+ version 1.1 or earlier of the License, but not also under the
32
+ terms of a Secondary License.
33
+
34
+ 1.6. "Executable Form"
35
+ means any form of the work other than Source Code Form.
36
+
37
+ 1.7. "Larger Work"
38
+ means a work that combines Covered Software with other material, in
39
+ a separate file or files, that is not Covered Software.
40
+
41
+ 1.8. "License"
42
+ means this document.
43
+
44
+ 1.9. "Licensable"
45
+ means having the right to grant, to the maximum extent possible,
46
+ whether at the time of the initial grant or subsequently, any and
47
+ all of the rights conveyed by this License.
48
+
49
+ 1.10. "Modifications"
50
+ means any of the following:
51
+
52
+ (a) any file in Source Code Form that results from an addition to,
53
+ deletion from, or modification of the contents of Covered
54
+ Software; or
55
+
56
+ (b) any new file in Source Code Form that contains any Covered
57
+ Software.
58
+
59
+ 1.11. "Patent Claims" of a Contributor
60
+ means any patent claim(s), including without limitation, method,
61
+ process, and apparatus claims, in any patent Licensable by such
62
+ Contributor that would be infringed, but for the grant of the
63
+ License, by the making, using, selling, offering for sale, having
64
+ made, import, or transfer of either its Contributions or its
65
+ Contributor Version.
66
+
67
+ 1.12. "Secondary License"
68
+ means either the GNU General Public License, Version 2.0, the GNU
69
+ Lesser General Public License, Version 2.1, the GNU Affero General
70
+ Public License, Version 3.0, or any later versions of those
71
+ licenses.
72
+
73
+ 1.13. "Source Code Form"
74
+ means the form of the work preferred for making modifications.
75
+
76
+ 1.14. "You" (or "Your")
77
+ means an individual or a legal entity exercising rights under this
78
+ License. For legal entities, "You" includes any entity that
79
+ controls, is controlled by, or is under common control with You. For
80
+ purposes of this definition, "control" means (a) the power, direct
81
+ or indirect, to cause the direction or management of such entity,
82
+ whether by contract or otherwise, or (b) ownership of more than
83
+ fifty percent (50%) of the outstanding shares or beneficial
84
+ ownership of such entity.
85
+
86
+ 2. License Grants and Conditions
87
+ --------------------------------
88
+
89
+ 2.1. Grants
90
+
91
+ Each Contributor hereby grants You a world-wide, royalty-free,
92
+ non-exclusive license:
93
+
94
+ (a) under intellectual property rights (other than patent or trademark)
95
+ Licensable by such Contributor to use, reproduce, make available,
96
+ modify, display, perform, distribute, and otherwise exploit its
97
+ Contributions, either on an unmodified basis, with Modifications, or
98
+ as part of a Larger Work; and
99
+
100
+ (b) under Patent Claims of such Contributor to make, use, sell, offer
101
+ for sale, have made, import, and otherwise transfer either its
102
+ Contributions or its Contributor Version.
103
+
104
+ 2.2. Effective Date
105
+
106
+ The licenses granted in Section 2.1 with respect to any Contribution
107
+ become effective for each Contribution on the date the Contributor first
108
+ distributes such Contribution.
109
+
110
+ 2.3. Limitations on Grant Scope
111
+
112
+ The licenses granted in this Section 2 are the only rights granted under
113
+ this License. No additional rights or licenses will be implied from the
114
+ distribution or licensing of Covered Software under this License.
115
+ Notwithstanding Section 2.1(b) above, no patent license is granted by a
116
+ Contributor:
117
+
118
+ (a) for any code that a Contributor has removed from Covered Software;
119
+ or
120
+
121
+ (b) for infringements caused by: (i) Your and any other third party's
122
+ modifications of Covered Software, or (ii) the combination of its
123
+ Contributions with other software (except as part of its Contributor
124
+ Version); or
125
+
126
+ (c) under Patent Claims infringed by Covered Software in the absence of
127
+ its Contributions.
128
+
129
+ This License does not grant any rights in the trademarks, service marks,
130
+ or logos of any Contributor (except as may be necessary to comply with
131
+ the notice requirements in Section 3.4).
132
+
133
+ 2.4. Subsequent Licenses
134
+
135
+ No Contributor makes additional grants as a result of Your choice to
136
+ distribute the Covered Software under a subsequent version of this
137
+ License (see Section 10.2) or under the terms of a Secondary License (if
138
+ permitted under the terms of Section 3.3).
139
+
140
+ 2.5. Representation
141
+
142
+ Each Contributor represents that the Contributor believes its
143
+ Contributions are its original creation(s) or it has sufficient rights
144
+ to grant the rights to its Contributions conveyed by this License.
145
+
146
+ 2.6. Fair Use
147
+
148
+ This License is not intended to limit any rights You have under
149
+ applicable copyright doctrines of fair use, fair dealing, or other
150
+ equivalents.
151
+
152
+ 2.7. Conditions
153
+
154
+ Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
155
+ in Section 2.1.
156
+
157
+ 3. Responsibilities
158
+ -------------------
159
+
160
+ 3.1. Distribution of Source Form
161
+
162
+ All distribution of Covered Software in Source Code Form, including any
163
+ Modifications that You create or to which You contribute, must be under
164
+ the terms of this License. You must inform recipients that the Source
165
+ Code Form of the Covered Software is governed by the terms of this
166
+ License, and how they can obtain a copy of this License. You may not
167
+ attempt to alter or restrict the recipients' rights in the Source Code
168
+ Form.
169
+
170
+ 3.2. Distribution of Executable Form
171
+
172
+ If You distribute Covered Software in Executable Form then:
173
+
174
+ (a) such Covered Software must also be made available in Source Code
175
+ Form, as described in Section 3.1, and You must inform recipients of
176
+ the Executable Form how they can obtain a copy of such Source Code
177
+ Form by reasonable means in a timely manner, at a charge no more
178
+ than the cost of distribution to the recipient; and
179
+
180
+ (b) You may distribute such Executable Form under the terms of this
181
+ License, or sublicense it under different terms, provided that the
182
+ license for the Executable Form does not attempt to limit or alter
183
+ the recipients' rights in the Source Code Form under this License.
184
+
185
+ 3.3. Distribution of a Larger Work
186
+
187
+ You may create and distribute a Larger Work under terms of Your choice,
188
+ provided that You also comply with the requirements of this License for
189
+ the Covered Software. If the Larger Work is a combination of Covered
190
+ Software with a work governed by one or more Secondary Licenses, and the
191
+ Covered Software is not Incompatible With Secondary Licenses, this
192
+ License permits You to additionally distribute such Covered Software
193
+ under the terms of such Secondary License(s), so that the recipient of
194
+ the Larger Work may, at their option, further distribute the Covered
195
+ Software under the terms of either this License or such Secondary
196
+ License(s).
197
+
198
+ 3.4. Notices
199
+
200
+ You may not remove or alter the substance of any license notices
201
+ (including copyright notices, patent notices, disclaimers of warranty,
202
+ or limitations of liability) contained within the Source Code Form of
203
+ the Covered Software, except that You may alter any license notices to
204
+ the extent required to remedy known factual inaccuracies.
205
+
206
+ 3.5. Application of Additional Terms
207
+
208
+ You may choose to offer, and to charge a fee for, warranty, support,
209
+ indemnity or liability obligations to one or more recipients of Covered
210
+ Software. However, You may do so only on Your own behalf, and not on
211
+ behalf of any Contributor. You must make it absolutely clear that any
212
+ such warranty, support, indemnity, or liability obligation is offered by
213
+ You alone, and You hereby agree to indemnify every Contributor for any
214
+ liability incurred by such Contributor as a result of warranty, support,
215
+ indemnity or liability terms You offer. You may include additional
216
+ disclaimers of warranty and limitations of liability specific to any
217
+ jurisdiction.
218
+
219
+ 4. Inability to Comply Due to Statute or Regulation
220
+ ---------------------------------------------------
221
+
222
+ If it is impossible for You to comply with any of the terms of this
223
+ License with respect to some or all of the Covered Software due to
224
+ statute, judicial order, or regulation then You must: (a) comply with
225
+ the terms of this License to the maximum extent possible; and (b)
226
+ describe the limitations and the code they affect. Such description must
227
+ be placed in a text file included with all distributions of the Covered
228
+ Software under this License. Except to the extent prohibited by statute
229
+ or regulation, such description must be sufficiently detailed for a
230
+ recipient of ordinary skill to be able to understand it.
231
+
232
+ 5. Termination
233
+ --------------
234
+
235
+ 5.1. The rights granted under this License will terminate automatically
236
+ if You fail to comply with any of its terms. However, if You become
237
+ compliant, then the rights granted under this License from a particular
238
+ Contributor are reinstated (a) provisionally, unless and until such
239
+ Contributor explicitly and finally terminates Your grants, and (b) on an
240
+ ongoing basis, if such Contributor fails to notify You of the
241
+ non-compliance by some reasonable means prior to 60 days after You have
242
+ come back into compliance. Moreover, Your grants from a particular
243
+ Contributor are reinstated on an ongoing basis if such Contributor
244
+ notifies You of the non-compliance by some reasonable means, this is the
245
+ first time You have received notice of non-compliance with this License
246
+ from such Contributor, and You become compliant prior to 30 days after
247
+ Your receipt of the notice.
248
+
249
+ 5.2. If You initiate litigation against any entity by asserting a patent
250
+ infringement claim (excluding declaratory judgment actions,
251
+ counter-claims, and cross-claims) alleging that a Contributor Version
252
+ directly or indirectly infringes any patent, then the rights granted to
253
+ You by any and all Contributors for the Covered Software under Section
254
+ 2.1 of this License shall terminate.
255
+
256
+ 5.3. In the event of termination under Sections 5.1 or 5.2 above, all
257
+ end user license agreements (excluding distributors and resellers) which
258
+ have been validly granted by You or Your distributors under this License
259
+ prior to termination shall survive termination.
260
+
261
+ ************************************************************************
262
+ * *
263
+ * 6. Disclaimer of Warranty *
264
+ * ------------------------- *
265
+ * *
266
+ * Covered Software is provided under this License on an "as is" *
267
+ * basis, without warranty of any kind, either expressed, implied, or *
268
+ * statutory, including, without limitation, warranties that the *
269
+ * Covered Software is free of defects, merchantable, fit for a *
270
+ * particular purpose or non-infringing. The entire risk as to the *
271
+ * quality and performance of the Covered Software is with You. *
272
+ * Should any Covered Software prove defective in any respect, You *
273
+ * (not any Contributor) assume the cost of any necessary servicing, *
274
+ * repair, or correction. This disclaimer of warranty constitutes an *
275
+ * essential part of this License. No use of any Covered Software is *
276
+ * authorized under this License except under this disclaimer. *
277
+ * *
278
+ ************************************************************************
279
+
280
+ ************************************************************************
281
+ * *
282
+ * 7. Limitation of Liability *
283
+ * -------------------------- *
284
+ * *
285
+ * Under no circumstances and under no legal theory, whether tort *
286
+ * (including negligence), contract, or otherwise, shall any *
287
+ * Contributor, or anyone who distributes Covered Software as *
288
+ * permitted above, be liable to You for any direct, indirect, *
289
+ * special, incidental, or consequential damages of any character *
290
+ * including, without limitation, damages for lost profits, loss of *
291
+ * goodwill, work stoppage, computer failure or malfunction, or any *
292
+ * and all other commercial damages or losses, even if such party *
293
+ * shall have been informed of the possibility of such damages. This *
294
+ * limitation of liability shall not apply to liability for death or *
295
+ * personal injury resulting from such party's negligence to the *
296
+ * extent applicable law prohibits such limitation. Some *
297
+ * jurisdictions do not allow the exclusion or limitation of *
298
+ * incidental or consequential damages, so this exclusion and *
299
+ * limitation may not apply to You. *
300
+ * *
301
+ ************************************************************************
302
+
303
+ 8. Litigation
304
+ -------------
305
+
306
+ Any litigation relating to this License may be brought only in the
307
+ courts of a jurisdiction where the defendant maintains its principal
308
+ place of business and such litigation shall be governed by laws of that
309
+ jurisdiction, without reference to its conflict-of-law provisions.
310
+ Nothing in this Section shall prevent a party's ability to bring
311
+ cross-claims or counter-claims.
312
+
313
+ 9. Miscellaneous
314
+ ----------------
315
+
316
+ This License represents the complete agreement concerning the subject
317
+ matter hereof. If any provision of this License is held to be
318
+ unenforceable, such provision shall be reformed only to the extent
319
+ necessary to make it enforceable. Any law or regulation which provides
320
+ that the language of a contract shall be construed against the drafter
321
+ shall not be used to construe this License against a Contributor.
322
+
323
+ 10. Versions of the License
324
+ ---------------------------
325
+
326
+ 10.1. New Versions
327
+
328
+ Mozilla Foundation is the license steward. Except as provided in Section
329
+ 10.3, no one other than the license steward has the right to modify or
330
+ publish new versions of this License. Each version will be given a
331
+ distinguishing version number.
332
+
333
+ 10.2. Effect of New Versions
334
+
335
+ You may distribute the Covered Software under the terms of the version
336
+ of the License under which You originally received the Covered Software,
337
+ or under the terms of any subsequent version published by the license
338
+ steward.
339
+
340
+ 10.3. Modified Versions
341
+
342
+ If you create software not governed by this License, and you want to
343
+ create a new license for such software, you may create and use a
344
+ modified version of this License if you rename the license and remove
345
+ any references to the name of the license steward (except to note that
346
+ such modified license differs from this License).
347
+
348
+ 10.4. Distributing Source Code Form that is Incompatible With Secondary
349
+ Licenses
350
+
351
+ If You choose to distribute Source Code Form that is Incompatible With
352
+ Secondary Licenses under the terms of this version of the License, the
353
+ notice described in Exhibit B of this License must be attached.
354
+
355
+ Exhibit A - Source Code Form License Notice
356
+ -------------------------------------------
357
+
358
+ This Source Code Form is subject to the terms of the Mozilla Public
359
+ License, v. 2.0. If a copy of the MPL was not distributed with this
360
+ file, You can obtain one at https://mozilla.org/MPL/2.0/.
361
+
362
+ If it is not possible or desirable to put the notice in a particular
363
+ file, then You may include the notice in a location (such as a LICENSE
364
+ file in a relevant directory) where a recipient would be likely to look
365
+ for such a notice.
366
+
367
+ You may add additional accurate notices of copyright ownership.
368
+
369
+ Exhibit B - "Incompatible With Secondary Licenses" Notice
370
+ ---------------------------------------------------------
371
+
372
+ This Source Code Form is "Incompatible With Secondary Licenses", as
373
+ defined by the Mozilla Public License, v. 2.0.
@@ -0,0 +1,205 @@
1
+ Metadata-Version: 2.4
2
+ Name: openzilo-gesture-studio
3
+ Version: 0.2.0
4
+ Summary: Desktop ring gesture recording, training and export platform
5
+ License-Expression: MPL-2.0
6
+ Requires-Python: >=3.10
7
+ Description-Content-Type: text/markdown
8
+ License-File: LICENSE
9
+ Requires-Dist: openzilo-gesture==0.2.0
10
+ Requires-Dist: sounddevice<0.6,>=0.5
11
+ Requires-Dist: PySide6-Essentials<6.12,>=6.9
12
+ Requires-Dist: pyqtgraph<0.15,>=0.13.7
13
+ Requires-Dist: openzilo[pcm]==0.6.3
14
+ Dynamic: license-file
15
+
16
+ # HMM Gesture Studio / 手势训练平台
17
+
18
+ 独立于推理包的桌面应用:扫描/连接 OpenZilo 戒指,显示实时六轴曲线、录制手势、导入 JSON/CSV、训练、导出和试识别,也可接收/下载戒指录音。使用 uv 管理环境与依赖,需要 Python 3.10+、Git 和蓝牙权限;新版固件通过订阅启动 IMU,无需切换模式;新增功能按连接时查询到的设备能力开放。
19
+
20
+ 默认启动基于 PySide6 的新界面。旧的 Tkinter 界面仍然保留,可用 `--ui legacy` 启动。
21
+
22
+ 新界面支持中文和英语:首次启动跟随系统界面语言,中文系统使用中文,其他语言使用英语。可在侧边栏“设置 → 语言”选择“跟随系统 / English / 中文”,即时生效并记住选择,不影响设备连接、录制或未保存的输入。旧界面仍为中文。
23
+
24
+ 从仓库根目录安装和启动:
25
+
26
+ ```bash
27
+ uv sync --locked --all-packages
28
+ uv run --locked --all-packages openzilo-gesture-studio
29
+ # 或 uv run --locked --package openzilo-gesture-studio python -m openzilo_gesture_studio
30
+
31
+ # 启动旧界面(需要带 Tkinter 的 Python)
32
+ uv run --locked --all-packages openzilo-gesture-studio --ui legacy
33
+ # 或 uv run --locked --all-packages openzilo-gesture-studio-legacy
34
+ ```
35
+
36
+ 工作区共用根目录的 `uv.lock` 和 `.venv/`,默认开发解释器为 Python 3.12,无需手动激活环境。在 `studio/` 目录内也可直接运行 `uv run --locked openzilo-gesture-studio`,但默认数据目录相对于当前工作目录。
37
+
38
+ 新界面的 PySide6 和 pyqtgraph 由 uv 安装。Linux 若提示缺少系统库,请执行 `sudo apt install libegl1 libgl1 libxkbcommon0 libdbus-1-3`。
39
+
40
+ 只有旧界面需要 Tkinter:Linux 可能需要 `sudo apt install python3-tk`;macOS 请使用带 Tk 的 Python,Homebrew Python 需安装匹配版本的 `python-tk`。Tkinter 由 Python/系统提供,不能用 `uv add` 安装;可用 `uv sync --locked --all-packages --python /path/to/python3.12` 选择解释器。
41
+
42
+ ## 界面对照
43
+
44
+ 下文沿用旧界面的页面名称。两套界面的功能和数据目录相同,对应关系如下:
45
+
46
+ | 旧界面 | 新界面 |
47
+ | --- | --- |
48
+ | 设备连接区 | 侧边栏底部的设备卡 → “设备”页 |
49
+ | 手势录制与训练 | “采集”页(录制、数据集)、“训练”页(参数、训练、导出) |
50
+ | 实时六轴曲线 | “实时”页(“采集”页只显示录制后的波形) |
51
+ | 实时试识别开关 | “实时”页 |
52
+ | 录制波形(滤波后) | “采集”页 |
53
+ | 加速度诊断 | “诊断”页 |
54
+ | 戒指录音 | “录音”页 |
55
+ | 校准与固件 | “设备工具”页 |
56
+ | —(新界面新增) | “关于”页:版本号、GitHub 仓库、贡献者(打开该页时才从 GitHub 获取公开信息,不发送设备或手势数据) |
57
+ | 日志 | 窗口底部的日志栏,点击“显示日志”展开为列表,可多选后复制 |
58
+
59
+ ## 使用流程
60
+
61
+ 1. 选择工作目录(默认 `gestures/`),扫描选择戒指或直接输入地址,点击连接。成功连接的设备会保存在本机历史中,下次从下拉框直接选择,无需重新扫描;最多保留最近 20 台,可用“清空设备历史”删除。macOS 地址通常是 UUID。BLE 连接状态与 IMU 上报状态分别显示;只有实际收到新的 IMU 数据才允许采集手势。
62
+ 2. 输入手势名称,点击开始录制,做一次动作后停止;拒识标定训练每类至少三次,建议五到十次以上。停止后自动显示“录制波形(滤波后)”:实线为与训练一致的中值+低通滤波结果,浅色虚线为原始数据;可切换各次重复、关闭原始叠加。也可在数据集中选中已保存手势,再进入波形页查看。默认每次至少 12 个采样点,过短录制只预览、不保留。保存时可以确认追加到同名、同采样率数据,未完成的录制在断连时丢弃。
63
+ 3. 也可导入已有 JSON 或多个无表头 CSV(每个文件一次重复,六列 `ax,ay,az,gx,gy,gz` 原始 int16 值)。CSV 采样率取界面中的采样率设置。旧 JSON 未标注采样率时按 25 Hz 处理。
64
+ 4. 设置训练采样率,使其匹配数据实际采样率;低通截止频率必须小于采样率一半,中值点数设为 `1` 可关闭中值滤波。响指、敲击等短促动作请先点击“应用短促动作 / 响指预设”,挥手等选择连续动作预设。点击“训练全部数据”,后台训练及拒识标定不阻塞界面。不同采样率不能混训。
65
+ 5. 导出 `*.gesture.json`,包含手势名称、HMM 参数、预处理和分段参数。数据或训练配置修改后需重新训练才能导出。
66
+ 6. 可加载已导出的模型包,连接同采样率戒指,开启实时试识别。先静止,每次手势后恢复静止。单类没有相对置信度,不再显示固定 `0.80`;无拒识标定的单类旧模型不能开启自动识别,需重新训练。拒识检查也不是概率保证,仍须用普通运动、抖动等负样本验证误触。
67
+
68
+ ### 删除已保存手势
69
+
70
+ 在数据集列表中选中一项或多项,点击“删除选中手势”。确认框会列出名称、文件路径和录制次数;确认后**永久删除所选 JSON 文件及其中全部录制、训练框标注,无法撤销**。取消不会改变文件或模型状态。
71
+
72
+ - 只操作所选行的实际文件;其他手势、未保存录制、正在采集的数据和已导出的模型文件均保留。
73
+ - 删除后刷新列表与已保存波形预览,当前训练模型和已有评估结果失效,需重新训练;独立加载的模型包不受影响。训练、评估和退出期间禁止删除。
74
+ - 批量删除逐项执行,失败不阻止其他所选项;提示分别列出成功、已不存在和失败的文件。不自动重试或回滚,处理失败原因后可重新选择并删除。全部失败且数据未改变时,不刷新或使模型失效。
75
+
76
+ ## 戒指电量
77
+
78
+ 设备连接区域右侧显示电量百分比及“充电中”状态,连接时读取,之后每 60 秒后台刷新。未充电且电量不高于 20% 时显示红色“低电量”提示。未连接显示“—”,读取失败或设备返回无效百分比时显示“未知”,不会把缺失值当作 0%。
79
+
80
+ 电量查询不停止 IMU 上报或收数;音频传输期间暂缓查询,自动接收待机时仍可刷新。读取失败会记录警告并在下一周期重试,不单独断开连接;断开/重连时清空旧电量。
81
+
82
+ ## 实时曲线与上报恢复
83
+
84
+ - “实时六轴曲线”页显示加速度 `ax/ay/az` 和陀螺仪 `gx/gy/gz` 两组曲线,自动缩放,默认显示最近 10 秒。横轴按采样率估算,不是设备时间戳;所有值均为原始 int16。
85
+ - 开启实时试识别后,每个成功识别的片段会在两组六轴图上用紫色虚线框标注,并显示手势名称和置信度。框按实际采样位置对齐(包括分段预留帧,不包括结束静止帧),不是按识别结果到达时间估算。
86
+ - “暂停显示”冻结图形和已有识别框,不停止收数或录制;“恢复显示”回到最新数据。框随曲线滚动、离开窗口后移除。“清空”清除图形及识别框,不删除训练数据,也不影响后续框的位置。
87
+ - IMU 无数据或 `DEVICE_BUSY` 不被当成 BLE 断连。界面显示等待状态,取消未完成的手势,保留已完成的重复。
88
+ - 自动重试订阅,收到新数据后刷新数值与曲线。也可点击“重试 IMU 上报”;只有开始上报的 ACK 并不算恢复成功。
89
+ - 如果 BLE 本身断开,Studio 会退避重连;点击“断开 / 取消连接”或退出可终止重连。协议错误等异常仍会明确报告。
90
+ - **录音和音频传输不暂停 IMU**。实时/远程录音、历史下载、自动接收及保存都与原始 IMU 独立接收,不停报、不重新订阅,六轴曲线与加速度显示持续更新;取消音频或音频保存失败也不停止 IMU。校准、诊断和固件升级仍独占设备资源。手势录制与音频操作的按钮互斥不变;开始音频工具操作会停止实时试识别,回到手势页后按需要重新开启,并静止重建基线。
91
+
92
+ ## 加速度方向与合加速度诊断
93
+
94
+ 连接戒指并收到新 IMU 数据后,打开 **“加速度诊断”** 页,无需录制或加载模型:
95
+
96
+ - 显示最新样本的三轴合成值 `|a| = sqrt(ax² + ay² + az²)`,单位为 raw、g 和 m/s²;同时显示换算后的 X/Y/Z 分量。
97
+ - 使用设备实际报告的加速度量程:`a_g = raw × accel_range_g / 32768`,`a_m/s² = a_g × 9.80665`。量程未知/无效时只显示 raw 和方向,不猜测 ±8g 或 ±16g。
98
+ - 方向为单位向量 `a / |a|`,附与传感器 +X/+Y/+Z 的夹角及 XY/XZ/YZ 平面投影。沿负轴时分量为负、夹角趋近 180°;零向量的方向未定义,接近零时方向容易受噪声影响。轴名沿用固件上报结果,不再次映射芯片轴。
99
+ - 合加速度曲线保留每个收到的样本(不是只画每批最后一帧),显示最近 10 秒及窗口最小/最大值;最多保留 5000 点。横轴按采样率估算,不是设备时间戳。“暂停显示”一起冻结数值、方向和曲线,但后台继续收数;“清空”不影响录制/识别。停报、断连、采样率或量程变化会清空诊断,避免把旧值当作当前值。
100
+
101
+ **这是含重力的加速度计读数(比力),不是去重力后的线加速度,也不是移动/速度方向或世界航向。** 静止时通常约 1g;换个姿态静止,方向会变而模长仍约 1g。夹角不是姿态欧拉角;页面的 `|a| − 1g` 也不是三维去重力运算。真正去重力需要在同一坐标系中逐轴相减 `a_linear = a − g_body`。
102
+
103
+ ### 幅值参考范围
104
+
105
+ 页面提供两组相对 1g 的**幅值参考范围**,方便观察静置和运动时的变化。这些是显示用的参考线,不是从固件读取的实际算法阈值:
106
+
107
+ | 相对 1g 的偏差 | 范围(含边界) | 曲线 |
108
+ | --- | --- | --- |
109
+ | ±3% | 0.97–1.03 g | 绿色虚线 |
110
+ | ±10% | 0.90–1.10 g | 橙色虚线 |
111
+
112
+ 可先静置戒指观察是否接近 1g,再换几个姿态静置,最后做平移/转动,观察方向和模长是否符合预期、何时超出参考范围。短促峰值可在曲线及窗口最大值中查看。这些数值未经训练滤波,诊断不会改变训练、识别或设备参数。
113
+
114
+ **“范围内”不等于设备静止、姿态融合有效或校准成功。** 缓慢转动也可能保持约 1g;静止与姿态判断通常还需结合陀螺仪、波动和持续时间等信息。本页仅展示加速度诊断,不计算或代替设备的姿态、去重力线加速度及校准状态。
115
+
116
+ ## 戒指录音
117
+
118
+ 先连接设备、停止手势录制,选择保存目录(默认 `audio/`)。四种音频操作不能并行:
119
+
120
+ - **远程录音**:读取当前设置/状态,设置单/双声道、8000–32000 bit/s、左右增益 Q8(256 为 1 倍,范围 0–1024)以及最长时长(20–60000 ms,20 的整数倍)。开始后保存在戒指;“停止并保存”请求提前停止,确认保存完成才下载,不把停止 ACK 当作文件已保存。开始超时先查询状态,不重复发送开始。
121
+ - **实时 PCM 接收并保存**:先订阅再开始录音,使用 `LIVE_AND_FLASH` 同时保留戒指副本。PyAV 在进程内解码,无需系统 ffmpeg;仅完整 END 校验通过后保存 WAV,不做语音识别。可在开始前勾选默认关闭的“边接收边播放(仅实时 PCM)”,通过电脑默认音频输出监听;接收期间不能切换。建议使用耳机,避免啸叫。播放失败或缓冲积压会停止播放并在日志中警告,不影响接收和保存;结束、取消或断连时清理播放。提前停止需等待完整结束;中断/丢包不把部分数据当完整录音,必要时从历史下载设备副本。
122
+ - **自动接收**:开启保存通知监听后,可用物理按键长按录音、松开保存。新版 `0x050A` 通知触发下载,监听待机与实际下载均不暂停 IMU。停止接收只停止电脑接收,不停止由物理按键启动的录音。
123
+ - **历史文件**:先停止其他音频操作,查询历史,按索引下载。重复下载使用新文件名,不覆盖旧文件,也不删除戒指副本。
124
+
125
+ 实时播放由 Studio 的 sounddevice/PortAudio 提供,不需要外部播放器。Linux 可能需要 `sudo apt install libportaudio2`;缺少库或没有可用输出设备时仅停止播放,录音接收仍继续。播放不是完整录音的证明,听感和延迟需在目标声卡与戒指上实测。
126
+
127
+ 远程和实时录音断线策略为 STOP。文件传输进度不是录音时长;只有有效 WAV 才显示时长。下载文件先保留原始 `.bin` 再转换 WAV;Opus 单/双声道由 SDK 自动识别。文件解码需要系统 ffmpeg(macOS `brew install ffmpeg`,Ubuntu/Debian `sudo apt install ffmpeg`,Windows 加入 PATH);失败保留原始文件。
128
+
129
+ 设备历史继续保存在用户配置目录的 `hmm-gesture-studio/devices.json`,改名前已保存的戒指可直接读取。macOS 为 `~/Library/Application Support/`,Windows 为 `%APPDATA%`,Linux 为 `$XDG_CONFIG_HOME`(默认 `~/.config`)。仅记录成功连接的地址、名称和最近连接时间,不上传;文件损坏或无法写入不影响连接。
130
+
131
+ 请在目标戒指上验证订阅、远程开始/停止、长按/松开保存、实时 END、下载与重连;自动测试不代表真机实测。
132
+
133
+ ## 本机 IMU 校准与诊断
134
+
135
+ 打开“校准与固件”页,停止自动音频监听后操作。校准与诊断独占 IMU,期间不能录制手势或做实时识别。
136
+
137
+ - 加速度六面:戒指固定在充电盒中,不在六面采集中重新吸附。按提示摆放并松手,点“继续”;收齐正负六面后,再用三个不同轴的新数据独立验证。
138
+ - 陀螺仪静止:取出充电盒、远离磁铁并平放。等待三个稳定窗口,采集至少 20 秒,再独立验证。完整校准顺序执行两部分。
139
+ - 全部验证通过才原子保存本机配置。取消、采集/验证失败保留旧配置;不会向戒指写参数。
140
+ - “查看配置”展示绑定设备、型号、精确固件和量程。固件升级或量程不匹配时拒绝使用,明确确认“重置配置”后重新校准,不自动覆盖不匹配配置。
141
+ - “校准诊断”单独显示 g、°/s 与实际应用的校准组件。“停止”退出后恢复原始 IMU 订阅。**校准值不进入手势训练、录制或识别**;已有数据和模型仍使用原始整数计数。没有校准组件时不能把诊断读数当作已校准精度保证。
142
+
143
+ ## 签名固件 OTA
144
+
145
+ 1. 停止录音、下载、校准和手势录制,保持设备供电与蓝牙连接。
146
+ 2. 选择签名 APP `.ota.zip`,以及从独立可信来源取得的 P-256 PEM 公钥。不能信任固件包自己附带的公钥。
147
+ 3. 点击离线验签,核对显示的型号、板型、允许起始版本、目标版本等签名元数据,再确认升级。拒绝测试固件;不支持原始 BIN。
148
+ 4. 使用已验签的字节快照进行升级,避免文件在确认后被替换。SDK 再次核对设备兼容性,传输后等待重启、重连与完整版本验证。
149
+ 5. 升级期间禁止其他设备操作、断开和普通退出,等待完成或超时。**100% 只表示发送进度,不表示成功安装**。失败不会自动重试;会结束当前 Studio 会话,请手动重新连接并核对设备版本后处理。固件更新后需要重新检查本机校准配置。
150
+
151
+ 开发测试不会自动操作真实设备或刷机;OTA 成功、校准精度与录音效果仍需按目标硬件验收。录音并发验收时,先确认 IMU 持续更新,再分别开始远程和实时 PCM 录音,检查录音、停止和保存全过程的六轴曲线及样本计数持续前进,且没有因音频操作出现暂停或重新订阅;实时播放开启时也应复测。真实 BLE 并发吞吐与丢包情况不能由模拟测试保证。
152
+
153
+ ## 响指等短促动作
154
+
155
+ 100 Hz 下,5 点中值滤波可能把一两帧的真实冲击当成异常值删除;10 Hz 低通又会进一步削弱它。更平滑不等于更适合识别。
156
+
157
+ 1. 点击“应用短促动作 / 响指预设”。采样率取当前设备或录制数据;100 Hz 时为 **中值关闭、2 阶 30 Hz 低通、8 帧特征窗口 / 4 帧重叠**。滤波器从首帧稳态初始化,不制造从零开始的假动作。
158
+ 2. 触发量是**原始相邻加速度差的范数**,默认阈值 8000(原始传感器单位,不是 g)。触发后取前 0.12 秒、后 0.28 秒;100 Hz 时共 41 帧。冷却为从触发起 0.6 秒,避免一次冲击反复触发。
159
+ 3. **默认训练、离线识别、实时识别用同一个窗口规则**。手动录制可以保留前后等待,训练只取紫框内的数据。没有完整冲击、有多个冲击或前后文不足时会明确拒绝训练,不静默挑选一段;也可按下节手动指定训练框。原始录制不会被截断。
160
+ 4. 在录制预览看紫框是否覆盖完整的关键动作;框内实线就是段内预处理后的模型输入。调整触发阈值、低通、中值窗口或手动框后需重新训练。
161
+
162
+ ### 手动训练裁剪框
163
+
164
+ 在“录制波形(滤波后)”页选择某次录制,打开“手动框选”,在加速度或陀螺仪图上横向拖拽,框住完整动作及少量前后静止。两张图显示同一个框;重新拖拽可替换,点击“恢复自动裁剪”可移除手动覆盖。每次重复独立保留一个框,至少包含当前特征参数要求的采样点数(默认 12 点)。连续动作模式也可手动框选。
165
+
166
+ - 未保存录制的框随“保存 / 追加”写入;选中已保存手势时,修改框立即保存到原文件。切换重复、刷新或重启后仍可查看。
167
+ - 只保存样本索引标注,完整原始六轴数据不变;训练及拒识标定只使用手动框内数据,不再要求该次录制通过自动冲击检测。
168
+ - **手动框不改变实时触发阈值或窗口长度**。短促预设只看相邻加速度差,陀螺仪变化很大也未必触发。若没有自动框,仍需调整触发阈值或选用连续动作模式,并重新训练、实测;手动框的长度和位置应尽量与实时窗口一致。
169
+ - 留出评估的各折训练使用手动框,但测试仍对完整录制调用原识别流程(短促模式自动分段),漏触发计为未识别,不把手动选中动作当成自动检测成功。
170
+
171
+ 连续动作模式仍保留基线分段,但 Studio 把持续时间换算为采样帧数;例如 100 Hz 下最长 5 秒是 500 帧,不再沿用 25 Hz 的 125 帧上限。不同类型动作不要未经评估就混用同一个分段预设。
172
+
173
+ ## 识别优化、拒识与效果评估
174
+
175
+ 训练在标准化后的 24 维特征上拟合 HMM,并限制过小的状态方差;导出前将参数还原到原特征空间。GUI 默认额外执行逐次留出拒识标定,每类至少 3 次录制,使用留出分数下界、片段长度和(短促模式下)冲击强度检查候选。它不再因为模型只有一个就把所有运动归为该类,但**只有正样本仍不能证明未知动作检测可靠**。
176
+
177
+ 新增滤波初始化、短促分段和拒识参数使用 **v2 导出**;读取 v1 时保留原滤波、分段和离线模型得分。**已有模型不会自动修正,需要重新训练并导出**。
178
+
179
+ 点击“留出评估”可在后台验证,每类至少 4 次有效录制:外层每轮留出一次,其余录制再用于训练与内层拒识标定;测试数据不进入归一化、门限或拟合。单类只报告**正样本通过率**,不是完整识别准确率,更不能代表误触率。日志给出各类预测分布和过短录制数。评估不替换当前模型,也不会在每次训练时自动运行;还需独立的连续数据与负样本测试。
180
+
181
+ ```bash
182
+ uv run --locked --package openzilo-gesture-studio python -m openzilo_gesture_studio.evaluation --data sample_data
183
+ ```
184
+
185
+ 此前针对仓库 25 Hz 示例、默认旧式分段/滤波参数且未开启拒识的 5 折比较:旧流程 **19/30(63.3%)**,仅加数值正则化为 **20/30(66.7%)**;提升有限,“向下”“向右”仍有明显混淆。这不是新响指预设或拒识效果的评测。此结果用于开发验证,不代表真实佩戴场景准确率,也不是调参后的独立测试集。建议每个手势录制至少 5–10 次,保持佩戴方向、采样率一致,并另录独立会话测试。录制前后留少量静止、每次只做一个动作;结合滤波预览排查噪声、动作差异及过长的等待片段。
186
+
187
+ ## 无 GUI 训练
188
+
189
+ ```bash
190
+ uv run --locked --package openzilo-gesture-studio openzilo-gesture-train --data sample_data --output exports/demo.gesture.json
191
+ ```
192
+
193
+ 这会训练仓库六类示例数据。只验证流程,不是独立准确率评测。旧 `*.pkl` 不会直接导入;请用录制 JSON 重新训练导出,避免 pickle 的执行风险和缺少预处理参数的问题。
194
+
195
+ 导出后,使用端只需识别包:在仓库根目录用 `uv sync --locked` 仅同步 `openzilo-gesture`,或在其他 uv 应用中用 `uv add /path/to/OpenZilo-Gesture` 添加依赖。无需此平台、Tkinter 或 OpenZilo SDK:
196
+
197
+ ```python
198
+ from openzilo_gesture import GestureRecognizer
199
+ recognizer = GestureRecognizer.load("exports/demo.gesture.json")
200
+ result = recognizer.predict(samples, sample_rate_hz=25) # (N, 6) 原始值
201
+ for result in recognizer.feed(batch, sample_rate_hz=25):
202
+ print(result.name, result.confidence)
203
+ ```
204
+
205
+ 项目采用 MPL-2.0。Studio 从 PyPI 安装 `openzilo[pcm]==0.6.3`。训练与推理均在电脑端运行。