shahedm2001 commited on
Commit
463591f
·
verified ·
1 Parent(s): 7fe851c

Add dataset card + Parquet tables (viewer-friendly)

Browse files
README.md ADDED
@@ -0,0 +1,329 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: cc-by-nc-4.0
3
+ language:
4
+ - en
5
+ tags:
6
+ - medical
7
+ - surgery
8
+ - cataract
9
+ - video-understanding
10
+ - surgical-phase-recognition
11
+ task_categories:
12
+ - video-text-to-text
13
+ - visual-question-answering
14
+ size_categories:
15
+ - 1K<n<10K
16
+ configs:
17
+ - config_name: visual_description
18
+ data_files:
19
+ - split: test
20
+ path: data/visual_description/*.parquet
21
+ default: true
22
+ - config_name: mcq
23
+ data_files:
24
+ - split: test
25
+ path: data/mcq/*.parquet
26
+ - config_name: phase_understanding
27
+ data_files:
28
+ - split: test
29
+ path: data/phase_understanding/*.parquet
30
+ - config_name: narration
31
+ data_files:
32
+ - split: test
33
+ path: data/narration/*.parquet
34
+ ---
35
+
36
+ # Cataract Surgery VLM Evaluation Dataset — Test
37
+
38
+ Self-contained, flat evaluation set for cataract-surgery video understanding.
39
+ No external dependencies — every record and its video live in this single folder.
40
+
41
+ ## At a glance
42
+
43
+ | Item | Count | Notes |
44
+ |------|-------|-------|
45
+ | **JSONL records** | **1004** | one file = one record = one valid JSON line |
46
+ | **Videos (.mp4)** | **518** | flat, prefixed names; ~3.45 GB total |
47
+ | **Split** | Test only | held-out evaluation, no training overlap |
48
+ | **Folder layout** | flat | no subfolders; every `video` field is a relative filename in this folder |
49
+
50
+ ### Record breakdown (1004)
51
+
52
+ | Task category | `question_type` values | Records | Track |
53
+ |---------------|------------------------|---------|-------|
54
+ | **Visual description** (open-ended) | `visual_description` | **293** (162 YouTube + 131 phase) | youtube / phase |
55
+ | **Multiple-choice** (MCQ) | `step_identification`, `instrument_identification`, `visual_observation` | **486** (162 each) | youtube |
56
+ | **Phase understanding** | `boundary_detection` 49, `temporal_localization` 54, `timestamp_to_phase` 47, `contextual_phase_recognition` 60 | **210** | phase |
57
+ | **Procedural narration** | `narration` | **15** | youtube |
58
+
59
+ Videos used:
60
+ - 293 clip videos (162 YouTube + 131 phase) — shared by description and MCQ where applicable
61
+ - 210 phase-task clips (task-specific composites)
62
+ - 15 full-length surgeries (uncut YouTube procedures)
63
+ - Total unique .mp4 = 518 (YT clips reused by description+MCQ are stored once)
64
+
65
+ Procedures in Test:
66
+ - YouTube: 15 (`0xUbMicNy-w`, `2PnbLBFKiyQ`, `9E_jRdOnuqw`, `CztPCggNaUA`, `G1Rpj8EoEGE`, `IFNTpWIMgsQ`, `JYiu3W-86zg`, `M8c_NoP01_A`, `QJwvHv9pBxU`, `_QXWa7QaEgk`, `gT1UMavejVQ`, `if2P7EPOgsY`, `vEA2kqxaXjk`, `wMXS1VGKfNY`, `zaL9vzyCJSI`)
67
+ - Clip counts vary (1–16 per procedure; two procedures have a single clip each)
68
+ - Phase: 23 (`PH_0003_2933_S2` … `PH_0150_2495_S1`)
69
+ - 1–13 clips per procedure for description; 0–20 task clips per procedure for phase tasks (4 procedures have description clips only and no task clips)
70
+
71
+ ---
72
+
73
+ ## File naming
74
+
75
+ All names are prefixed by the parent procedure ID so the flat folder has no collisions:
76
+
77
+ | Record type | JSONL | Video |
78
+ |-------------|-------|-------|
79
+ | Visual description | `<ID>_clip_XX_visual_description.jsonl` | `<ID>_clip_XX.mp4` |
80
+ | MCQ | `<ID>_clip_XX_<question_type>.jsonl` | `<ID>_clip_XX.mp4` |
81
+ | Phase task | `<PH_ID>_<NNNN>_<question_type>.jsonl` | `<PH_ID>_<NNNN>_<question_type>.mp4` |
82
+ | Narration | `<ID>_full_video_narration.jsonl` | `<ID>_full_video.mp4` |
83
+
84
+ Examples:
85
+ - `0xUbMicNy-w_clip_03_visual_description.jsonl` + `0xUbMicNy-w_clip_03.mp4`
86
+ - `0xUbMicNy-w_clip_03_step_identification.jsonl` (shares the same clip mp4)
87
+ - `PH_0003_2933_S2_0121_boundary_detection.jsonl` + `PH_0003_2933_S2_0121_boundary_detection.mp4`
88
+ - `IFNTpWIMgsQ_full_video_narration.jsonl` + `IFNTpWIMgsQ_full_video.mp4`
89
+
90
+ ---
91
+
92
+ ## JSON schema
93
+
94
+ Every file contains a single JSON object (one line). Common envelope:
95
+
96
+ ```json
97
+ {
98
+ "record_id": "<matches filename stem>",
99
+ "task_category": "visual_description | mcq | phase | narration",
100
+ "question_type": "<specific type>",
101
+ "reward_type": "llm_judge | deterministic",
102
+ "split": "Test",
103
+ "track": "youtube | phase",
104
+ "video": "<flat .mp4 filename in this folder>",
105
+ "metadata": { ... }
106
+ }
107
+ ```
108
+
109
+ ### 1) Visual description
110
+
111
+ ```json
112
+ {
113
+ "record_id": "0xUbMicNy-w_clip_01_visual_description",
114
+ "task_category": "visual_description",
115
+ "question_type": "visual_description",
116
+ "reward_type": "llm_judge",
117
+ "video": "0xUbMicNy-w_clip_01.mp4",
118
+ "messages": [
119
+ {"role": "user", "content": [
120
+ {"type": "video", "video": "0xUbMicNy-w_clip_01.mp4"},
121
+ {"type": "text", "text": "Describe what is happening in this cataract surgical video clip."}
122
+ ]},
123
+ {"role": "assistant", "content": "A keratome is used to create a paracentesis incision ..."}
124
+ ],
125
+ "metadata": {
126
+ "parent_video_id": "0xUbMicNy-w",
127
+ "parent_video_title": "CataractCoach™ 2657 ...",
128
+ "parent_video_url": "https://www.youtube.com/watch?v=0xUbMicNy-w",
129
+ "step_number": 1,
130
+ "step_title": "paracentesis creation",
131
+ "clip_duration_seconds": 4,
132
+ "timestamp_start_in_parent": "00:18",
133
+ "timestamp_end_in_parent": "00:22",
134
+ "instruments": ["Keratome"],
135
+ "anatomy": ["cornea", "anterior chamber"]
136
+ }
137
+ }
138
+ ```
139
+
140
+ Prompt variants are all `"Describe what is happening ..."` (YouTube) or `"Describe the visually observable surgical activity ..."` (phase). Phase prompts explicitly forbid inferring beyond visible evidence.
141
+
142
+ ### 2) Multiple-choice (YouTube)
143
+
144
+ ```json
145
+ {
146
+ "record_id": "0xUbMicNy-w_clip_01_step_identification",
147
+ "task_category": "mcq",
148
+ "question_type": "step_identification",
149
+ "reward_type": "deterministic",
150
+ "video": "0xUbMicNy-w_clip_01.mp4",
151
+ "prompt": [
152
+ {"role": "user", "content": [
153
+ {"type": "video", "video": "0xUbMicNy-w_clip_01.mp4"},
154
+ {"type": "text", "text": "Which step is being performed?\nA) ...\nB) ...\n... Respond ONLY with a JSON object with two keys: \"explanation\" and \"answer\". \"explanation\" is 1-3 sentences ... \"answer\" is the single letter A-D. Example: {\"explanation\": \"...\", \"answer\": \"B\"}"}
155
+ ]}
156
+ ],
157
+ "correct_answer": "B",
158
+ "reference_reasoning": "In the video, the surgeon is seen using ...",
159
+ "metadata": { /* same whitelist as above */ }
160
+ }
161
+ ```
162
+
163
+ Three `question_type` values cycle per clip:
164
+ - `step_identification` — which surgical step is shown
165
+ - `instrument_identification` — which instrument is primarily used
166
+ - `visual_observation` — which anatomical / visual cue is present
167
+
168
+ ### 3) Phase understanding (phase procedures)
169
+
170
+ All four tasks share the same ontology (13 phases) listed in every prompt:
171
+
172
+ ```
173
+ P01 Incision · P02 Viscoelastic · P03 Capsulorhexis · P04 Hydrodissection
174
+ P05 Phacoemulsification · P06 Irrigation-Aspiration · P07 Capsule Polishing
175
+ P08 Lens Implantation · P09 Lens Positioning · P10 Viscoelastic Suction
176
+ P11 Anterior Chamber Flushing · P12 Tonifying-Antibiotics · P13 Idle
177
+ ```
178
+
179
+ Prompt instructs: `Respond with a single JSON object with exactly two keys: "explanation" and "answer".`
180
+
181
+ **Expected `answer` per task:**
182
+
183
+ | `question_type` | `correct_answer` shape | Example `answer` |
184
+ |-----------------|------------------------|------------------|
185
+ | `boundary_detection` | `{"timestamp": float}` clip-local seconds | `{"timestamp": 7.7}` |
186
+ | `temporal_localization` | `{"start": float, "end": float}` clip-local | `{"start": 9.4, "end": 13.8}` |
187
+ | `timestamp_to_phase` | `{"phase_id": "P01"-"P13", "phase_name": "..."}` | `{"phase_id": "P09", "phase_name": "Lens Positioning"}` |
188
+ | `contextual_phase_recognition` | `{"phase_id": "P01"-"P13", "phase_name": "..."}` | `{"phase_id": "P03", "phase_name": "Capsulorhexis"}` |
189
+
190
+ Record envelope matches MCQ (prompt + `correct_answer` + `reference_reasoning` + sanitized `metadata`).
191
+
192
+ ### 4) Procedural narration (full video)
193
+
194
+ ```json
195
+ {
196
+ "record_id": "0xUbMicNy-w_full_video_narration",
197
+ "task_category": "narration",
198
+ "question_type": "narration",
199
+ "reward_type": "llm_judge",
200
+ "video": "0xUbMicNy-w_full_video.mp4",
201
+ "messages": [
202
+ {"role": "user", "content": [
203
+ {"type": "video", "video": "0xUbMicNy-w_full_video.mp4"},
204
+ {"type": "text", "text": "Provide a detailed timestamped narration of this surgical procedure."}
205
+ ]},
206
+ {"role": "assistant", "content": "[00:18 - 00:22] paracentesis creation: A keratome is used ...\n[00:22 - 00:27] anterior capsule staining: Trypan blue dye is injected ..."}
207
+ ],
208
+ "metadata": {
209
+ "parent_video_id": "0xUbMicNy-w",
210
+ "parent_video_title": "CataractCoach™ 2657 ...",
211
+ "n_steps": 15,
212
+ "step_titles": ["paracentesis creation", "anterior capsule staining", "..."]
213
+ }
214
+ }
215
+ ```
216
+
217
+ Reference narration is a flowing, chronological concatenation of step descriptions with bracketed intervals.
218
+
219
+ ---
220
+
221
+ ## Rewards & evaluation
222
+
223
+ Two scoring families. Deterministic tasks are 0/1 or continuous in [0,1] without any model judge; open-ended tasks use an LLM judge.
224
+
225
+ ### Deterministic rewards
226
+
227
+ **MCQ and phase identification (`step/instrument/visual_observation`, `timestamp_to_phase`, `contextual_phase_recognition`):**
228
+
229
+ ```
230
+ R_task = 1.0 if normalize(pred_answer) == gold_answer else 0.0
231
+ # pred parsed from JSON key "answer" (letter A-D or phase_id "P01"-"P13", case-insensitive)
232
+ # Strict JSON required; fallback regex extraction allowed but format bonus withheld
233
+ ```
234
+
235
+ **Boundary detection** (`timestamp`, tau = 1.5 s, exponential decay):
236
+
237
+ ```
238
+ R_task = exp(-abs(t_pred - t_gt) / 1.5)
239
+ # 0.0 s error -> 1.000, 0.5 s -> 0.717, 1.5 s -> 0.368, large error -> ~0
240
+ ```
241
+
242
+ **Temporal localization** (`start`, `end`, interval IoU):
243
+
244
+ ```
245
+ inter = max(0, min(pred_end, gt_end) - max(pred_start, gt_start))
246
+ union = (pred_end - pred_start) + (gt_end - gt_start) - inter
247
+ R_task = inter / union # 1.0 perfect overlap, 0.0 no overlap
248
+ ```
249
+
250
+ **Format bonus (phase tasks only, decoupled):**
251
+
252
+ ```
253
+ R_fmt = 1.0 if output is strict valid JSON with exactly {explanation, answer} else 0.0
254
+ R_total = R_task + 0.05 * R_fmt
255
+ # e.g. correct+valid 1.05, correct+malformed 1.00, wrong+valid 0.05, wrong+malformed 0.00
256
+ ```
257
+
258
+ ### LLM-judge rewards
259
+
260
+ Scores are integers **0–5**. Normalized score = score / 5.
261
+
262
+ **Visual description** — single 0–5 against the reference description:
263
+
264
+ - 5 Excellent · 4 Good · 3 Moderate · 2 Poor · 1 Very Poor · 0 Irrelevant/Contradictory
265
+ - Judged on: surgical actions/maneuvers, instruments, anatomy, factuality (no hallucinations)
266
+
267
+ **Procedural narration** — five 0–5 dimensions, each judged against the reference narration:
268
+
269
+ | Dimension | What is checked |
270
+ |-----------|-----------------|
271
+ | `step_coverage` | every major step/phase from the reference is mentioned |
272
+ | `chronological_accuracy` | narrated order matches the reference order |
273
+ | `visual_technical_accuracy` | instruments / tissue interactions match the reference substance |
274
+ | `narrative_flow` | single fluid, well-transitioned narration vs. disjointed list |
275
+ | `overall_score` | holistic 0–5 (factual/chronological correctness weighted over style) |
276
+
277
+ Be strict: generic boilerplate, hallucinated steps/instruments, or a fluent but factually disconnected narration scores low on the factual dimensions regardless of style.
278
+
279
+ ---
280
+
281
+ ## Metadata fields
282
+
283
+ All `metadata` values are allowlisted to stay HuggingFace-safe (no local paths):
284
+
285
+ - YouTube-derived: `parent_video_id`, `parent_video_title`, `parent_video_url`, `step_number`, `step_title`, `clip_duration_seconds`, `timestamp_start_in_parent`, `timestamp_end_in_parent`, `instruments[]`, `anatomy[]`, `transcript_context`, `visual_description`, `clip_id`
286
+ - Phase-derived: `phase_id`, `phase_name`, `site` (S1/S2), `subclip_order`, `phase_occurrence`, `previous_phase`, `next_phase`, `context_bucket`, `phase_clip_id`
287
+ - Narration-derived: `n_steps`, `step_titles[]`
288
+
289
+ Fields intentionally excluded: any local filesystem paths, pipeline internals, or teacher/critic labels.
290
+
291
+ ---
292
+
293
+ ## Usage
294
+
295
+ ```python
296
+ import json, pathlib
297
+
298
+ root = pathlib.Path("evaluation_dataset")
299
+ # Iterate records
300
+ for jf in sorted(root.glob("*.jsonl")):
301
+ rec = json.loads(jf.read_text())
302
+ video_path = root / rec["video"] # resolves inside the same folder
303
+ if rec["task_category"] == "visual_description":
304
+ messages = rec["messages"] # user (video+text), assistant (reference)
305
+ elif rec["task_category"] in ("mcq", "phase"):
306
+ prompt = rec["prompt"] # user (video+text)
307
+ gold = rec["correct_answer"]
308
+ elif rec["task_category"] == "narration":
309
+ messages = rec["messages"]
310
+
311
+ # Quick verification: 1004 one-line records, all videos resolve
312
+ assert len(list(root.glob("*.jsonl"))) == 1004
313
+ assert all(len(open(p).read().strip().splitlines()) == 1 for p in root.glob("*.jsonl"))
314
+ ```
315
+
316
+ For VLM inference, fill the `video` placeholder with frames sampled from the referenced `.mp4` and feed the `messages` / `prompt` text as the user query.
317
+
318
+ ---
319
+
320
+ ## Provenance
321
+
322
+ - YouTube corpus: public cataract surgery videos (clip segments with step/instrument annotations + full videos with chronological narrations).
323
+ - Phase corpus: cataract phase recognition procedures annotated with the 13-phase ontology; task clips are short composites targeting the four phase-understanding skills above.
324
+ - This folder contains only the **Test** split (held-out). Training/validation splits are not included.
325
+
326
+ ## License / citation
327
+
328
+ Videos include third-party YouTube content — respect the original video licenses when redistributing model outputs or excerpts. If you use this evaluation set, please cite the original data sources and note the reward definitions above.
329
+
data/mcq/train-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:9a6578790e431306cc8cdd7a381dd2479277b1826db846fef25af8554cffdebd
3
+ size 789558
data/narration/train-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:54a0923ac64b8a729a85456e6bd0d8c73f2368c8509df3860a1a8ce4caa26241
3
+ size 268402
data/phase_understanding/train-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:ca62bf1d5455ba467a61097981f22e56b30dccdc856ff448664d838be0f59070
3
+ size 87694
data/visual_description/train-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3fed94acc3f6c2e134526f09784e063f6c04bcad519b377abe20d09fb76c1bd3
3
+ size 366939