WGO Deploy Bot Cursor commited on
Commit
fdca2a6
·
1 Parent(s): f425603

Document full input, output, and scoring contract for new users.

Browse files
Files changed (1) hide show
  1. README.md +157 -46
README.md CHANGED
@@ -26,6 +26,144 @@ Self-contained eval for **localization given labels**: the model is given the go
26
 
27
  Derived from [Macrodata Labs' WGO-Bench](https://huggingface.co/datasets/macrodata/WGO-Bench) ([blog](https://macrodata.co/blog/annotating-robot-video-subtasks)). License: **CC-BY-NC-SA-4.0**. Keep downstream use consistent with Macrodata's attribution and non-commercial / share-alike terms.
28
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  ## Splits
30
 
31
  | Split | Source ids | Episodes | Gold events |
@@ -33,7 +171,7 @@ Derived from [Macrodata Labs' WGO-Bench](https://huggingface.co/datasets/macroda
33
  | `train` | `dev_80` | 80 | 623 |
34
  | `test` | `heldout_20` | 20 | 120 |
35
 
36
- Construction seed is frozen at **0**. Shuffled `label_specs` and `prompt_text` are materialized per row so order is byte-stable without re-running the RNG. Split id lists are also under `meta/splits/`.
37
 
38
  **Challenge leakage rule:** train localization models only on `train`. Score free-mode segmentation F1@0.75 on the untouched `test` episodes (or an external set). Do not train on `test`.
39
 
@@ -49,65 +187,38 @@ Each row is one episode:
49
  | `split` | string | `train` or `test` |
50
  | `video` | binary | MP4 bytes |
51
  | `label_specs` | list | `{label, multiplicity}` in **prompt order** (post-shuffle) |
52
- | `gold_segments` | list | `{start_sec, end_sec, label}` in gold order |
53
- | `prompt_text` | string | Exact localization prompt |
54
  | `construction` | struct | `{seed, protocol, source}` |
55
 
56
- ## Prediction format
57
 
58
- ```json
59
- {
60
- "id": "galaxea_002",
61
- "labels": [
62
- {
63
- "label": "pick up the pink stick",
64
- "intervals": [
65
- {"label_echo": "pick up the pink stick", "start_sec": 1.2, "end_sec": 3.4}
66
- ]
67
- }
68
- ]
69
- }
70
- ```
71
-
72
- Return exactly `multiplicity` intervals per listed label. Echo the exact label string in `label_echo`.
73
-
74
- ## Scoring
75
-
76
- No gold-aware snapping. Report **both** layers:
77
-
78
- | Layer | Metric | Definition |
79
- |-------|--------|------------|
80
- | **Per event** | **IoU** | Overlap / union of one gold interval vs its matched prediction (within-label 1:1 assignment; unmatched → 0) |
81
- | **Run / split** | **mean IoU** | Mean of those per-event IoUs |
82
- | **Run / split** | **continuous F1** | Same number under this protocol: when the model returns the requested multiplicities, \(N_g = N_p\), so continuous F1 \(= 2S/(N_g+N_p)\) collapses to mean IoU. Emitted as `continuous_f1` (= `mean_iou`) for consistency with free-segmentation continuous F1 |
83
- | **Run / split** | **F1@0.75** | Fraction of gold events with IoU ≥ 0.75. Under 1:1 binding with matched counts this equals thresholded precision = recall = F1 — the same F1@0.75 Macrodata uses for free segmentation (here without snap) |
84
-
85
- **Takeaway:** IoU is the event-level unit; continuous F1 is the run-level summary of those IoUs. F1@0.75 is the Macrodata-aligned publish-style bar on the same bindings. Always quote continuous F1 and F1@0.75 together when reporting.
86
 
87
- Shipped code (this repo):
 
88
 
89
- ```text
90
- localization/construct.py # rebuild specs + prompt from gold
91
- localization/score.py # interval IoU, assignment, score_episode, summarize
92
- localization/verify.py # assert parquet specs/prompts match construct()
93
- scripts/score_predictions.py
94
  ```
95
 
 
 
96
  ```bash
97
- # from the dataset root (after cloning or downloading the repo files)
98
  python scripts/score_predictions.py \
99
  --data data/train.parquet \
100
  --preds my_preds.jsonl
101
  ```
102
 
103
- Or with 🤗 Datasets:
104
 
105
- ```python
106
- from datasets import load_dataset
107
- ds = load_dataset("Nano1337/wgo-bench-localization")
108
- row = ds["train"][0]
109
- print(row["id"], row["label_specs"][:2])
110
- # row["video"] is raw MP4 bytes
111
  ```
112
 
113
  ## Reproduce construction
 
26
 
27
  Derived from [Macrodata Labs' WGO-Bench](https://huggingface.co/datasets/macrodata/WGO-Bench) ([blog](https://macrodata.co/blog/annotating-robot-video-subtasks)). License: **CC-BY-NC-SA-4.0**. Keep downstream use consistent with Macrodata's attribution and non-commercial / share-alike terms.
28
 
29
+ ## The job
30
+
31
+ You get a robot video and a list of **what** happened. You must say **when** each thing happened.
32
+
33
+ That is **localization given labels**. Free segmentation asks both *what* and *when*; this dataset isolates *when*.
34
+
35
+ ```text
36
+ INPUT video + shuffled labels (with counts)
37
+ OUTPUT one [start, end] per occurrence
38
+ SCORE per event: IoU
39
+ run: continuous F1 = mean(IoU)
40
+ F1@0.75 = fraction(IoU ≥ 0.75)
41
+ ```
42
+
43
+ ---
44
+
45
+ ## Input
46
+
47
+ For each episode you receive three things that matter:
48
+
49
+ ### 1. Video
50
+
51
+ An MP4 of the episode (`video` — raw bytes in each row). Write it to disk or feed frames / contact sheets into a model.
52
+
53
+ ### 2. Episode instruction (context only)
54
+
55
+ A short high-level task description, e.g. pour the pigments into the container. Background for the model; **not** the event list you must localize.
56
+
57
+ ### 3. Event label list (the real task input)
58
+
59
+ Shuffled unique labels with how many times each occurs. This is `label_specs`, and it is also baked into `prompt_text`. Example:
60
+
61
+ ```text
62
+ Event labels:
63
+ - "place the test tube inside the red cup" (occurs 2 times)
64
+ - "pick up the test tube with red liquid from the right"
65
+ - "pick up the test tube with yellow liquid from the right"
66
+ - "pour the yellow pigment from the test tube into the beaker"
67
+ - "pour the red pigment from the test tube into the beaker"
68
+ ```
69
+
70
+ How to read it:
71
+
72
+ - Each bullet is a gold **label string**.
73
+ - Duplicates appear **once**, with `(occurs N times)`.
74
+ - Order is **shuffled** (construction seed `0`) — **not** time order. You cannot assume list order = timeline order.
75
+
76
+ You are **not** given the gold times in the prompt. Those live in `gold_segments` for scoring (and as training targets if you are training). Never put `gold_segments` in the model prompt.
77
+
78
+ ---
79
+
80
+ ## Output
81
+
82
+ One JSON object per episode:
83
+
84
+ ```json
85
+ {
86
+ "id": "galaxea_028",
87
+ "labels": [
88
+ {
89
+ "label": "place the test tube inside the red cup",
90
+ "intervals": [
91
+ {
92
+ "label_echo": "place the test tube inside the red cup",
93
+ "start_sec": 15.9,
94
+ "end_sec": 19.9
95
+ },
96
+ {
97
+ "label_echo": "place the test tube inside the red cup",
98
+ "start_sec": 34.0,
99
+ "end_sec": 36.7
100
+ }
101
+ ]
102
+ },
103
+ {
104
+ "label": "pick up the test tube with red liquid from the right",
105
+ "intervals": [
106
+ {
107
+ "label_echo": "pick up the test tube with red liquid from the right",
108
+ "start_sec": 19.9,
109
+ "end_sec": 25.0
110
+ }
111
+ ]
112
+ }
113
+ ]
114
+ }
115
+ ```
116
+
117
+ Rules:
118
+
119
+ - Exactly `multiplicity` intervals per listed label
120
+ - `label_echo` must match `label` exactly (no renaming)
121
+ - Do not invent labels that were not listed
122
+ - Times are seconds from the start of the video
123
+
124
+ Write one such object per line in a `predictions.jsonl` for scoring.
125
+
126
+ ---
127
+
128
+ ## Scoring
129
+
130
+ No gold-aware snapping. Predictions are scored as raw intervals.
131
+
132
+ ### Step A — Bind by label, then pair within duplicates
133
+
134
+ 1. Only compare predictions to gold events with the **same** label string.
135
+ 2. If a label occurs twice, optimally assign the two predictions to the two golds to maximize total overlap (deterministic ties).
136
+ 3. Wrong / invented labels are ignored (except in diagnostics).
137
+
138
+ ### Step B — Per event: IoU
139
+
140
+ For each gold event after pairing:
141
+
142
+ \[
143
+ \mathrm{IoU} = \frac{\text{overlap length}}{\text{union length}}
144
+ \]
145
+
146
+ - Perfect match → 1.0
147
+ - No match / no overlap → 0.0
148
+ - Partial → in between
149
+
150
+ **IoU is the event-level metric.** Every gold event gets one number.
151
+
152
+ ### Step C — Run / split summaries
153
+
154
+ | Metric | Definition | Why it exists |
155
+ |--------|------------|----------------|
156
+ | **Continuous F1** (= **mean IoU**) | Mean of the per-event IoUs | Same continuous idea as free-segmentation continuous F1 when counts match (\(N_g = N_p\)); soft credit for near-misses |
157
+ | **F1@0.75** | Fraction of gold events with IoU ≥ 0.75 | Macrodata's publish-style bar on the same bindings. Under 1:1 matching with matched counts, thresholded precision = recall = F1, so the name matches free-seg **F1@0.75** (here without snap) |
158
+
159
+ We do **not** report a separate @0.5 accuracy.
160
+
161
+ **Takeaway:** IoU is the event-level unit; continuous F1 is the run-level average of those IoUs; F1@0.75 is Macrodata's hard bar on the same bindings. Always quote **continuous F1** and **F1@0.75** together.
162
+
163
+ The shipped scorer emits both keys (`continuous_f1` = `mean_iou`, plus `f1_at_0_75`).
164
+
165
+ ---
166
+
167
  ## Splits
168
 
169
  | Split | Source ids | Episodes | Gold events |
 
171
  | `train` | `dev_80` | 80 | 623 |
172
  | `test` | `heldout_20` | 20 | 120 |
173
 
174
+ Construction seed is frozen at **0**. Shuffled `label_specs` and `prompt_text` are materialized per row so order is byte-stable without re-running the RNG. Split id lists are under `meta/splits/`.
175
 
176
  **Challenge leakage rule:** train localization models only on `train`. Score free-mode segmentation F1@0.75 on the untouched `test` episodes (or an external set). Do not train on `test`.
177
 
 
187
  | `split` | string | `train` or `test` |
188
  | `video` | binary | MP4 bytes |
189
  | `label_specs` | list | `{label, multiplicity}` in **prompt order** (post-shuffle) |
190
+ | `gold_segments` | list | `{start_sec, end_sec, label}` in gold order (scoring / training only) |
191
+ | `prompt_text` | string | Exact localization prompt to give the model |
192
  | `construction` | struct | `{seed, protocol, source}` |
193
 
194
+ ## How to run
195
 
196
+ ```python
197
+ from datasets import load_dataset
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
198
 
199
+ ds = load_dataset("Nano1337/wgo-bench-localization")
200
+ row = ds["train"][0]
201
 
202
+ open(f"{row['id']}.mp4", "wb").write(row["video"])
203
+ prompt = row["prompt_text"] # give this + video/frames to the model
204
+ specs = row["label_specs"] # how many intervals to emit per label
 
 
205
  ```
206
 
207
+ Score a `predictions.jsonl` with the shipped scorer (clone this repo or download the files):
208
+
209
  ```bash
 
210
  python scripts/score_predictions.py \
211
  --data data/train.parquet \
212
  --preds my_preds.jsonl
213
  ```
214
 
215
+ Shipped code:
216
 
217
+ ```text
218
+ localization/construct.py # rebuild specs + prompt from gold
219
+ localization/score.py # IoU, assignment, score_episode, summarize
220
+ localization/verify.py # assert parquet specs/prompts match construct()
221
+ scripts/score_predictions.py
 
222
  ```
223
 
224
  ## Reproduce construction