Files
opendance-android/tasks/003-mediapipe-pose.md
T

49 lines
1.6 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-AND-003 MediaPipe Pose 端侧推理
- **状态**:done
- **依赖**:T-AND-002
## 目标
用 MediaPipe Tasks Vision 在设备本地做姿态推理,输出 33 个归一化关键点。
## load
```
DSH.md
contracts/skeleton-topology.md # 锚点:§1 33 点、§4 坐标系
app/src/main/java/com/opendance/studio/pose/PoseDetector.kt
```
## 交付物
`pose/PoseDetector.kt` + `app/src/main/assets/pose_landmarker_lite.task`(5.7 MB)。
## 关键实现
| 项 | 说明 |
|---|---|
| 运行模式 | `LIVE_STREAM` + `detectAsync`,不阻塞相机线程 |
| 模型 | `pose_landmarker_lite.task`(随 APK 分发,`noCompress "task"` 保证可读) |
| 置信度阈值 | detection / presence / tracking 均 0.5 |
| 背压 | `busy` 标志:上一帧仍在推理时直接丢弃新帧并计数,不排队 |
| 时间戳 | 单调递增校正(MediaPipe 要求严格递增) |
| 缺失点 | 置信度置 0、坐标归零,接收端按契约插值 |
## 坐标与镜像语义
- 发送**未镜像的原始 MediaPipe 坐标**(契约 §4)
- 是否镜像由帧头 `flags.bit0` 声明,接收端据此决定如何还原
- 叠加层绘制时才取 `1 - x`,与前置摄像头预览的镜像观感一致
这保证了同一份关键点数据在「镜像预览」与「真实左右」两种解释下都不会歧义。
## 上半身模式
`upperBodyOnly = true` 时,髋部及以下点置信度置 0 并置 `flags.bit2`,
接收端会插值。用于带宽/算力不足时降级。
## 验收
`assembleDebug` 通过;运行页在真机上可看到骨架叠加层(见 tasks/009)。