File size: 4,340 Bytes
a0cc79e | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | # Phase → Primitive 标注试跑说明
**任务**:`blocks_ranking_rgb`
**Exemplar**:`demo_clean_100_arx` / episode **0**
**工具**:`phase_annotation.py`
---
## 流程
```text
propose-phases → 细切 still+gripper phases
draft-merge-map → 用现有 v4 标注 bootstrap 合并规则(可人工改)
apply-phase-merge → 套规则写出 5 类 annotation
```
---
## 本轮试跑结果(closing/opening=10)
参数:`--closing-frames 10 --opening-frames 10`(已与旧 gripper 窗口对齐)
| Episode | 细 phases | cycles | 输出 annotation |
|---------|-----------|--------|-----------------|
| 0(exemplar) | 52 | 3 | `annotations_phase_v5/.../episode_00000.json` |
| 1–4 | 49–53 | 3 | 同上目录 |
ep0 合并后 grasp/release 均为 **10 帧**,与旧 `annotations/` v4 完全一致(15 段、边界相同)。
### 自动 type_rules(可改)
```json
{
"still_open": "reach",
"move_open": "reach",
"closing": "grasp",
"still_closed": "transition",
"move_closed": "transition",
"opening": "release",
"open_motion_context": true,
"reach_pregrasp_frames": 30
}
```
含义:
- 闭合窗口 → grasp;打开窗口 → release
- 闭合期间运动/静止 → transition
- 打开期间:默认 reach;**release 之后**先 retract,但 **下一次 closing 前 30 帧**改回 reach
### 关键文件
```text
outputs/classification_probe/phases/blocks_ranking_rgb/demo_clean_100_arx/
episode_00000/
phases.json # 细切结果
phases.md # 表格(人工读这个)
phases_timeline.png
phases_vs_merged_timeline.png
phases_primitives.mp4 # 上:phase / 下:primitive 叠加视频
merge_map.json # 按 phase_id 分组的草稿(适合改 exemplar)
merge_map_type_rules.json # 可迁移到其它 episode 的规则
outputs/classification_probe/annotations_phase_v5/blocks_ranking_rgb/demo_clean_100_arx/
episode_00000.json … episode_00004.json
```
旧的 `annotations/` **未覆盖**。
---
## 你接下来怎么人工改
1. 打开 `episode_00000/phases.md` + `phases_vs_merged_timeline.png` + 原视频 `episode0.mp4`
2. 看合并后的 5 类是否合理(尤其 grasp/release 长短、retract↔reach 分界)
3. 两种改法任选:
- **改规则**(推荐,可迁移):编辑 `merge_map_type_rules.json`
例如把 `closing` 视作更长 grasp:增大 propose 时的 `--closing-frames`
或改 `reach_pregrasp_frames`
- **改 exemplar 逐段**:编辑 `episode_00000/merge_map.json` 里 `merges[].phase_ids` / `label`,再对 ep0 用 `--merge-map .../merge_map.json` apply
4. 满意后对全 demo 批量:
```bash
cd /data/mani/progress_probe_repro
LABEL=/share/robotwin2.0-hard-cross-embodiment
VIDEO=/share/robotwin2.0-hard
# 先细切(可一次 100 ep)
python -u phase_annotation.py propose-phases \
--task blocks_ranking_rgb --demo demo_clean_100_arx \
--episodes $(seq 0 99) \
--label-root "$LABEL" --video-root "$VIDEO"
# 再套同一套规则
python -u phase_annotation.py apply-phase-merge \
--task blocks_ranking_rgb --demo demo_clean_100_arx \
--episodes $(seq 0 99) \
--label-root "$LABEL" --video-root "$VIDEO" \
--merge-map outputs/classification_probe/phases/blocks_ranking_rgb/demo_clean_100_arx/merge_map_type_rules.json
```
---
## 命令速查
```bash
# 1) 细切
python phase_annotation.py propose-phases --demo demo_clean_100_arx --episode 0 \
--label-root $LABEL --video-root $VIDEO
# 2) 从旧标注生成 merge 草稿
python phase_annotation.py draft-merge-map --demo demo_clean_100_arx --episode 0 \
--label-root $LABEL --video-root $VIDEO --annotation-root outputs/classification_probe
# 3) 应用
python phase_annotation.py apply-phase-merge --demo demo_clean_100_arx --episodes 0 1 2 3 4 \
--label-root $LABEL --video-root $VIDEO \
--merge-map outputs/classification_probe/phases/blocks_ranking_rgb/demo_clean_100_arx/merge_map_type_rules.json
# 4) 可视化(phase + primitive 叠加 mp4)
python phase_annotation.py viz-phases --demo demo_clean_100_arx --episode 0 \
--label-root $LABEL --video-root $VIDEO --annotation-root outputs/classification_probe \
--merge-map outputs/classification_probe/phases/blocks_ranking_rgb/demo_clean_100_arx/merge_map_type_rules.json
```
|