Files
opendance-windows/tasks/007-scoring-dtw.md
T

43 lines
1.3 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# T-WIN-007 DTW 评分引擎
- **状态**:done
- **依赖**:T-WIN-004、T-WIN-002
## 目标
用 DTW 把实时关键点序列与服务端参考序列比对,产出 0~100 分与等级。
## load
```
DSH.md
contracts/skeleton-topology.md # 锚点:§5 派生特征
contracts/model-formats.md # 锚点:§2.1 预处理产物
src/score/pose_features.gd
src/score/dtw.gd
src/score/scoring.gd
```
## 特征(契约 §5 冻结)
每帧 = `[33 × (x,y,z), 9 个关节角余弦]` = **108 维**。
低置信度点(conf < 0.5)对应维度**权重置 0**,不参与代价计算。
## DTW
- Sakoe-Chiba 带状约束 `|i − j| ≤ band`(默认 15 帧 ≈ 0.5 秒)
- `DtwMatcher.compute_full()` 离线段;`StreamingDtw` 逐帧流式推进,
每帧只计算带内一行,总体复杂度 O(n·m·band) 但摊到每帧 O(m·band)
- 归一化:代价 / max(i,j)+1,得到「平均每步代价」
## 评分规则(`scoring.gd`)
`score = clamp(1 − cost/tolerance, 0, 1) × 100`,EMA 平滑抑制抖动,
等级 S(≥95) / A(≥85) / B(≥70) / C(≥55) / D,连击阈值 70。
## 验收
`tests/test_dtw.gd` + `tests/test_pose_features.gd`:相同序列距离为 0、
路径单调且起于 (0,0)、带宽约束、时间伸缩吸收、流式与离线一致、
低置信度维度不参与距离、角度计算正确性。